-
Notifications
You must be signed in to change notification settings - Fork 373
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
Introduce codegen optimizations for primitives and fixed-sized-arrays #2970
Conversation
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 ArrowBuffer::len
is dangerously misnamed (even though it follows what arrow2
does), otherwise LGTM!
@@ -133,3 +133,20 @@ pub fn quote_fqname_as_type_path(fqname: impl AsRef<str>) -> TokenStream { | |||
let expr: syn::TypePath = syn::parse_str(&fqname).unwrap(); | |||
quote!(#expr) | |||
} | |||
|
|||
pub fn is_backed_by_arrow_buffer(typ: &DataType) -> bool { |
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.
quite unfortunate that we need this both on the arrow and on the idl type :(
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.
Yeah, I was bothered by that as well. I'd like to refactor the codegen to always use our own type-wrappers, but that turned into a bigger change.
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 made this mistake in C++ codegen for a while; going to our own type wherever possible (which is everywhere for c++ but won't work for Rust) made it a lot better :)
let typ = arrow_registry.get(&obj.fqname); | ||
let obj_field = &obj.fields[0]; |
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.
why not obj.fields[0].is_nullable
, then you don't need the arrow registry
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.
Because if it's a Struct or Union type we can't apply this optimization either. Renaming the check /adding documents to clarify: should_optimize_buffer_slice_deserialize
What
This implements 2 optimizations:
Significant speedups for batch queries:
TODO:
Checklist