Skip to content

Conversation

@QuLogic
Copy link
Contributor

@QuLogic QuLogic commented Nov 19, 2024

Rationale for this change

See issue.

What changes are included in this PR?

Are these changes tested?

Yes.

Are there any user-facing changes?

Reading a Parquet file won't complain about metadata size in the footer, though that doesn't guarantee anything else will work yet.

By converting the `uint32_t` to little endian before casting to a
`uint8_t*`, this is always correct in the output file.
@QuLogic QuLogic requested a review from wgtmac as a code owner November 19, 2024 12:02
@github-actions
Copy link

⚠️ GitHub issue #44769 has been automatically assigned in GitHub to PR creator.

Copy link
Member

@mapleFU mapleFU left a comment

Choose a reason for hiding this comment

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

General LGTM!

Comment on lines 543 to 544
metadata_len = ::arrow::bit_util::ToLittleEndian(metadata_len);
PARQUET_THROW_NOT_OK(sink->Write(reinterpret_cast<uint8_t*>(&metadata_len), 4));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
metadata_len = ::arrow::bit_util::ToLittleEndian(metadata_len);
PARQUET_THROW_NOT_OK(sink->Write(reinterpret_cast<uint8_t*>(&metadata_len), 4));
{
uint32_t metadata_len_le = ::arrow::bit_util::ToLittleEndian(metadata_len);
PARQUET_THROW_NOT_OK(sink->Write(reinterpret_cast<uint8_t*>(&metadata_len_le), 4));
}

Can we solve like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Nov 19, 2024
PARQUET_ASSIGN_OR_THROW(position, sink->Tell());
metadata_len = static_cast<uint32_t>(position) - metadata_len;

metadata_len = ::arrow::bit_util::ToLittleEndian(metadata_len);
Copy link
Member

Choose a reason for hiding this comment

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

Also same suggestion as above.

Copy link
Member

@mapleFU mapleFU left a comment

Choose a reason for hiding this comment

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

Will merge this tonight

@mapleFU
Copy link
Member

mapleFU commented Nov 20, 2024

Rerun ci, would merge if it passes

@mapleFU mapleFU merged commit 9015a81 into apache:main Nov 20, 2024
36 checks passed
@mapleFU mapleFU removed the awaiting committer review Awaiting committer review label Nov 20, 2024
@mapleFU
Copy link
Member

mapleFU commented Nov 20, 2024

Thanks all, merged!

@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 9015a81.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants