<#3121 [Flytekit][Test] Structured dataset picklea...
# flyte-github
c
#3121 [Flytekit][Test] Structured dataset pickleable test Pull request opened by mao3267 Tracking issue flyteorg/flyte#6144 Why are the changes needed? We want to determine whether modifying the
_downloader
functions in FlyteFile and FlyteDirectory from flyteorg/flyte#6144 affects the ability of structured datasets to be pickled. What changes were proposed in this pull request? 1. Add an unit test to check if structured dataset is pickleable. We create a literal structured dataset, then we pickle and unpickle it to verify that it remains unchanged. def test_structured_dataset_pickleable(): import pickle upstream_output = Literal( scalar=literals.Scalar( structured_dataset=StructuredDataset( dataframe=pd.DataFrame({"a": [1, 2], "b": [3, 4]}), uri="bq://test_uri", metadata=StructuredDatasetMetadata( structured_dataset_type=StructuredDatasetType( columns=[ StructuredDatasetType.DatasetColumn( name="a", literal_type=LiteralType(simple=SimpleType.INTEGER) ), StructuredDatasetType.DatasetColumn( name="b", literal_type=LiteralType(simple=SimpleType.INTEGER) ) ], format="parquet" ) ) ) ) ) downstream_input = TypeEngine.to_python_value( FlyteContextManager.current_context(), upstream_output, StructuredDataset ) pickled_input = pickle.dumps(downstream_input) unpickled_input = pickle.loads(pickled_input) assert downstream_input == unpickled_input How was this patch tested? 1. Run
make unit_test
to start the unit tests. Setup process
Copy code
git clone https://github.com/flyteorg/flytekit.git
gh pr checkout 3121
make setup && pip install -e .
Screenshots image Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. Related PRs #3030 Docs link None Summary by Bito Added test cases for structured dataset serialization/deserialization using pickle module. The changes include verification of successful pickling/unpickling of pandas DataFrame within structured datasets, along with new error handling test cases. This ensures compatibility with FlyteFile and FlyteDirectory _downloader function modifications. Unit tests added: True Estimated effort to review (1-5, lower is better): 1 flyteorg/flytekit