-
Notifications
You must be signed in to change notification settings - Fork 583
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
Extend lambda support for ClickHouse and DuckDB dialects #1686
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
94e71ff
feat: extend lambda support for clickhouse,duckdb,generic
gstvg 848dc65
fix!: remove parensless lambda from generic
gstvg adf24f9
fix: docs urls fmt, value number literal
gstvg 353f7d7
revert: "fix: docs urls fmt, value number literal"
gstvg dec3856
revert: "fix!: remove parensless lambda from generic"
gstvg ec66e02
fix: docs url fmt, deactivate generic lambda support
gstvg 58b423e
Merge branch 'apache:main' into extend_lambda_support
gstvg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,69 +83,6 @@ fn test_databricks_exists() { | |
); | ||
} | ||
|
||
#[test] | ||
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. Moved into common tests |
||
fn test_databricks_lambdas() { | ||
#[rustfmt::skip] | ||
let sql = concat!( | ||
"SELECT array_sort(array('Hello', 'World'), ", | ||
"(p1, p2) -> CASE WHEN p1 = p2 THEN 0 ", | ||
"WHEN reverse(p1) < reverse(p2) THEN -1 ", | ||
"ELSE 1 END)", | ||
); | ||
pretty_assertions::assert_eq!( | ||
SelectItem::UnnamedExpr(call( | ||
"array_sort", | ||
[ | ||
call( | ||
"array", | ||
[ | ||
Expr::Value(Value::SingleQuotedString("Hello".to_owned())), | ||
Expr::Value(Value::SingleQuotedString("World".to_owned())) | ||
] | ||
), | ||
Expr::Lambda(LambdaFunction { | ||
params: OneOrManyWithParens::Many(vec![Ident::new("p1"), Ident::new("p2")]), | ||
body: Box::new(Expr::Case { | ||
operand: None, | ||
conditions: vec![ | ||
Expr::BinaryOp { | ||
left: Box::new(Expr::Identifier(Ident::new("p1"))), | ||
op: BinaryOperator::Eq, | ||
right: Box::new(Expr::Identifier(Ident::new("p2"))) | ||
}, | ||
Expr::BinaryOp { | ||
left: Box::new(call( | ||
"reverse", | ||
[Expr::Identifier(Ident::new("p1"))] | ||
)), | ||
op: BinaryOperator::Lt, | ||
right: Box::new(call( | ||
"reverse", | ||
[Expr::Identifier(Ident::new("p2"))] | ||
)) | ||
} | ||
], | ||
results: vec![ | ||
Expr::Value(number("0")), | ||
Expr::UnaryOp { | ||
op: UnaryOperator::Minus, | ||
expr: Box::new(Expr::Value(number("1"))) | ||
} | ||
], | ||
else_result: Some(Box::new(Expr::Value(number("1")))) | ||
}) | ||
}) | ||
] | ||
)), | ||
databricks().verified_only_select(sql).projection[0] | ||
); | ||
|
||
databricks().verified_expr( | ||
"map_zip_with(map(1, 'a', 2, 'b'), map(1, 'x', 2, 'y'), (k, v1, v2) -> concat(v1, v2))", | ||
); | ||
databricks().verified_expr("transform(array(1, 2, 3), x -> x + 1)"); | ||
} | ||
|
||
#[test] | ||
fn test_values_clause() { | ||
let values = Values { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Moved from databricks tests