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

fix(sqlparser): fix operator precedence between '>=' and 'IN' #7665

Merged
merged 6 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/frontend/planner_test/tests/testdata/expr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,13 @@
logical_plan: |
LogicalProject { exprs: [Array(1:Int32, null:Int32)] }
└─LogicalValues { rows: [[]], schema: Schema { fields: [] } }

- name: regression (#7641) -fuzzing test failed at Bind error,types Boolean and Varchar cannot be matched
sql: |
select false >= 'LN1O0QP1yi' NOT IN (md5('4SeUPZhUbH'))
batch_plan: |
BatchProject { exprs: [(false:Boolean >= Not(In('LN1O0QP1yi':Varchar, Md5('4SeUPZhUbH':Varchar))))] }
└─BatchValues { rows: [[]] }
- name: const_eval of const expr
sql: |
create table t(v1 int);
Expand All @@ -546,4 +553,4 @@
└─BatchScan { table: t, columns: [t.v1], distribution: SomeShard }
- name: const_eval of division by 0 error
sql: |
select 1 / 0 t1;
select 1 / 0 t1;
4 changes: 2 additions & 2 deletions src/sqlparser/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ pub struct Parser {
}

impl Parser {
const BETWEEN_PREC: u8 = 20;
const BETWEEN_PREC: u8 = 21;
const PLUS_MINUS_PREC: u8 = 30;
const TIME_ZONE_PREC: u8 = 20;
const TIME_ZONE_PREC: u8 = 21;
const UNARY_NOT_PREC: u8 = 15;

/// Parse the specified tokens
Expand Down