You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "andygrove (via GitHub)" <gi...@apache.org> on 2026/05/07 20:36:08 UTC
[PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
andygrove opened a new pull request, #22069:
URL: https://github.com/apache/datafusion/pull/22069
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
- Closes #.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #22069:
URL: https://github.com/apache/datafusion/pull/22069
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#discussion_r3204737439
##########
datafusion/expr/src/utils.rs:
##########
@@ -339,7 +339,38 @@ fn get_excluded_columns(
idents.push(&excepts.first_element);
idents.extend(&excepts.additional_elements);
}
+ // Declared outside the `if let` so `idents.extend(exclude_owned.iter())`
+ // below can borrow references that outlive the inner scope.
+ #[cfg(feature = "sql")]
+ let exclude_owned: Vec<sqlparser::ast::Ident>;
if let Some(exclude) = opt_exclude {
+ #[cfg(feature = "sql")]
Review Comment:
Claude says:
Here's what's happening and why the cfg(feature = "sql") gates exist:
The setup. datafusion-expr has a sql feature (on by default) that depends on sqlparser. When sql is enabled, ExcludeSelectItem is re-exported from sqlparser::ast. When it's disabled, expr.rs provides its
own fallback enum with Ident payloads (datafusion/expr/src/expr.rs:1431-1436). The two paths in utils.rs already exist via the existing #[cfg(...)] imports at lines 41-45.
What sqlparser 0.62 changed. In 0.61, ExcludeSelectItem::Single carried Ident and Multiple carried Vec<Ident>. In 0.62, both now carry ObjectName (a possibly multi-part name like schema.column). The
fallback enum in expr.rs still uses Ident because that crate-local copy hasn't changed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#discussion_r3212975654
##########
datafusion/expr/src/utils.rs:
##########
@@ -339,7 +339,38 @@ fn get_excluded_columns(
idents.push(&excepts.first_element);
idents.extend(&excepts.additional_elements);
}
+ // Declared outside the `if let` so `idents.extend(exclude_owned.iter())`
+ // below can borrow references that outlive the inner scope.
+ #[cfg(feature = "sql")]
+ let exclude_owned: Vec<sqlparser::ast::Ident>;
if let Some(exclude) = opt_exclude {
+ #[cfg(feature = "sql")]
Review Comment:
I suggest we should update the fallback copy in DataFusion to match the sql parser one.
For example
https://github.com/apache/datafusion/blob/658827d3537e3b9f2f6132ce775a17a7350b1d55/datafusion/expr/src/expr.rs#L1452-L1457
That will avoid the need to have two copies
Looks like this copy came in via #17332 from @timsaucer
Maybe we can add some comments explaining the rationale for the second copy better (any isolate the cfg sql somewhere to make it clearer)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#issuecomment-4427136090
This is rebased on main and ready for another round of reviews @alamb @comphead
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#issuecomment-4441998078
🚀
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#discussion_r3213767208
##########
datafusion/expr/src/utils.rs:
##########
@@ -339,7 +339,38 @@ fn get_excluded_columns(
idents.push(&excepts.first_element);
idents.extend(&excepts.additional_elements);
}
+ // Declared outside the `if let` so `idents.extend(exclude_owned.iter())`
+ // below can borrow references that outlive the inner scope.
+ #[cfg(feature = "sql")]
+ let exclude_owned: Vec<sqlparser::ast::Ident>;
if let Some(exclude) = opt_exclude {
+ #[cfg(feature = "sql")]
Review Comment:
I was trying to understand it. My understanding of this, please correct if I'm wrong is supporting `select * exclude(col)` using sqlparser(sql feature is on) and without it, specifically referring to `ExceptSelectItem`. Why we need to keep parts of parser in DF? Maybe I'm missing something
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#discussion_r3214783742
##########
datafusion/expr/src/utils.rs:
##########
@@ -339,7 +339,38 @@ fn get_excluded_columns(
idents.push(&excepts.first_element);
idents.extend(&excepts.additional_elements);
}
+ // Declared outside the `if let` so `idents.extend(exclude_owned.iter())`
+ // below can borrow references that outlive the inner scope.
+ #[cfg(feature = "sql")]
+ let exclude_owned: Vec<sqlparser::ast::Ident>;
if let Some(exclude) = opt_exclude {
+ #[cfg(feature = "sql")]
Review Comment:
I made a PR to try and make the "use ast shims" clearer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#issuecomment-4402298905
Thanks @andygrove I'll review the PR tomorrow
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#discussion_r3213767208
##########
datafusion/expr/src/utils.rs:
##########
@@ -339,7 +339,38 @@ fn get_excluded_columns(
idents.push(&excepts.first_element);
idents.extend(&excepts.additional_elements);
}
+ // Declared outside the `if let` so `idents.extend(exclude_owned.iter())`
+ // below can borrow references that outlive the inner scope.
+ #[cfg(feature = "sql")]
+ let exclude_owned: Vec<sqlparser::ast::Ident>;
if let Some(exclude) = opt_exclude {
+ #[cfg(feature = "sql")]
Review Comment:
I was trying to understand it. My vision please correct if I'm wrong is supporting `select * exclude(col)` using sqlparser(sql feature is on) and without it, specifically referring to `ExceptSelectItem`. Why we need to keep parts of parser in DF? Maybe I'm missing something
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#discussion_r3214723253
##########
datafusion/expr/src/utils.rs:
##########
@@ -339,7 +339,38 @@ fn get_excluded_columns(
idents.push(&excepts.first_element);
idents.extend(&excepts.additional_elements);
}
+ // Declared outside the `if let` so `idents.extend(exclude_owned.iter())`
+ // below can borrow references that outlive the inner scope.
+ #[cfg(feature = "sql")]
+ let exclude_owned: Vec<sqlparser::ast::Ident>;
if let Some(exclude) = opt_exclude {
+ #[cfg(feature = "sql")]
Review Comment:
> Why we need to keep parts of parser in DF? Maybe I'm missing something
I think the idea is to avoid a dependency on `sqlparser-rs` if you aren't using the SQL interface
> For some users, adding in sqlparser greatly increases build times for their projects even though they are not using sql. This feature makes sql an optional dependency to improve build times and reduce the number of dependencies.
I will propose some comments to make this celar
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#discussion_r3204705488
##########
datafusion/expr/src/utils.rs:
##########
@@ -339,7 +339,38 @@ fn get_excluded_columns(
idents.push(&excepts.first_element);
idents.extend(&excepts.additional_elements);
}
+ // Declared outside the `if let` so `idents.extend(exclude_owned.iter())`
+ // below can borrow references that outlive the inner scope.
+ #[cfg(feature = "sql")]
+ let exclude_owned: Vec<sqlparser::ast::Ident>;
if let Some(exclude) = opt_exclude {
+ #[cfg(feature = "sql")]
Review Comment:
I'm not to sure about this feature gating, tbh.
This is what Claude suggested
##########
datafusion/expr/src/utils.rs:
##########
@@ -339,7 +339,38 @@ fn get_excluded_columns(
idents.push(&excepts.first_element);
idents.extend(&excepts.additional_elements);
}
+ // Declared outside the `if let` so `idents.extend(exclude_owned.iter())`
+ // below can borrow references that outlive the inner scope.
+ #[cfg(feature = "sql")]
+ let exclude_owned: Vec<sqlparser::ast::Ident>;
if let Some(exclude) = opt_exclude {
+ #[cfg(feature = "sql")]
Review Comment:
I'm not too sure about this feature gating, tbh.
This is what Claude suggested
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#discussion_r3213767208
##########
datafusion/expr/src/utils.rs:
##########
@@ -339,7 +339,38 @@ fn get_excluded_columns(
idents.push(&excepts.first_element);
idents.extend(&excepts.additional_elements);
}
+ // Declared outside the `if let` so `idents.extend(exclude_owned.iter())`
+ // below can borrow references that outlive the inner scope.
+ #[cfg(feature = "sql")]
+ let exclude_owned: Vec<sqlparser::ast::Ident>;
if let Some(exclude) = opt_exclude {
+ #[cfg(feature = "sql")]
Review Comment:
I was trying to understand it. My understanding of this, please correct if I'm wrong is supporting `select * exclude(col)` using sqlparser(sql feature is on) and using Datafuiosn, specifically referring to `ExceptSelectItem`. Why we need to keep parts of parser in DF? Maybe I'm missing something
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] feat: Upgrade to sqlparser-rs 0.62.0 [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #22069:
URL: https://github.com/apache/datafusion/pull/22069#discussion_r3213769203
##########
datafusion/expr/src/utils.rs:
##########
@@ -339,7 +339,38 @@ fn get_excluded_columns(
idents.push(&excepts.first_element);
idents.extend(&excepts.additional_elements);
}
+ // Declared outside the `if let` so `idents.extend(exclude_owned.iter())`
+ // below can borrow references that outlive the inner scope.
+ #[cfg(feature = "sql")]
+ let exclude_owned: Vec<sqlparser::ast::Ident>;
if let Some(exclude) = opt_exclude {
+ #[cfg(feature = "sql")]
Review Comment:
Why can't we have unified approach, to use parser or use DataFusion, did they diverge at some point?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org