wenxiaojie1 commented on code in PR #2395:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2395#discussion_r3870507648
##########
tests/sqlparser_hive.rs:
##########
@@ -226,6 +227,28 @@ fn create_table_with_clustered_by() {
);
}
+#[test]
+fn display_create_table_with_skewed_by() {
+ let column = |name| ColumnDef {
+ name: Ident::new(name),
+ data_type: DataType::String(None),
+ options: vec![],
+ };
+ let stmt =
CreateTableBuilder::new(ObjectName::from(vec![Ident::new("test")]))
+ .columns(vec![column("id")])
+ .hive_distribution(HiveDistributionStyle::SKEWED {
+ columns: vec![column("id")],
+ on: vec![column("id")],
+ stored_as_directories: true,
+ })
+ .build();
+
+ assert_eq!(
+ stmt.to_string(),
+ "CREATE TABLE test (id STRING) SKEWED BY (id STRING) ON (id STRING)
STORED AS DIRECTORIES"
+ );
Review Comment:
That separation is intentional for this issue. #1499 explicitly notes that
`SKEWED BY` cannot currently be parsed and reports the extra `)` in the
existing `CreateTable` display path. `HiveDistributionStyle::SKEWED` is
nevertheless a public AST variant that callers can construct programmatically
(including through `CreateTableBuilder`), so its malformed SQL output is
independently observable.
The AST-construction test exercises that exact display regression without
expanding this small fix into parser support; `parse_hive_distribution` still
has the separate `TODO: Support parsing for SKEWED distribution style`. If
parser support is intended to be a prerequisite for fixing the formatter, I can
revise the scope, but I read #1499 as deliberately limited to stringification.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]