-
Notifications
You must be signed in to change notification settings - Fork 175
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
[FEAT]: sql concat and stddev #3153
[FEAT]: sql concat and stddev #3153
Conversation
CodSpeed Performance ReportMerging #3153 will not alter performanceComparing Summary
|
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, just some small comments
src/daft-sql/src/modules/utf8.rs
Outdated
impl SQLFunction for SQLConcat { | ||
fn to_expr( | ||
&self, | ||
inputs: &[sqlparser::ast::FunctionArg], | ||
planner: &crate::planner::SQLPlanner, | ||
) -> SQLPlannerResult<ExprRef> { | ||
let inputs = inputs | ||
.iter() | ||
.map(|input| planner.plan_function_arg(input)) | ||
.collect::<SQLPlannerResult<Vec<_>>>()?; | ||
let mut inputs = inputs.into_iter(); | ||
|
||
let Some(mut first) = inputs.next() else { | ||
invalid_operation_err!("concat requires at least one argument") | ||
}; | ||
for input in inputs { | ||
first = binary_op(Operator::Plus, first, input); | ||
} | ||
|
||
Ok(first) | ||
} | ||
} |
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.
There's a lot of different things that are called concat in Daft (the agg expr, concatting two tables, and now this). Would appreciate some doc strings just to make it easier to understand at a glance what this one does, and why it uses the plus operator.
@@ -62,7 +62,8 @@ def test_utf8_exprs(): | |||
normalize(a, remove_punct:=true, lowercase:=true) as normalize_remove_punct_lower_a, | |||
normalize(a, remove_punct:=true, lowercase:=true, white_space:=true) as normalize_remove_punct_lower_ws_a, | |||
tokenize_encode(a, 'r50k_base') as tokenize_encode_a, | |||
tokenize_decode(tokenize_encode(a, 'r50k_base'), 'r50k_base') as tokenize_decode_a | |||
tokenize_decode(tokenize_encode(a, 'r50k_base'), 'r50k_base') as tokenize_decode_a, | |||
concat(a, '---') as concat_a, |
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.
One more case you could add is concat with more than two arguments, since that should technically be supported too.
No description provided.