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

Allow any column name in property Parquet files #634

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
16 changes: 5 additions & 11 deletions libtsuba/src/AddProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,13 @@ DoLoadProperties(

std::shared_ptr<arrow::Table> out = std::move(out_res.value());

std::shared_ptr<arrow::Schema> schema = out->schema();
if (schema->num_fields() != 1) {
auto renamed = out->RenameColumns({expected_name});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure renaming is necessary. This way nobody outside of this function can even tell that the name in the Parquet file is not the same as in the metadata. Perhaps nobody looks at it anyway?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, renaming is important since we rely on the arrow schema to name properties. thanks!

if (!renamed.ok()) {
std::shared_ptr<arrow::Schema> schema = out->schema();
return KATANA_ERROR(
tsuba::ErrorCode::InvalidArgument, "expected 1 field found {} instead",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RenameColumns() performs this same check, so we can just rely on that.

schema->num_fields());
tsuba::ErrorCode::InvalidArgument, "{}", renamed.status().ToString());
}

if (schema->field(0)->name() != expected_name) {
return KATANA_ERROR(
tsuba::ErrorCode::InvalidArgument, "expected {} found {} instead",
expected_name, schema->field(0)->name());
}
return out;
return renamed.ValueOrDie();
}

} // namespace
Expand Down