Skip to content

chore(deps): Update sqlparser to 0.56.0 #16456

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

Dimchikkk
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the sql SQL Planner label Jun 19, 2025
Ok(Expr::ScalarFunction(ScalarFunction::new_udf(
fun,
substring_args,
)))
Copy link
Contributor Author

@Dimchikkk Dimchikkk Jun 19, 2025

Choose a reason for hiding this comment

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

Without this change the test fails:

#[test]
fn test_order_by_to_sql_3() {
    let statement = generate_round_trip_statement(
        GenericDialect {},
        r#"SELECT id, first_name, substr(first_name,0,5) FROM person ORDER BY id, substr(first_name,0,5)"#,
    );
    assert_snapshot!(
        statement,
        @r#"SELECT person.id, person.first_name, substr(person.first_name, 0, 5) FROM person ORDER BY person.id ASC NULLS LAST, substr(person.first_name, 0, 5) ASC NULLS LAST"#
    );
}

In the previous version substr were hitting:

            SQLExpr::Function(function) => {
                self.sql_function_to_expr(function, schema, planner_context)
            }

now it's hitting:

            SQLExpr::Substring {
                expr,
                substring_from,
                substring_for,
                special: _,
                shorthand: _,
            } => self.sql_substring_to_expr(
                expr,
                substring_from,
                substring_for,
                schema,
                planner_context,
            ),

Open for suggestions if there is a better way to handle it.

@@ -739,6 +739,12 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
| SQLDataType::AnyType
| SQLDataType::Table(_)
| SQLDataType::VarBit(_)
| SQLDataType::UTinyInt
| SQLDataType::USmallInt
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if the new data types should be handled here or Unsupported SQL type is fine.

settings: None,
format_clause: None,
};
let sub_plan = self.query_to_plan(query, planner_context)?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if I should create a new set_expr_to_plan function or wrapping subquery and passing it to query_to_plan is fine.

@Dimchikkk Dimchikkk marked this pull request as draft June 19, 2025 12:58
@Dimchikkk
Copy link
Contributor Author

(converted to draft while I'm investigating CI failures)

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Jun 20, 2025
@Dimchikkk
Copy link
Contributor Author

(one of the test failures is related to #1898 and would be fixed if that patch is backported to 0.56)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to sqlparser 0.56.0
1 participant