Skip to content

feat: Upgrade to sqlparser-rs 0.62.0#22069

Open
andygrove wants to merge 6 commits intoapache:mainfrom
andygrove:sqlparser-0.62.0
Open

feat: Upgrade to sqlparser-rs 0.62.0#22069
andygrove wants to merge 6 commits intoapache:mainfrom
andygrove:sqlparser-0.62.0

Conversation

@andygrove
Copy link
Copy Markdown
Member

@andygrove andygrove commented May 7, 2026

Which issue does this PR close?

N/A

Rationale for this change

Dependency update

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

Bump from crates.io 0.61.0 to git main rev 9833c033bc44c... to gain
access to SparkSqlDialect ahead of the next sqlparser-rs release.

Notable upstream changes absorbed:
- Lambda::params is now OneOrManyWithParens<LambdaFunctionParameter>;
  reject typed lambda parameters (not_impl_err) since DataFusion does
  not model parameter data types.
- Insert::columns is now Vec<ObjectName>; reject multi-part column
  names in INSERT (not_impl_err).
- ExcludeSelectItem::Single/Multiple now carry ObjectName; reject
  multi-part EXCLUDE identifiers (plan_err).
- New SelectItem::ExprWithAliases, BeginTransactionKind::Tran,
  TableConstraint::PrimaryKeyUsingIndex/UniqueUsingIndex,
  TableObject::TableQuery variants -> not_impl_err.
- WildcardAdditionalOptions gained opt_alias -> not_impl_err.
- VALUES rows are now Vec<Parens<Vec<Expr>>>; iterate via .content.
- CREATE FUNCTION return_type is now Option<FunctionReturnType>
  (DataType vs SetOf); reject SETOF.
- escape_char in Like/ILike/SimilarTo is now Option<ValueWithSpan>.
- TableAlias gained `at: Option<Ident>`; CreateTable, CreateView,
  Insert, Update, Delete, Select, TableFactor::Function gained
  several new fields with `not_impl_err!` for unsupported ones.

Update higher_order.slt golden error messages to match new
LambdaFunctionParameter Debug formatting.
@github-actions github-actions Bot added sql SQL Planner logical-expr Logical plan and expressions sqllogictest SQL Logic Tests (.slt) labels May 7, 2026
@andygrove andygrove marked this pull request as ready for review May 7, 2026 21:06
@andygrove andygrove requested review from alamb and comphead May 7, 2026 21:06
Comment on lines +342 to +347
// 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")]
Copy link
Copy Markdown
Member Author

@andygrove andygrove May 7, 2026

Choose a reason for hiding this comment

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

I'm not too sure about this feature gating, tbh.

This is what Claude suggested

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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. 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.

@comphead
Copy link
Copy Markdown
Contributor

comphead commented May 8, 2026

Thanks @andygrove I'll review the PR tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

logical-expr Logical plan and expressions sql SQL Planner sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants