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

add support for unary and binary values in values list, update docs #1172

Merged
merged 3 commits into from
Oct 25, 2021

Conversation

jimexist
Copy link
Member

@jimexist jimexist commented Oct 23, 2021

Which issue does this PR close?

add support for unary and binary values in values list
Closes #1171

Rationale for this change

What changes are included in this PR?

this is a follow up for #1165

Are there any user-facing changes?

@github-actions github-actions bot added datafusion Changes in the datafusion crate documentation Improvements or additions to documentation sql SQL Planner labels Oct 23, 2021
@jimexist jimexist requested a review from alamb October 23, 2021 13:21
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool @jimexist 👍

@@ -191,7 +192,7 @@ DataFusion also includes a simple command-line interactive SQL utility. See the
- Miscellaneous/Boolean functions
- [x] nullif
- Approximation functions
- [ ] approx_distinct
- [x] approx_distinct
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Ok(n) => Ok(lit(n)),
Err(_) => Ok(lit(n.parse::<f64>().unwrap())),
},
SQLExpr::Value(Value::Number(n, _)) => parse_sql_number(n),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could just call sql_to_logical_expr here (rather than repeating part of the parsing) so that any expression in the values list could be supported

That would allow things like CASE .. WHEN .. END type expressions in the VALUES lists as well

Although if we went with that approach, we probably would have to then do a post creation check for unsupported expressions (like Column, Aggregate, etc)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd like to keep this list small for now unless really needed in future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the key assumption here is that for all the expression in the values list they should be evaluated to a scalar or singleton array, but there's no way to test for that during planning time?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd like to keep this list small for now unless really needed in future.

Makes sense to me

the key assumption here is that for all the expression in the values list they should be evaluated to a scalar or singleton array, but there's no way to test for that during planning time?

I think in general most Exprs have the property that they can be compiled into a PhysicalExpr and that PhysicalExpr can be evaluated to produce a ArrayRef. There are some exceptions like Expr::Aggregrate etc that don't compile directly to a PhysicalExpr but are special cased

@alamb alamb changed the title add support for unary and binary values in values list add support for unary and binary values in values list, update docs Oct 25, 2021
@jimexist jimexist merged commit b20846e into apache:master Oct 25, 2021
@jimexist jimexist deleted the more-values-list-impl branch October 25, 2021 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datafusion Changes in the datafusion crate documentation Improvements or additions to documentation sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update the homepage README to include values, approx_distinct, etc.
3 participants