Skip to content

Commit 171b65d

Browse files
authored
fix (#4590)
Signed-off-by: remzi <[email protected]> Signed-off-by: remzi <[email protected]>
1 parent 119f90f commit 171b65d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

datafusion/sql/src/parser.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,8 @@ impl<'a> DFParser<'a> {
429429
}
430430

431431
fn parse_has_file_compression_type(&mut self) -> bool {
432-
self.consume_token(&Token::make_keyword("COMPRESSION"))
433-
& self.consume_token(&Token::make_keyword("TYPE"))
432+
self.parser
433+
.parse_keywords(&[Keyword::COMPRESSION, Keyword::TYPE])
434434
}
435435

436436
fn parse_csv_has_header(&mut self) -> bool {
@@ -719,13 +719,20 @@ mod tests {
719719
let sql = "CREATE EXTERNAL TABLE t STORED AS CSV WITH HEADER LOCATION 'abc'";
720720
expect_parse_error(sql, "sql parser error: Expected LOCATION, found: WITH");
721721

722-
// Error case: `partitioned` is an invalid syntax
722+
// Error case: a single word `partitioned` is invalid
723723
let sql = "CREATE EXTERNAL TABLE t STORED AS CSV PARTITIONED LOCATION 'abc'";
724724
expect_parse_error(
725725
sql,
726726
"sql parser error: Expected LOCATION, found: PARTITIONED",
727727
);
728728

729+
// Error case: a single word `compression` is invalid
730+
let sql = "CREATE EXTERNAL TABLE t STORED AS CSV COMPRESSION LOCATION 'abc'";
731+
expect_parse_error(
732+
sql,
733+
"sql parser error: Expected LOCATION, found: COMPRESSION",
734+
);
735+
729736
Ok(())
730737
}
731738
}

0 commit comments

Comments
 (0)