xnuinside / simple-ddl-parser

Simple DDL Parser to parse SQL (HQL, TSQL, AWS Redshift, BigQuery, Snowflake and other dialects) ddl files to json/python dict with full information about columns: types, defaults, primary keys, etc. & table properties, types, domains, etc.
MIT License
183 stars 41 forks source link

Support for array<type> in hql #192

Open ebernhardson opened 1 year ago

ebernhardson commented 1 year ago

Within HQL the following is a valid create table statement:

CREATE TABLE a.b (
    `c` array<string>
)

But parsing this with DDLParser emits:

simple_ddl_parser.ddl_parser.DDLParserError: Unknown statement at LexToken(RT,'array<string>',1,23)

Poking through the existing tests and closed issues I see a specific form of array<struct<cola:string,colb:string>> is supported, but it doesn't seem like the generic handling of arrays is working. The hive docs aren't particularly clear, but they show that all data types are valid within the <>, and elsewhere on the page gives a specific example using array<string>.

ZbinH2O commented 8 months ago

I have the same problem.How to solve this problem? @xnuinside