Skip to content

Fix Hive SKEWED BY display - #2395

Open
wenxiaojie1 wants to merge 1 commit into
apache:mainfrom
wenxiaojie1:fix-hive-skewed-by-display
Open

Fix Hive SKEWED BY display#2395
wenxiaojie1 wants to merge 1 commit 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
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.

Comment thread tests/sqlparser_hive.rs
}

#[test]
fn display_create_table_with_skewed_by() {

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.

Suggested change
fn display_create_table_with_skewed_by() {
fn create_table_with_skewed_by() {

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