xnuinside/simple-ddl-parser

Parser fail in Bigquery partition with RANGE_BUCKET and GENERATE_ARRAY

lmarqueto opened this issue · 3 comments

Describe the bug
In the Bigquery if use RANGE_BUCKET with GENERATE_ARRAY in partition the parser fail

To Reproduce
This fail

CREATE TABLE data.test(
    field_a INT OPTIONS(description='some description')
)
PARTITION BY RANGE_BUCKET(field_a, GENERATE_ARRAY(10, 1000, 1));

This work

CREATE TABLE data.test(
   field_a INT OPTIONS(description='some description')
 )
 PARTITION BY RANGE_BUCKET(field_a, [1,2,3]]) ;

Expected behavior
Parser work in both cases

I think problem in that in partition by does not supported yet functions, only columns lists, I will add support for that @lmarqueto and again thanks for opening the issue!

I did some tests and with only one functions it's work fine, eg:

PARTITION BY DATE_TRUNC(field, MONTH)
PARTITION BY DATE(field)
PARTITION BY RANGE_BUCKET(field, [1,2,3]])

But if put a function inside a another function, the parser fail

Finally released support in version 1.3.0. Tests: https://github.com/xnuinside/simple-ddl-parser/blob/main/tests/dialects/test_bigquery.py#L881
Sorry for ignoring this issue too long
If will be needed anything else - feel free to open new issue