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

regenerate arrow-ipc/src/gen with patched flatbuffers #6426

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bkietz
Copy link
Member

@bkietz bkietz commented Sep 20, 2024

Which issue does this PR close?

Closes #5052

What changes are included in this PR?

This PR regenerates using patched codegen in google/flatbuffers#8398

  • arrow-ipc/regen.sh is extended to
    • If the $FLATC environment variable is defined, that will be used instead of building flatc from source (useful when testing against patched codegen)
    • Prefix the import flatbuffers::PushAlignment to all generated files for reference by impls of Push::alignment
  • Endianness::equals_to_target_endianness() is moved to arrow-ipc/src/lib.rs (this was originally added to arrow-ipc/src/gen/Schema.rs manually in Result into error in case of endianness mismatches #5301)
  • regen.sh was rerun, cargo doc and cargo test didn't error locally

Are there any user-facing changes?

no

@github-actions github-actions bot added the arrow Changes to the arrow crate label Sep 20, 2024
arrow-ipc/Cargo.toml Outdated Show resolved Hide resolved
sed -i '' '/use core::mem;/d' $f
sed -i '' '/use core::cmp::Ordering;/d' $f
sed -i '' '/use self::flatbuffers::{EndianScalar, Follow};/d' $f
sed --in-place='' '/extern crate flatbuffers;/d' $f
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know why but bash/sed produced an error for me until I made this substitution

sed: can't read /extern crate flatbuffers;/d: No such file or directory

Reading the man page, it seems like the expected invocation for the short flag is -ibackup, equivalent to --inplace=backup (or -i, equivalent to --inplace='')

       -i[SUFFIX], --in-place[=SUFFIX]

              edit files in place (makes backup if SUFFIX supplied)

Should I replace this with

Suggested change
sed --in-place='' '/extern crate flatbuffers;/d' $f
sed -i '/extern crate flatbuffers;/d' $f


# Some files need prefixes
if [[ $f == "File.rs" ]]; then
# Now prefix the file with the static contents
echo -e "${PREFIX}" "${SCHEMA_IMPORT}" | cat - $f > temp && mv temp $f
elif [[ $f == "Message.rs" ]]; then
sed --in-place='' 's/List<Int16>/\`List<Int16>\`/g' $f
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this was another manual edit of the generated files. Moving it here should simplify the next time regen.sh is used. Are there any other manual edits which I haven't noticed?

@@ -39,7 +39,7 @@ arrow-buffer = { workspace = true }
arrow-cast = { workspace = true }
arrow-data = { workspace = true }
arrow-schema = { workspace = true }
flatbuffers = { version = "24.3.25", default-features = false }
flatbuffers = { default-features = false, git = "https://github.com/bkietz/flatbuffers.git", branch = "push-alignment-for-structs" }
Copy link
Member Author

Choose a reason for hiding this comment

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

@bkietz
Copy link
Member Author

bkietz commented Sep 20, 2024

I suspect the flight failures are due to the slight increase in size due to padding FieldNode and Buffer vectors for alignment; the overages are all exactly 8 bytes greater than allowed. May I just increase the allowance?

@bkietz
Copy link
Member Author

bkietz commented Sep 20, 2024

@tustvold @evgenyx00 could you verify this fixes the issue before we start asking for attention on google/flatbuffers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interoperability between arrow-rs and nanoarrow
1 participant