diff --git a/flytekit/core/type_engine.py b/flytekit/core/type_engine.py index bf31c30450..d76a9c3da1 100644 --- a/flytekit/core/type_engine.py +++ b/flytekit/core/type_engine.py @@ -985,10 +985,10 @@ def to_literal(self, ctx: FlyteContext, python_val: T, python_type: Type[T], exp if type(python_val) != list: raise TypeTransformerFailedError("Expected a list") - if self.is_batchable(python_type): + if ListTransformer.is_batchable(python_type): batchSize = len(python_val) # default batch size # parse annotated to get the number of items saved in a pickle file. - if get_origin(python_type) is Annotated: + if get_origin(python_type) is Annotated and type(get_args(python_type)[1]) == int: batchSize = get_args(python_type)[1] lit_list = [TypeEngine.to_literal(ctx, python_val[i : i + batchSize], FlytePickle, expected.collection_type) for i in range(0, len(python_val), batchSize)] # type: ignore else: