Skip to content

HiveDialect doesn't support create table with PARTITIONED BY and CLUSTERED BY clause #1395

@wugeer

Description

@wugeer

When I used the Hive dialect to parse the following Hive SQL, I encountered the following error.

    CREATE TABLE user_info_bucketed(user_id BIGINT, firstname STRING, lastname STRING)
    COMMENT 'A bucketed copy of user_info'
    PARTITIONED BY(ds STRING)
    CLUSTERED BY(user_id) INTO 256 BUCKETS;

with error

Err(ParserError("Expected: end of statement, found: PARTITIONED at Line: 4, Column: 5"))

Here is the code I tested.

use sqlparser::dialect::HiveDialect;
use sqlparser::parser::Parser;

fn main() {
    let query = r#"
    CREATE TABLE user_info_bucketed(user_id BIGINT, firstname STRING, lastname STRING)
    COMMENT 'A bucketed copy of user_info'
    PARTITIONED BY(ds STRING)
    CLUSTERED BY(user_id) INTO 256 BUCKETS;"#;
    let dialect = HiveDialect {};
    let ast = Parser::parse_sql(&dialect, query);
    println!("ast={:?}", ast);
}

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions