Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHORE] Write tpch parquet files one at a time #3396

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions benchmarking/tpch/data_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,20 +315,24 @@ def gen_parquet(csv_files_location: str) -> str:
table_parquet_path = os.path.join(PARQUET_FILE_PATH, tab_name)
if not os.path.exists(table_parquet_path):
logger.info("Generating Parquet Files for %s", tab_name)
df = daft.read_csv(
os.path.join(csv_files_location, f"{tab_name}.tbl*"),
has_headers=False,
delimiter="|",
).exclude("")
df = df.select(
*[
df[autogen_col_name].alias(actual_col_name)
for actual_col_name, autogen_col_name in zip(SCHEMA[tab_name], df.column_names)
]
)
df = df.write_parquet(table_parquet_path)
df.collect()
assert os.path.exists(table_parquet_path), f"Parquet files not generated by Daft at {table_parquet_path}"
files = glob(os.path.join(csv_files_location, f"{tab_name}.tbl*"))
for file in files:
df = daft.read_csv(
file,
has_headers=False,
delimiter="|",
).exclude("")
colin-ho marked this conversation as resolved.
Show resolved Hide resolved
df = df.select(
*[
df[autogen_col_name].alias(actual_col_name)
for actual_col_name, autogen_col_name in zip(SCHEMA[tab_name], df.column_names)
]
)
df = df.write_parquet(table_parquet_path)
df.collect()
colin-ho marked this conversation as resolved.
Show resolved Hide resolved
assert os.path.exists(
table_parquet_path
), f"Parquet files not generated by Daft at {table_parquet_path}"
else:
logger.info(
"Cached Parquet files for table %s already exists at %s, skipping Parquet file generation",
Expand Down