Skip to content

Fix Hive SKEWED BY display - #2395

Open
wenxiaojie1 wants to merge 2 commits into
apache:mainfrom
wenxiaojie1:fix-hive-skewed-by-display
Open

Fix Hive SKEWED BY display#2395
wenxiaojie1 wants to merge 2 commits into
apache:mainfrom
wenxiaojie1:fix-hive-skewed-by-display

Conversation

@wenxiaojie1

Copy link
Copy Markdown

Fixes #1499.

This removes the extra closing parenthesis when formatting Hive SKEWED BY clauses and adds a display test for the constructed AST.

Checked locally:

  • cargo fmt --check
  • cargo test display_create_table_with_skewed_by
  • git diff --check

Comment thread tests/sqlparser_hive.rs Outdated
Comment on lines +231 to +249
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"
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wenxiaojie1 wenxiaojie1 Aug 7, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I tried the verified_stmt form, but the current Hive parser rejects this syntax with Expected: end of statement, found: SKEWED. Issue #1499 explicitly notes that SKEWED BY cannot currently be parsed. I kept the explicit AST construction so the test remains scoped to the reported display bug rather than adding parser support in this PR. The focused test still passes.

Comment thread tests/sqlparser_hive.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

typo in Hive SKEWED BY stringification

2 participants