-
Notifications
You must be signed in to change notification settings - Fork 837
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
base: main
Are you sure you want to change the base?
Conversation
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 |
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.
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
sed --in-place='' '/extern crate flatbuffers;/d' $f | |
sed -i '/extern crate flatbuffers;/d' $f |
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.
IIRC Mac's sed (BSD utils) and the Linux coreutils sed behave differently. It's a bit of a pain.
|
||
# 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 |
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.
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?
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? |
@tustvold @evgenyx00 could you verify this fixes the issue before we start asking for attention on google/flatbuffers? |
Perhaps we could re-enable the test for nanoarrow that was disabled in #6449 as part of this PR? |
41d3a5b
to
7c8324f
Compare
@@ -65,8 +65,7 @@ jobs: | |||
ARROW_INTEGRATION_JAVA: ON | |||
ARROW_INTEGRATION_JS: ON | |||
ARCHERY_INTEGRATION_TARGET_IMPLEMENTATIONS: "rust" | |||
# Disable nanoarrow integration, due to https://github.com/apache/arrow-rs/issues/5052 |
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.
Removing this line and having the test run successfully is quite compelling. Nice work @bkietz
7c8324f
to
8b19902
Compare
@alamb Is there anything which needs to happen to this PR? |
arrow-ipc/Cargo.toml
Outdated
@@ -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/google/flatbuffers.git", rev = "49061f8c7c99363eeea25c5e4337ebb499928467" } |
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.
I think this would need to be updated to a non-git version prior to merge, otherwise we'd be unable to make a release off main.
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.
In fact I think we can't actually release a fix for arrow with this fix as the upstream change adds a new method alignment
-- it doesn't just update the generated code I think
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.
When I reverted this pin it fails to compile
error[E0433]: failed to resolve: could not find `PushAlignment` in `flatbuffers`
--> arrow-ipc/src/gen/File.rs:71:22
|
71 | flatbuffers::PushAlignment::new(8)
| ^^^^^^^^^^^^^ could not find `PushAlignment` in `flatbuffers`
Thus I think we need to wait for the next flatbuffers release 🤔
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.
Thanks @bkietz -- I think I mostly need about 4 extra hours each day !
arrow-ipc/Cargo.toml
Outdated
@@ -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/google/flatbuffers.git", rev = "49061f8c7c99363eeea25c5e4337ebb499928467" } |
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.
In fact I think we can't actually release a fix for arrow with this fix as the upstream change adds a new method alignment
-- it doesn't just update the generated code I think
arrow-ipc/Cargo.toml
Outdated
@@ -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/google/flatbuffers.git", rev = "49061f8c7c99363eeea25c5e4337ebb499928467" } |
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.
When I reverted this pin it fails to compile
error[E0433]: failed to resolve: could not find `PushAlignment` in `flatbuffers`
--> arrow-ipc/src/gen/File.rs:71:22
|
71 | flatbuffers::PushAlignment::new(8)
| ^^^^^^^^^^^^^ could not find `PushAlignment` in `flatbuffers`
Thus I think we need to wait for the next flatbuffers release 🤔
Hey! Any updates here? 🙏 |
So maybe someone could file / find a ticket upstream in flatbuffers asking about a new rust release? |
I've pinged a potential person here: Let's see. flatbuffers isn't a particularly active project. |
New flatbuffers version has been released (24.12.23) |
Thanks @osipovartem @osipovartem or @bkietz -- can one of you prepare a PR using the newly released flatbuffers code? I would be happy to review it afterwards. |
16783bc
to
ac8b01c
Compare
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.
This looks great (and epic) to me. Thank you so much @bkietz for pushing it along and sticking with it 🎉 🚀 🏅
@@ -38,7 +38,7 @@ arrow-array = { workspace = true } | |||
arrow-buffer = { workspace = true } | |||
arrow-data = { workspace = true } | |||
arrow-schema = { workspace = true } | |||
flatbuffers = { version = "24.3.25", default-features = false } | |||
flatbuffers = { version = "24.12.23", default-features = false } |
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.
🎉
@@ -1057,15 +1057,6 @@ impl Endianness { | |||
_ => None, | |||
} | |||
} | |||
|
|||
/// Returns true if the endianness of the source system matches the endianness of the target system. |
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.
💯 for extracting this out to a non gen file
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 |
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.
IIRC Mac's sed (BSD utils) and the Linux coreutils sed behave differently. It's a bit of a pain.
let src = ::core::slice::from_raw_parts(self as *const Block as *const u8, Self::size()); | ||
dst.copy_from_slice(src); | ||
} | ||
+ #[inline] |
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.
Shouldn't flatbuffers 24.12.23 do that now?
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
$FLATC
environment variable is defined, that will be used instead of building flatc from source (useful when testing against patched codegen)flatbuffers::PushAlignment
to all generated files for reference by impls ofPush::alignment
cargo doc
andcargo test
didn't error locallyAre there any user-facing changes?
no