You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We now have a solid foundation for converting Exprs --> SQL (see #9495 for why this is valuable).
It should now be straightforward to add support for the remaining Expr types and doing so is a great way to get more familiar with DataFusion's core data structures and optimization algorithms without already having expertise in database internals.
Describe the solution you'd like
The basic task is to:
Pick one (or a few) of the expressions below
Create a PR to Implement the Expr --> AST reverse code (in this match statement)
Hi @devanbenz , I think ScalarVariable has not been done yet and you could have a try, though it may not be possible.🤔
I think maybe it should be converted to ScalarValue first, then call scalar_to_sql function.
Hi @devanbenz , I think ScalarVariable has not been done yet and you could have a try, though it may not be possible.🤔 I think maybe it should be converted to ScalarValue first, then call scalar_to_sql function.
Taking a look at this today. Will give it a try and update this thread with any thoughts, observations, or problems I run in to :)
Thanks @devanbenz -- can you explain how this is related to this issue? (Sorry I am sure it is obvious but I can't keep everything in my head anymore )
Thanks @devanbenz -- can you explain how this is related to this issue? (Sorry I am sure it is obvious but I can't keep everything in my head anymore )
All good - this is for the Unparserexpr_to_sql match statement
It seems to me that Expr::ScalarVariable currently is parsed from ast::Identifier (that starts with @)-- perhaps instead of adding a new ast node, you could just create an equivalent ast::Identifier 🤔
It seems to me that Expr::ScalarVariable currently is parsed from ast::Identifier (that starts with @)-- perhaps instead of adding a new ast node, you could just create an equivalent ast::Identifier 🤔
Activity
[-]Implement support for `Expr --> String `[/-][+]Complete support for `Expr --> String `[/+]Lordworms commentedon Mar 22, 2024
take IsTrue, IsFalse, IsUnknown
sebastian2296 commentedon Mar 22, 2024
I'd like to work on isNotNull, Not and Between
yyy1000 commentedon Mar 23, 2024
take ScalarFunction and InList
yyy1000 commentedon Mar 25, 2024
take Case
Weijun-H commentedon Mar 26, 2024
take Like
kevinmingtarja commentedon Mar 26, 2024
take Sort, Exists
pratikpugalia commentedon Mar 26, 2024
I'd like to work on Negative
alamb commentedon Apr 1, 2024
It looks like there are a few things not yet complete in https://github.com/apache/arrow-datafusion/blob/main/datafusion/sql/src/unparser/expr.rs#L52
yyy1000 commentedon Apr 1, 2024
take SimilarTo, IsNotTrue, IsNotUnknown,Negative
yyy1000 commentedon Apr 1, 2024
Here is a list that has not been done yet, for interested contributor to better view:
7 remaining items
yyy1000 commentedon Apr 16, 2024
Hi @devanbenz , I think
ScalarVariablehas not been done yet and you could have a try, though it may not be possible.🤔I think maybe it should be converted to
ScalarValuefirst, then callscalar_to_sqlfunction.alamb commentedon Apr 16, 2024
Here are some thoughts to help people figure out what SQL matches to what expression:
GetIndexedField--> `SELECT col['field_name']@@foo@@?CAST (COL AS <datatype>>col ASCorcol DESC NULLS FIRSTcol exists (SELECT 1 from foo)COUNT(*)SELECT $1UNNEST(SELECT col FROM bar)first_value(x ORDER BY y PARTITION BY z)devanbenz commentedon Apr 23, 2024
Taking a look at this today. Will give it a try and update this thread with any thoughts, observations, or problems I run in to :)
devanbenz commentedon Apr 23, 2024
@alamb I beleive
ScalarVariablewould just be something like@variable.alamb commentedon Apr 23, 2024
Thanks @devanbenz !
devanbenz commentedon May 6, 2024
@alamb if you could please take a look at apache/datafusion-sqlparser-rs#1260 -- it's linked to this issue :)
alamb commentedon May 6, 2024
Thanks @devanbenz -- can you explain how this is related to this issue? (Sorry I am sure it is obvious but I can't keep everything in my head anymore )
devanbenz commentedon May 6, 2024
All good - this is for the
Unparserexpr_to_sqlmatch statementdatafusion/datafusion/sql/src/unparser/expr.rs
Line 391 in 89443bf
alamb commentedon May 7, 2024
It seems to me that
Expr::ScalarVariablecurrently is parsed fromast::Identifier(that starts with@)-- perhaps instead of adding a new ast node, you could just create an equivalentast::Identifier🤔datafusion/datafusion/sql/src/expr/identifier.rs
Lines 28 to 43 in accce97
devanbenz commentedon May 7, 2024
Sounds good - I'll have some time to come back to this in the next couple days! Will modify per your suggestion :)
alamb commentedon May 15, 2024
I filed tickets for the remaining issues
These ones are likely straightforward.
ScalarVariableExpr --> String Support #10518IsNull/IsNotNullExpr --> String Support #10519PlaceholderExpr --> String Support #10522The others are likely more involved as I don't know how to make a reproducer
alamb commentedon May 20, 2024
With the completion of #10555 from @xinlifoobar I think this epic is now done!