Skip to content
Open
Changes from 1 commit
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
17 changes: 5 additions & 12 deletions libtsuba/src/AddProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
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());
}

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});
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, "{}", renamed.status().ToString());
}
return out;
return renamed.ValueOrDie();
}

} // namespace
Expand Down