From d3eb784af3e1a582e1812073bc3dddd9385480c4 Mon Sep 17 00:00:00 2001 From: Yijun Zhao Date: Thu, 30 Nov 2023 13:48:04 +0800 Subject: [PATCH] fix --- src/query/ast/src/parser/query.rs | 3 + .../ast/tests/it/testdata/statement-error.txt | 745 ++++++++++++++++++ 2 files changed, 748 insertions(+) create mode 100644 src/query/ast/tests/it/testdata/statement-error.txt diff --git a/src/query/ast/src/parser/query.rs b/src/query/ast/src/parser/query.rs index 4c6ef9a2261ca..dbeb1f1b131a5 100644 --- a/src/query/ast/src/parser/query.rs +++ b/src/query/ast/src/parser/query.rs @@ -146,6 +146,7 @@ pub fn set_operation_element(i: Input) -> IResult> ~ ( GROUP ~ ^BY ~ ^#group_by_items )? ~ ( HAVING ~ ^#expr )? ~ ( WINDOW ~ ^#comma_separated_list1(window_clause) )? + ~ ( QUALIFY ~ ^#expr )? }, |( opt_from_block, @@ -157,6 +158,7 @@ pub fn set_operation_element(i: Input) -> IResult> opt_group_by_block, opt_having_block, opt_window_block, + opt_qualify_block, )| { SetOperationElement::SelectStmt { hints: opt_hints, @@ -171,6 +173,7 @@ pub fn set_operation_element(i: Input) -> IResult> group_by: opt_group_by_block.map(|(_, _, group_by)| group_by), having: Box::new(opt_having_block.map(|(_, having)| having)), window_list: opt_window_block.map(|(_, windows)| windows), + qualify: Box::new(opt_qualify_block.map(|(_, qualify)| qualify)), } }, ); diff --git a/src/query/ast/tests/it/testdata/statement-error.txt b/src/query/ast/tests/it/testdata/statement-error.txt new file mode 100644 index 0000000000000..87f6bb7dd94e1 --- /dev/null +++ b/src/query/ast/tests/it/testdata/statement-error.txt @@ -0,0 +1,745 @@ +---------- Input ---------- +create table a.b (c integer not null 1, b float(10)) +---------- Output --------- +error: + --> SQL:1:38 + | +1 | create table a.b (c integer not null 1, b float(10)) + | ------ ^ unexpected `1`, expecting `)`, `NULL`, `NOT`, `DEFAULT`, `GENERATED`, `AS`, `COMMENT`, or `,` + | | + | while parsing `CREATE TABLE [IF NOT EXISTS] [.] [] []` + + +---------- Input ---------- +create table a (c float(10)) +---------- Output --------- +error: + --> SQL:1:24 + | +1 | create table a (c float(10)) + | ------ ^ unexpected `(`, expecting `)`, `NULL`, `NOT`, `DEFAULT`, `GENERATED`, `AS`, `COMMENT`, or `,` + | | + | while parsing `CREATE TABLE [IF NOT EXISTS] [.]
[] []` + + +---------- Input ---------- +create table a (c varch) +---------- Output --------- +error: + --> SQL:1:19 + | +1 | create table a (c varch) + | ------ - ^^^^^ unexpected `varch`, expecting `VARCHAR`, `CHAR`, `VARIANT`, `CHARACTER`, `VARBINARY`, `ARRAY`, `BINARY`, `MAP`, `DATE`, `STRING`, `FLOAT32`, `FLOAT64`, `DECIMAL`, `SMALLINT`, `DATETIME`, `NULLABLE`, `BOOLEAN`, `BOOL`, `UINT8`, `TINYINT`, `UINT16`, `UINT32`, `INT`, `INTEGER`, `UINT64`, `UNSIGNED`, `BIGINT`, `INT8`, `INT16`, `INT32`, `INT64`, `SIGNED`, `FLOAT`, `DOUBLE`, `BITMAP`, `TUPLE`, `TIMESTAMP`, `TEXT`, or `JSON` + | | | + | | while parsing ` [DEFAULT ] [AS () VIRTUAL] [AS () STORED] [COMMENT '']` + | while parsing `CREATE TABLE [IF NOT EXISTS] [.]
[] []` + + +---------- Input ---------- +create table a (c tuple()) +---------- Output --------- +error: + --> SQL:1:25 + | +1 | create table a (c tuple()) + | ------ - ----- ^ unexpected `)`, expecting `BOOLEAN`, `BOOL`, `UINT8`, `TINYINT`, `UINT16`, `SMALLINT`, `UINT32`, `INT`, `INTEGER`, `UINT64`, `UNSIGNED`, `BIGINT`, `INT8`, `INT16`, `INT32`, `INT64`, `SIGNED`, `FLOAT32`, `FLOAT`, `FLOAT64`, `DOUBLE`, `DECIMAL`, `ARRAY`, `MAP`, `BITMAP`, `TUPLE`, `DATE`, `DATETIME`, `TIMESTAMP`, `STRING`, `VARCHAR`, `CHAR`, `CHARACTER`, `TEXT`, `BINARY`, `VARBINARY`, `VARIANT`, `JSON`, `NULLABLE`, , or + | | | | + | | | while parsing type name + | | while parsing ` [DEFAULT ] [AS () VIRTUAL] [AS () STORED] [COMMENT '']` + | while parsing `CREATE TABLE [IF NOT EXISTS] [.]
[] []` + + +---------- Input ---------- +create table a (c decimal) +---------- Output --------- +error: + --> SQL:1:26 + | +1 | create table a (c decimal) + | ------ - -------^ unexpected `)`, expecting `(` + | | | | + | | | while parsing type name + | | while parsing ` [DEFAULT ] [AS () VIRTUAL] [AS () STORED] [COMMENT '']` + | while parsing `CREATE TABLE [IF NOT EXISTS] [.]
[] []` + + +---------- Input ---------- +create table a (b tuple(c int, uint64)); +---------- Output --------- +error: + --> SQL:1:38 + | +1 | create table a (b tuple(c int, uint64)); + | ------ - ----- ^ unexpected `)`, expecting `BOOLEAN`, `BOOL`, `UINT8`, `TINYINT`, `UINT16`, `SMALLINT`, `UINT32`, `INT`, `INTEGER`, `UINT64`, `UNSIGNED`, `BIGINT`, `INT8`, `INT16`, `INT32`, `INT64`, `SIGNED`, `FLOAT32`, `FLOAT`, `FLOAT64`, `DOUBLE`, `DECIMAL`, `ARRAY`, `MAP`, `BITMAP`, `TUPLE`, `DATE`, `DATETIME`, `TIMESTAMP`, `STRING`, `VARCHAR`, `CHAR`, `CHARACTER`, `TEXT`, `BINARY`, `VARBINARY`, `VARIANT`, `JSON`, or `NULLABLE` + | | | | + | | | while parsing TUPLE( , ...) + | | | while parsing type name + | | while parsing ` [DEFAULT ] [AS () VIRTUAL] [AS () STORED] [COMMENT '']` + | while parsing `CREATE TABLE [IF NOT EXISTS] [.]
[] []` + + +---------- Input ---------- +CREATE TABLE t(c1 NULLABLE(int) NOT NULL); +---------- Output --------- +error: + --> SQL:1:41 + | +1 | CREATE TABLE t(c1 NULLABLE(int) NOT NULL); + | ------ ^ ambiguous NOT NULL constraint + | | + | while parsing `CREATE TABLE [IF NOT EXISTS] [.]
[] []` + + +---------- Input ---------- +drop table if a.b +---------- Output --------- +error: + --> SQL:1:15 + | +1 | drop table if a.b + | ---- ^ unexpected `a`, expecting `EXISTS` + | | + | while parsing `DROP TABLE [IF EXISTS] [.]
` + + +---------- Input ---------- +truncate table a.b.c.d +---------- Output --------- +error: + --> SQL:1:21 + | +1 | truncate table a.b.c.d + | ^ unexpected `.`, expecting `FORMAT` or `;` + + +---------- Input ---------- +truncate a +---------- Output --------- +error: + --> SQL:1:10 + | +1 | truncate a + | -------- ^ unexpected `a`, expecting `TABLE` + | | + | while parsing `TRUNCATE TABLE [.]
` + + +---------- Input ---------- +drop a +---------- Output --------- +error: + --> SQL:1:6 + | +1 | drop a + | ^ unexpected `a`, expecting `TASK`, `TABLE`, `MASKING`, `CATALOG`, `DATABASE`, `AGGREGATING`, `SCHEMA`, `NETWORK`, `VIEW`, `STREAM`, `VIRTUAL`, `USER`, `ROLE`, `FUNCTION`, `STAGE`, `FILE`, `SHARE`, `PIPE`, or `CONNECTION` + + +---------- Input ---------- +insert into t format +---------- Output --------- +error: + --> SQL:1:21 + | +1 | insert into t format + | ------ ^ unexpected end of line, expecting or + | | + | while parsing `INSERT INTO [TABLE]
[(, ...)] (FORMAT | VALUES | )` + + +---------- Input ---------- +show tables format +---------- Output --------- +error: + --> SQL:1:19 + | +1 | show tables format + | ^ unexpected end of line, expecting or + + +---------- Input ---------- +alter database system x rename to db +---------- Output --------- +error: + --> SQL:1:23 + | +1 | alter database system x rename to db + | ----- ^ unexpected `x`, expecting `RENAME` or `.` + | | + | while parsing `ALTER DATABASE [IF EXISTS] ` + + +---------- Input ---------- +create user 'test-e' identified bi 'password'; +---------- Output --------- +error: + --> SQL:1:33 + | +1 | create user 'test-e' identified bi 'password'; + | ^^ unexpected `bi`, expecting `BY`, `WITH`, `FORMAT`, or `;` + + +---------- Input ---------- +create user 'test-e'@'localhost' identified by 'password'; +---------- Output --------- +error: + --> SQL:1:22 + | +1 | create user 'test-e'@'localhost' identified by 'password'; + | ------ ^^^^^^^^^^^ unexpected `'localhost'`, expecting `'%'` or `IDENTIFIED` + | | + | while parsing `CREATE USER [IF NOT EXISTS] ''@'hostname' IDENTIFIED [WITH ] [BY ] [WITH , ...]` + + +---------- Input ---------- +drop usar if exists 'test-j'; +---------- Output --------- +error: + --> SQL:1:6 + | +1 | drop usar if exists 'test-j'; + | ^^^^ unexpected `usar`, expecting `USER`, `SHARE`, `STREAM`, `STAGE`, `AGGREGATING`, `ROLE`, `TABLE`, `SCHEMA`, `NETWORK`, `VIRTUAL`, `CATALOG`, `DATABASE`, `FUNCTION`, `TASK`, `MASKING`, `VIEW`, `FILE`, `PIPE`, or `CONNECTION` + + +---------- Input ---------- +alter user 'test-e' identifies by 'new-password'; +---------- Output --------- +error: + --> SQL:1:21 + | +1 | alter user 'test-e' identifies by 'new-password'; + | ^^^^^^^^^^ unexpected `identifies`, expecting `IDENTIFIED`, `WITH`, `FORMAT`, `@`, or `;` + + +---------- Input ---------- +create role 'test'@'%'; +---------- Output --------- +error: + --> SQL:1:19 + | +1 | create role 'test'@'%'; + | ^ unexpected `@`, expecting `FORMAT` or `;` + + +---------- Input ---------- +drop role 'test'@'%'; +---------- Output --------- +error: + --> SQL:1:17 + | +1 | drop role 'test'@'%'; + | ^ unexpected `@`, expecting `FORMAT` or `;` + + +---------- Input ---------- +SHOW GRANT FOR ROLE 'role1'; +---------- Output --------- +error: + --> SQL:1:6 + | +1 | SHOW GRANT FOR ROLE 'role1'; + | ^^^^^ unexpected `GRANT`, expecting `GRANTS`, `CREATE`, `NETWORK`, `STREAMS`, `CATALOGS`, `FUNCTIONS`, `DATABASES`, `CONNECTIONS`, `TABLE_FUNCTIONS`, `DROP`, `TABLE`, `ROLES`, `SHARE`, `TASKS`, `INDEXES`, `COLUMNS`, `PROCESSLIST`, `STAGES`, `TABLES`, `SHARES`, `ENGINES`, `METRICS`, `SETTINGS`, `SCHEMAS`, `FIELDS`, `USERS`, `FILE`, or `FULL` + + +---------- Input ---------- +GRANT ROLE 'test' TO ROLE test-user; +---------- Output --------- +error: + --> SQL:1:31 + | +1 | GRANT ROLE 'test' TO ROLE test-user; + | ^ unexpected `-`, expecting `FORMAT` or `;` + + +---------- Input ---------- +GRANT SELECT, ALL PRIVILEGES, CREATE ON * TO 'test-grant'; +---------- Output --------- +error: + --> SQL:1:15 + | +1 | GRANT SELECT, ALL PRIVILEGES, CREATE ON * TO 'test-grant'; + | ----- ------ ^^^ unexpected `ALL`, expecting `ALTER`, `SELECT`, `DELETE`, `USAGE`, `INSERT`, `UPDATE`, `SUPER`, `CREATE`, `DROP`, `GRANT`, `SET`, or `OWNERSHIP` + | | | + | | while parsing ON + | while parsing `GRANT { ROLE | schemaObjectPrivileges | ALL [ PRIVILEGES ] ON } TO { [ROLE ] | [USER] }` + + +---------- Input ---------- +GRANT SELECT, CREATE ON *.c TO 'test-grant'; +---------- Output --------- +error: + --> SQL:1:27 + | +1 | GRANT SELECT, CREATE ON *.c TO 'test-grant'; + | ----- ^ unexpected `c`, expecting `TO` or `*` + | | + | while parsing `GRANT { ROLE | schemaObjectPrivileges | ALL [ PRIVILEGES ] ON } TO { [ROLE ] | [USER] }` + + +---------- Input ---------- +GRANT select ON UDF a TO 'test-grant'; +---------- Output --------- +error: + --> SQL:1:21 + | +1 | GRANT select ON UDF a TO 'test-grant'; + | ----- ^ unexpected `a`, expecting `TO` or `.` + | | + | while parsing `GRANT { ROLE | schemaObjectPrivileges | ALL [ PRIVILEGES ] ON } TO { [ROLE ] | [USER] }` + + +---------- Input ---------- +REVOKE SELECT, CREATE, ALL PRIVILEGES ON * FROM 'test-grant'; +---------- Output --------- +error: + --> SQL:1:24 + | +1 | REVOKE SELECT, CREATE, ALL PRIVILEGES ON * FROM 'test-grant'; + | ------ ------ ^^^ unexpected `ALL`, expecting `ALTER`, `SELECT`, `DELETE`, `USAGE`, `INSERT`, `UPDATE`, `SUPER`, `CREATE`, `DROP`, `GRANT`, `SET`, or `OWNERSHIP` + | | | + | | while parsing ON + | while parsing `REVOKE { ROLE | schemaObjectPrivileges | ALL [ PRIVILEGES ] ON } FROM { [ROLE ] | [USER] }` + + +---------- Input ---------- +REVOKE SELECT, CREATE ON * TO 'test-grant'; +---------- Output --------- +error: + --> SQL:1:28 + | +1 | REVOKE SELECT, CREATE ON * TO 'test-grant'; + | ------ ^^ unexpected `TO`, expecting `FROM` or `.` + | | + | while parsing `REVOKE { ROLE | schemaObjectPrivileges | ALL [ PRIVILEGES ] ON } FROM { [ROLE ] | [USER] }` + + +---------- Input ---------- +COPY INTO mytable FROM 's3://bucket' CREDENTIAL = (); +---------- Output --------- +error: + --> SQL:1:38 + | +1 | COPY INTO mytable FROM 's3://bucket' CREDENTIAL = (); + | ^^^^^^^^^^ unexpected `CREDENTIAL`, expecting `CREDENTIALS`, `DISABLE_VARIANT_CHECK`, `RETURN_FAILED_ONLY`, `CONNECTION`, `PURGE`, `VALIDATION_MODE`, `FORCE`, `LOCATION_PREFIX`, `FORMAT`, `PATTERN`, `FILES`, `MAX_FILES`, `SIZE_LIMIT`, `FILE_FORMAT`, `ON_ERROR`, `SPLIT_SIZE`, or `;` + + +---------- Input ---------- +COPY INTO mytable FROM @mystage CREDENTIALS = (); +---------- Output --------- +error: + --> SQL:1:33 + | +1 | COPY INTO mytable FROM @mystage CREDENTIALS = (); + | ^^^^^^^^^^^ unexpected `CREDENTIALS`, expecting `DISABLE_VARIANT_CHECK`, `RETURN_FAILED_ONLY`, `MAX_FILES`, `PURGE`, `VALIDATION_MODE`, `FORCE`, `FORMAT`, `PATTERN`, `FILES`, `SIZE_LIMIT`, `SPLIT_SIZE`, `FILE_FORMAT`, `ON_ERROR`, or `;` + + +---------- Input ---------- +CALL system$test +---------- Output --------- +error: + --> SQL:1:17 + | +1 | CALL system$test + | ---- ^ unexpected end of line, expecting `(` + | | + | while parsing `CALL (, ...)` + + +---------- Input ---------- +CALL system$test(a +---------- Output --------- +error: + --> SQL:1:19 + | +1 | CALL system$test(a + | ---- ^ unexpected end of line, expecting `)` or `,` + | | + | while parsing `CALL (, ...)` + + +---------- Input ---------- +show settings ilike 'enable%' +---------- Output --------- +error: + --> SQL:1:15 + | +1 | show settings ilike 'enable%' + | ^^^^^ unexpected `ilike`, expecting `LIKE`, `LIMIT`, `WHERE`, `FORMAT`, or `;` + + +---------- Input ---------- +PRESIGN INVALID @my_stage/path/to/file +---------- Output --------- +error: + --> SQL:1:9 + | +1 | PRESIGN INVALID @my_stage/path/to/file + | ------- ^^^^^^^ unexpected `INVALID`, expecting `DOWNLOAD`, `AtString`, `UPLOAD`, or + | | + | while parsing `PRESIGN [{DOWNLOAD | UPLOAD}] [EXPIRE = 3600]` + + +---------- Input ---------- +SELECT c a as FROM t +---------- Output --------- +error: + --> SQL:1:12 + | +1 | SELECT c a as FROM t + | ^^ an alias without `AS` keyword has already been defined before this one, please remove one of them + + +---------- Input ---------- +SELECT c a as b FROM t +---------- Output --------- +error: + --> SQL:1:12 + | +1 | SELECT c a as b FROM t + | ^^ an alias without `AS` keyword has already been defined before this one, please remove one of them + + +---------- Input ---------- +SELECT * FROM t GROUP BY GROUPING SETS a, b +---------- Output --------- +error: + --> SQL:1:35 + | +1 | SELECT * FROM t GROUP BY GROUPING SETS a, b + | ^^^^ unexpected `SETS`, expecting `SELECT`, `INTERSECT`, `WITH`, `EXCEPT`, `VALUES`, `OFFSET`, `IGNORE_RESULT`, `,`, `HAVING`, `WINDOW`, `QUALIFY`, `(`, `UNION`, `FROM`, `ORDER`, `LIMIT`, `FORMAT`, or `;` + + +---------- Input ---------- +SELECT * FROM t GROUP BY GROUPING SETS () +---------- Output --------- +error: + --> SQL:1:41 + | +1 | SELECT * FROM t GROUP BY GROUPING SETS () + | ------ ^ unexpected `)`, expecting `(`, `IS`, `IN`, `EXISTS`, `BETWEEN`, `+`, `-`, `*`, `/`, `//`, `DIV`, `%`, `||`, `<->`, `>`, `<`, `>=`, `<=`, `=`, `<>`, `!=`, `^`, `AND`, `OR`, `XOR`, `LIKE`, `NOT`, `REGEXP`, `RLIKE`, `SOUNDS`, , , , , , `->`, `->>`, `#>`, `#>>`, `?`, `?|`, `?&`, `@>`, `<@`, , , , , , `CAST`, `TRY_CAST`, `DATE_ADD`, `DATE_SUB`, `DATE_TRUNC`, `DATE`, `TIMESTAMP`, `INTERVAL`, `::`, `EXTRACT`, `DATE_PART`, or 24 more ... + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +select * from aa.bb limit 10 order by bb; +---------- Output --------- +error: + --> SQL:1:30 + | +1 | select * from aa.bb limit 10 order by bb; + | ------ ^^^^^ ORDER BY must appear before LIMIT + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +select * from aa.bb offset 10 order by bb; +---------- Output --------- +error: + --> SQL:1:31 + | +1 | select * from aa.bb offset 10 order by bb; + | ------ ^^^^^ ORDER BY must appear before OFFSET + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +select * from aa.bb offset 10 limit 1; +---------- Output --------- +error: + --> SQL:1:31 + | +1 | select * from aa.bb offset 10 limit 1; + | ------ ^^^^^ LIMIT must appear before OFFSET + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +select * from aa.bb order by a order by b; +---------- Output --------- +error: + --> SQL:1:32 + | +1 | select * from aa.bb order by a order by b; + | ------ ^^^^^ duplicated ORDER BY clause + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +select * from aa.bb offset 10 offset 20; +---------- Output --------- +error: + --> SQL:1:31 + | +1 | select * from aa.bb offset 10 offset 20; + | ------ ^^^^^^ duplicated OFFSET clause + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +select * from aa.bb limit 10 limit 20; +---------- Output --------- +error: + --> SQL:1:30 + | +1 | select * from aa.bb limit 10 limit 20; + | ------ ^^^^^ duplicated LIMIT clause + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +select * from aa.bb limit 10,2 offset 2; +---------- Output --------- +error: + --> SQL:1:32 + | +1 | select * from aa.bb limit 10,2 offset 2; + | ------ ^^^^^^ LIMIT n,m should not appear OFFSET + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +select * from aa.bb limit 10,2,3; +---------- Output --------- +error: + --> SQL:1:21 + | +1 | select * from aa.bb limit 10,2,3; + | ------ ^^^^^ [LIMIT n OFFSET m] or [LIMIT n,m] + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +with a as (select 1) with b as (select 2) select * from aa.bb; +---------- Output --------- +error: + --> SQL:1:43 + | +1 | with a as (select 1) with b as (select 2) select * from aa.bb; + | ---- ^^^^^^ duplicated WITH clause + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +with as t2(tt) as (select a from t) select t2.tt from t2 +---------- Output --------- +error: + --> SQL:1:6 + | +1 | with as t2(tt) as (select a from t) select t2.tt from t2 + | ---- ^^ unexpected `as`, expecting , , or `RECURSIVE` + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +copy into t1 from "" FILE +---------- Output --------- +error: + --> SQL:1:19 + | +1 | copy into t1 from "" FILE + | ---- ^^ unexpected `""`, expecting , `AtString`, or `(` + | | + | while parsing `COPY + INTO { [.] { ( ) } } + FROM { internalStage | externalStage | externalLocation | ( ) } + [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ] + [ FILES = ( '' [ , '' ] [ , ... ] ) ] + [ PATTERN = '' ] + [ VALIDATION_MODE = RETURN_ROWS ] + [ copyOptions ]` + + +---------- Input ---------- +select $1 from @data/csv/books.csv (file_format => 'aa' bad_arg => 'x', pattern => 'bb') +---------- Output --------- +error: + --> SQL:1:57 + | +1 | select $1 from @data/csv/books.csv (file_format => 'aa' bad_arg => 'x', pattern => 'bb') + | ------ ^^^^^^^ unexpected `bad_arg`, expecting `PATTERN`, `FILE_FORMAT`, `)`, `,`, `FILES`, or `CONNECTION` + | | + | while parsing `SELECT ...` + + +---------- Input ---------- +copy into t1 from "" FILE_FORMAT +---------- Output --------- +error: + --> SQL:1:19 + | +1 | copy into t1 from "" FILE_FORMAT + | ---- ^^ unexpected `""`, expecting , `AtString`, or `(` + | | + | while parsing `COPY + INTO { [.] { ( ) } } + FROM { internalStage | externalStage | externalLocation | ( ) } + [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ] + [ FILES = ( '' [ , '' ] [ , ... ] ) ] + [ PATTERN = '' ] + [ VALIDATION_MODE = RETURN_ROWS ] + [ copyOptions ]` + + +---------- Input ---------- +copy into t1 from "" FILE_FORMAT = +---------- Output --------- +error: + --> SQL:1:19 + | +1 | copy into t1 from "" FILE_FORMAT = + | ---- ^^ unexpected `""`, expecting , `AtString`, or `(` + | | + | while parsing `COPY + INTO { [.] { ( ) } } + FROM { internalStage | externalStage | externalLocation | ( ) } + [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ] + [ FILES = ( '' [ , '' ] [ , ... ] ) ] + [ PATTERN = '' ] + [ VALIDATION_MODE = RETURN_ROWS ] + [ copyOptions ]` + + +---------- Input ---------- +copy into t1 from "" FILE_FORMAT = ( +---------- Output --------- +error: + --> SQL:1:19 + | +1 | copy into t1 from "" FILE_FORMAT = ( + | ---- ^^ unexpected `""`, expecting , `AtString`, or `(` + | | + | while parsing `COPY + INTO { [.] { ( ) } } + FROM { internalStage | externalStage | externalLocation | ( ) } + [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ] + [ FILES = ( '' [ , '' ] [ , ... ] ) ] + [ PATTERN = '' ] + [ VALIDATION_MODE = RETURN_ROWS ] + [ copyOptions ]` + + +---------- Input ---------- +copy into t1 from "" FILE_FORMAT = (TYPE +---------- Output --------- +error: + --> SQL:1:19 + | +1 | copy into t1 from "" FILE_FORMAT = (TYPE + | ---- ^^ unexpected `""`, expecting , `AtString`, or `(` + | | + | while parsing `COPY + INTO { [.] { ( ) } } + FROM { internalStage | externalStage | externalLocation | ( ) } + [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ] + [ FILES = ( '' [ , '' ] [ , ... ] ) ] + [ PATTERN = '' ] + [ VALIDATION_MODE = RETURN_ROWS ] + [ copyOptions ]` + + +---------- Input ---------- +copy into t1 from "" FILE_FORMAT = (TYPE = +---------- Output --------- +error: + --> SQL:1:19 + | +1 | copy into t1 from "" FILE_FORMAT = (TYPE = + | ---- ^^ unexpected `""`, expecting , `AtString`, or `(` + | | + | while parsing `COPY + INTO { [.] { ( ) } } + FROM { internalStage | externalStage | externalLocation | ( ) } + [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ] + [ FILES = ( '' [ , '' ] [ , ... ] ) ] + [ PATTERN = '' ] + [ VALIDATION_MODE = RETURN_ROWS ] + [ copyOptions ]` + + +---------- Input ---------- +copy into t1 from "" FILE_FORMAT = (TYPE = +---------- Output --------- +error: + --> SQL:1:19 + | +1 | copy into t1 from "" FILE_FORMAT = (TYPE = + | ---- ^^ unexpected `""`, expecting , `AtString`, or `(` + | | + | while parsing `COPY + INTO { [.] { ( ) } } + FROM { internalStage | externalStage | externalLocation | ( ) } + [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ] + [ FILES = ( '' [ , '' ] [ , ... ] ) ] + [ PATTERN = '' ] + [ VALIDATION_MODE = RETURN_ROWS ] + [ copyOptions ]` + + +---------- Input ---------- +COPY INTO t1 FROM "" PATTERN = '.*[.]csv' FILE_FORMAT = (type = TSV field_delimiter = '\t' skip_headerx = 0); +---------- Output --------- +error: + --> SQL:1:19 + | +1 | COPY INTO t1 FROM "" PATTERN = '.*[.]csv' FILE_FORMAT = (type = TSV field_delimiter = '\t' skip_headerx = 0); + | ---- ^^ unexpected `""`, expecting , `AtString`, or `(` + | | + | while parsing `COPY + INTO { [.] { ( ) } } + FROM { internalStage | externalStage | externalLocation | ( ) } + [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ] + [ FILES = ( '' [ , '' ] [ , ... ] ) ] + [ PATTERN = '' ] + [ VALIDATION_MODE = RETURN_ROWS ] + [ copyOptions ]` + + +---------- Input ---------- +COPY INTO mytable + FROM @my_stage + FILE_FORMAT = ( + type = CSV, + error_on_column_count_mismatch = 1 + ) +---------- Output --------- +error: + --> SQL:5:54 + | +1 | COPY INTO mytable + | ---- while parsing `COPY + INTO { [.] { ( ) } } + FROM { internalStage | externalStage | externalLocation | ( ) } + [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ] + [ FILES = ( '' [ , '' ] [ , ... ] ) ] + [ PATTERN = '' ] + [ VALIDATION_MODE = RETURN_ROWS ] + [ copyOptions ]` +2 | FROM @my_stage +3 | FILE_FORMAT = ( +4 | type = CSV, +5 | error_on_column_count_mismatch = 1 + | ^ unexpected `1`, expecting `TRUE` or `FALSE` + + +---------- Input ---------- +CREATE CONNECTION IF NOT EXISTS my_conn +---------- Output --------- +error: + --> SQL:1:40 + | +1 | CREATE CONNECTION IF NOT EXISTS my_conn + | ------ ^ unexpected end of line, expecting `STORAGE_TYPE` + | | + | while parsing `CREATE CONNECTION [IF NOT EXISTS] STORAGE_TYPE = ` + +