-
Notifications
You must be signed in to change notification settings - Fork 66
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,19 +35,12 @@ 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) { | ||
return KATANA_ERROR( | ||
tsuba::ErrorCode::InvalidArgument, "expected 1 field found {} instead", | ||
schema->num_fields()); | ||
} | ||
|
||
if (schema->field(0)->name() != expected_name) { | ||
return KATANA_ERROR( | ||
tsuba::ErrorCode::InvalidArgument, "expected {} found {} instead", | ||
expected_name, schema->field(0)->name()); | ||
auto renamed = out->RenameColumns({expected_name}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, "{}", renamed.status().ToString()); | ||
} | ||
return out; | ||
return renamed.ValueOrDie(); | ||
} | ||
|
||
} // namespace | ||
|
There was a problem hiding this comment.
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.