Skip to content

Commit 962c24f

Browse files
committed
chore: fix unit test
1 parent 41203ff commit 962c24f

File tree

4 files changed

+10
-23
lines changed

4 files changed

+10
-23
lines changed

src/query/ast/src/parser/expr.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,19 +1478,6 @@ pub fn expr_element(i: Input) -> IResult<WithSpan<ExprElement>> {
14781478
},
14791479
);
14801480

1481-
let inverted_expr = map(
1482-
rule! {
1483-
INVERTED ~ #consumed(literal_string)
1484-
},
1485-
|(_, (span, date))| ExprElement::Cast {
1486-
expr: Box::new(Expr::Literal {
1487-
span: transform_span(span.tokens),
1488-
value: Literal::String(date),
1489-
}),
1490-
target_type: TypeName::Interval,
1491-
},
1492-
);
1493-
14941481
let is_distinct_from = map(
14951482
rule! {
14961483
IS ~ NOT? ~ DISTINCT ~ FROM
@@ -1620,7 +1607,6 @@ pub fn expr_element(i: Input) -> IResult<WithSpan<ExprElement>> {
16201607
DATE => with_span!(date_expr).parse(i),
16211608
TIMESTAMP => with_span!(timestamp_expr).parse(i),
16221609
TIMESTAMP_TZ => with_span!(timestamp_tz_expr).parse(i),
1623-
INVERTED => with_span!(inverted_expr).parse(i),
16241610
INTERVAL => with_span!(interval).parse(i),
16251611
DATE_PART | DATEPART => with_span!(date_part).parse(i),
16261612
EXTRACT => with_span!(extract).parse(i),

src/query/ast/tests/it/testdata/expr-error.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ error:
2929
--> SQL:1:14
3030
|
3131
1 | CAST(col1 AS foo)
32-
| ---- ^^^ unexpected `foo`, expecting `BOOL`, `FLOAT`, `BOOLEAN`, `FLOAT32`, `FLOAT64`, `BLOB`, `JSON`, `DOUBLE`, `VECTOR`, `LONGBLOB`, `GEOMETRY`, `GEOGRAPHY`, `STAGE_LOCATION`, `UINT8`, `TINYINT`, `UINT16`, `SMALLINT`, `UINT32`, `INT`, `INTEGER`, `UINT64`, `UNSIGNED`, `BIGINT`, `INT8`, `INT16`, `INT32`, `INT64`, `SIGNED`, `REAL`, `DECIMAL`, `ARRAY`, `MAP`, `BITMAP`, `TUPLE`, `DATE`, `TIMESTAMP`, `TIMESTAMP_TZ`, `DATETIME`, `INTERVAL`, `NUMERIC`, `BINARY`, `VARBINARY`, `MEDIUMBLOB`, `TINYBLOB`, `STRING`, `VARCHAR`, `CHAR`, `CHARACTER`, `TEXT`, `VARIANT`, or `NULLABLE`
32+
| ---- ^^^ unexpected `foo`, expecting `BOOL`, `FLOAT`, `BOOLEAN`, `FLOAT32`, `FLOAT64`, `BLOB`, `JSON`, `DOUBLE`, `VECTOR`, `LONGBLOB`, `GEOMETRY`, `GEOGRAPHY`, `STAGE_LOCATION`, <Ident>, <LiteralString>, `IDENTIFIER`, `UINT8`, `TINYINT`, `UINT16`, `SMALLINT`, `UINT32`, `INT`, `INTEGER`, `UINT64`, `UNSIGNED`, `BIGINT`, `INT8`, `INT16`, `INT32`, `INT64`, `SIGNED`, `REAL`, `DECIMAL`, `ARRAY`, `MAP`, `BITMAP`, `TUPLE`, `DATE`, `TIMESTAMP`, `TIMESTAMP_TZ`, `DATETIME`, `INTERVAL`, `NUMERIC`, `BINARY`, `VARBINARY`, `MEDIUMBLOB`, `TINYBLOB`, `STRING`, `VARCHAR`, `CHAR`, `CHARACTER`, `TEXT`, `VARIANT`, or `NULLABLE`
3333
| |
34+
| while parsing `function(... [ , x -> ... ] ) [ (...) ] [ WITHIN GROUP ( ORDER BY <expr>, ... ) ] [ OVER ([ PARTITION BY <expr>, ... ] [ ORDER BY <expr>, ... ] [ <window frame> ]) ]`
3435
| while parsing expression
3536

3637

@@ -51,8 +52,9 @@ error:
5152
--> SQL:1:10
5253
|
5354
1 | CAST(col1)
54-
| ---- ^ unexpected `)`, expecting `AS`, `,`, `ColumnPosition`, `ROW`, <Ident>, <LiteralString>, `IDENTIFIER`, `[`, <LiteralFloat>, `:`, <LiteralCodeString>, `TRUE`, `FALSE`, <LiteralInteger>, <MySQLLiteralHex>, <PGLiteralHex>, or `NULL`
55+
| ---- ^ unexpected `)`, expecting <Ident>, <LiteralString>, `IDENTIFIER`, `ColumnPosition`, `ROW`, `[`, <LiteralFloat>, `:`, <LiteralCodeString>, `TRUE`, `FALSE`, <LiteralInteger>, <MySQLLiteralHex>, <PGLiteralHex>, `NULL`, `AS`, or `,`
5556
| |
57+
| while parsing `function(... [ , x -> ... ] ) [ (...) ] [ WITHIN GROUP ( ORDER BY <expr>, ... ) ] [ OVER ([ PARTITION BY <expr>, ... ] [ ORDER BY <expr>, ... ] [ <window frame> ]) ]`
5658
| while parsing expression
5759

5860

@@ -103,7 +105,6 @@ error:
103105
--> SQL:3:1
104106
|
105107
1 | G.E.B IS NOT NULL
106-
| - while parsing expression
107108
2 | AND col1 NOT BETWEEN col2 AND
108109
3 | AND 1 + col3 DIV sum(col4)
109110
| ^^^ expected more tokens for expression

src/query/ast/tests/it/testdata/query-error.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ error:
9191
--> SQL:1:45
9292
|
9393
1 | select number + 5 as a, cast(number as float(255))
94-
| ------ ---- ^ unexpected `(`, expecting `)`, `NULL`, or `NOT`
95-
| | |
96-
| | while parsing expression
94+
| ------ ^ unexpected `(`, expecting `*`, `COLUMNS`, <Ident>, <LiteralString>, `IDENTIFIER`, `NULL`, `NOT`, or `)`
95+
| |
9796
| while parsing `SELECT ...`
9897

9998

src/query/ast/tests/it/testdata/stmt-error.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,11 +1036,12 @@ error:
10361036
CREATE FUNCTION IF NOT EXISTS isnotempty AS(p) -> not(is_null(p)
10371037
---------- Output ---------
10381038
error:
1039-
--> SQL:1:65
1039+
--> SQL:1:51
10401040
|
10411041
1 | CREATE FUNCTION IF NOT EXISTS isnotempty AS(p) -> not(is_null(p)
1042-
| ------ -- --- ^ unexpected end of input, expecting `)`, `(`, `WITHIN`, `IGNORE`, `RESPECT`, `OVER`, `ColumnPosition`, `ROW`, <Ident>, <LiteralString>, `IDENTIFIER`, `[`, <LiteralFloat>, `:`, <LiteralCodeString>, `TRUE`, `FALSE`, <LiteralInteger>, <MySQLLiteralHex>, <PGLiteralHex>, `NULL`, or `,`
1043-
| | | |
1042+
| ------ -- ^^^
1043+
| | | |
1044+
| | | expecting an operand
10441045
| | | while parsing expression
10451046
| | while parsing AS (<parameter [parameter type]>, ...) -> <definition expr>
10461047
| while parsing `CREATE [OR REPLACE] FUNCTION [IF NOT EXISTS] <udf_name> <udf_definition> [DESC = <description>]`

0 commit comments

Comments
 (0)