Skip to content

Commit bc65f6e

Browse files
Save schema in old location for backwards compatibility (#267)
* Save schema in old location for backwards compatibility * Restore schema remove in `test_hive_partitioned_data` --------- Co-authored-by: Karl Higley <karlb@nvidia.com>
1 parent 8e74447 commit bc65f6e

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

merlin/io/dataset.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,8 @@ def to_parquet(
952952
fs.mkdirs(str(output_path), exist_ok=True)
953953

954954
tf_metadata = TensorflowMetadata.from_merlin_schema(schema)
955+
tf_metadata.to_proto_text_file(output_path)
956+
955957
metadata_path = fs.sep.join([str(output_path), MERLIN_METADATA_DIR_NAME])
956958
fs.mkdirs(metadata_path, exist_ok=True)
957959
tf_metadata.to_json_file(metadata_path)

tests/unit/io/test_io.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,9 @@ def test_hive_partitioned_data(tmpdir, cpu):
683683
assert result_paths
684684
assert all(p.endswith(".parquet") for p in result_paths)
685685

686+
# reading into dask dastaframe cannot have schema in same directory
687+
os.remove(os.path.join(path, "schema.pbtxt"))
688+
686689
# Read back with dask.dataframe and check the data
687690
df_check = dd.read_parquet(path, engine="pyarrow").compute()
688691
df_check["name"] = df_check["name"].astype("object")

0 commit comments

Comments
 (0)