Skip to content
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

Merged
merged 5 commits into from
Oct 31, 2024

Conversation

universalmind303
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the enhancement New feature or request label Oct 30, 2024
@universalmind303 universalmind303 changed the title [FEAT]: sql concat [FEAT]: sql concat and stddev Oct 30, 2024
Copy link

codspeed-hq bot commented Oct 30, 2024

CodSpeed Performance Report

Merging #3153 will not alter performance

Comparing universalmind303:sql-concat (2710351) with main (f966e02)

Summary

✅ 17 untouched benchmarks

Copy link
Member

@kevinzwang kevinzwang left a 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

Comment on lines 547 to 568
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)
}
}
Copy link
Member

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,
Copy link
Member

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.

@andrewgazelka andrewgazelka removed their request for review October 31, 2024 00:54
@universalmind303 universalmind303 merged commit 301cd48 into Eventual-Inc:main Oct 31, 2024
38 checks passed
sagiahrac pushed a commit to sagiahrac/Daft that referenced this pull request Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants