-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: mark ScalarUDFImpl::invoke_batch as deprecated #15049
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
Changes from all commits
6a954b2
ce73e6c
5eb52df
a981309
80e30b1
e1e53e7
a0cacae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,9 @@ | |
|
||
extern crate criterion; | ||
|
||
use arrow::datatypes::DataType; | ||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
use datafusion_expr::ScalarFunctionArgs; | ||
use helper::gen_string_array; | ||
|
||
mod helper; | ||
|
@@ -26,6 +28,8 @@ fn criterion_benchmark(c: &mut Criterion) { | |
// All benches are single batch run with 8192 rows | ||
let character_length = datafusion_functions::unicode::character_length(); | ||
|
||
let return_type = DataType::Utf8; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to look up what the correct return type should be, but there is nothing validating that I got it correct nor that it won't get broken in the future, e.g. if some of these functions start returning stringview instead. But given these are benches, I guess that's fine? If the type is used and wrong, presumably it'll complain somewhere, if it's not used and it's wrong it's not the end of the world. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree -- this change is fine. Thank you |
||
|
||
let n_rows = 8192; | ||
for str_len in [8, 32, 128, 4096] { | ||
// StringArray ASCII only | ||
|
@@ -34,8 +38,11 @@ fn criterion_benchmark(c: &mut Criterion) { | |
&format!("character_length_StringArray_ascii_str_len_{}", str_len), | ||
|b| { | ||
b.iter(|| { | ||
// TODO use invoke_with_args | ||
black_box(character_length.invoke_batch(&args_string_ascii, n_rows)) | ||
black_box(character_length.invoke_with_args(ScalarFunctionArgs { | ||
args: args_string_ascii.clone(), | ||
number_rows: n_rows, | ||
return_type: &return_type, | ||
})) | ||
}) | ||
}, | ||
); | ||
|
@@ -46,8 +53,11 @@ fn criterion_benchmark(c: &mut Criterion) { | |
&format!("character_length_StringArray_utf8_str_len_{}", str_len), | ||
|b| { | ||
b.iter(|| { | ||
// TODO use invoke_with_args | ||
black_box(character_length.invoke_batch(&args_string_utf8, n_rows)) | ||
black_box(character_length.invoke_with_args(ScalarFunctionArgs { | ||
args: args_string_utf8.clone(), | ||
number_rows: n_rows, | ||
return_type: &return_type, | ||
})) | ||
}) | ||
}, | ||
); | ||
|
@@ -58,10 +68,11 @@ fn criterion_benchmark(c: &mut Criterion) { | |
&format!("character_length_StringViewArray_ascii_str_len_{}", str_len), | ||
|b| { | ||
b.iter(|| { | ||
// TODO use invoke_with_args | ||
black_box( | ||
character_length.invoke_batch(&args_string_view_ascii, n_rows), | ||
) | ||
black_box(character_length.invoke_with_args(ScalarFunctionArgs { | ||
args: args_string_view_ascii.clone(), | ||
number_rows: n_rows, | ||
return_type: &return_type, | ||
})) | ||
}) | ||
}, | ||
); | ||
|
@@ -72,10 +83,11 @@ fn criterion_benchmark(c: &mut Criterion) { | |
&format!("character_length_StringViewArray_utf8_str_len_{}", str_len), | ||
|b| { | ||
b.iter(|| { | ||
// TODO use invoke_with_args | ||
black_box( | ||
character_length.invoke_batch(&args_string_view_utf8, n_rows), | ||
) | ||
black_box(character_length.invoke_with_args(ScalarFunctionArgs { | ||
args: args_string_view_utf8.clone(), | ||
number_rows: n_rows, | ||
return_type: &return_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.
Can we replace this
invoke_batch
withinvoke_with_args
? So that theallow(deprecated)
can be removed.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.
Not really, since for invoke_with_args we'd need the return type which isn't provided here. Also I don't see that as very important change anyways, this is also
invoke_batch
and deprecated so passing directly through makes sense, and both theseinvoke_batch
s can be removed at the same time.