-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Various refactors to string functions #19402
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
base: main
Are you sure you want to change the base?
Conversation
| if arg_types[0] == DataType::Utf8View { | ||
| Ok(DataType::Utf8View) | ||
| } else { | ||
| utf8_to_str_type(&arg_types[0], "ltrim") |
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.
utf8_to_str_type() preserves type to LargeUtf8 if input is large, otherwise just Utf8; we can see we also preserve view type, so in this case we are just preserving the input type as is
| TypeSignature::Exact(vec![LargeUtf8, Utf8, Int64]), | ||
| TypeSignature::Exact(vec![Utf8, LargeUtf8, Int64]), | ||
| TypeSignature::Exact(vec![LargeUtf8, LargeUtf8, Int64]), | ||
| Coercion::new_exact(TypeSignatureClass::Native(logical_string())), |
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.
More compact API
| UInt16 => make_scalar_function(to_hex::<UInt16Type>, vec![])(&args.args), | ||
| Int8 => make_scalar_function(to_hex::<Int8Type>, vec![])(&args.args), | ||
| UInt8 => make_scalar_function(to_hex::<UInt8Type>, vec![])(&args.args), | ||
| DataType::Null => Ok(ColumnarValue::Scalar(ScalarValue::Utf8(None))), |
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 prefer having the DataType:: but this is just personal preference, can revert if is too verbose
martin-g
left a comment
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.
LGTM
Which issue does this PR close?
N/A
Rationale for this change
Clean up some signatures & unnecessary code in string functions
What changes are included in this PR?
Various refactors, see comments.
Are these changes tested?
Existing tests.
Are there any user-facing changes?
No.