devinjdangelo commented on code in PR #9599:
URL: https://github.com/apache/arrow-datafusion/pull/9599#discussion_r1536626105
##########
datafusion/sqllogictest/test_files/create_external_table.slt:
##########
@@ -100,9 +100,17 @@ CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV WITH
LOCATION 'foo.csv';
statement error DataFusion error: SQL error: ParserError\("Unexpected token
FOOBAR"\)
CREATE EXTERNAL TABLE t(c1 int) STORED AS CSV FOOBAR BARBAR BARFOO LOCATION
'foo.csv';
+# Missing partition column
Review Comment:
It would be good to add a positive test case of the new syntax to
sqllogictests as well. In insert_to_external.slt, we can even fully end-to-end
test creating the external table, inserting some data, and querying it back to
ensure everything is working as expected.
##########
datafusion/sql/src/parser.rs:
##########
@@ -175,7 +175,7 @@ pub(crate) type LexOrdering = Vec<OrderByExpr>;
/// [ WITH HEADER ROW ]
/// [ DELIMITER <char> ]
/// [ COMPRESSION TYPE <GZIP | BZIP2 | XZ | ZSTD> ]
-/// [ PARTITIONED BY (<column list>) ]
+/// [ PARTITIONED BY (<column_definition list> | <column list>) ]
Review Comment:
:+1:
##########
datafusion/sql/src/parser.rs:
##########
@@ -679,7 +679,25 @@ impl<'a> DFParser<'a> {
Keyword::PARTITIONED => {
self.parser.expect_keyword(Keyword::BY)?;
ensure_not_set(&builder.table_partition_cols,
"PARTITIONED BY")?;
- builder.table_partition_cols =
Some(self.parse_partitions()?);
+ let peeked = self.parser.peek_nth_token(2);
+ if peeked == Token::Comma || peeked == Token::RParen {
Review Comment:
Yeah, it is not immediately clear why this logic works. I think at a minimum
we should add a comment explaining the reasoning of this condition.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]