You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code will throw sqlglot.errors.ParseError: Expecting >, even though it was previously working.
importsqlglotsql="""CREATE TABLE IF NOT EXISTS db.table ( a ARRAY< STRUCT< b INT COMMENT 'nested comment', c: MAP<STRING,STRING> > > COMMENT 'complex type')USING DELTA"""sqlglot.parse_one(sql, read="databricks")
This code works until version 23.16.0 and fails starting from version 23.17.0 (and including the latest version, 24.0.0).
Additional notes
In addition to the behavior described above, version 23.17.0 also changed the result of parsing complex types, even when the parsing does not fail:
fromsqlglotimportexp, parse_onesql="""CREATE TABLE db.table ( area STRUCT< base: INT COMMENT 'a nested int', height: INT NOT NULL COMMENT 'another nested int' > NOT NULL COMMENT 'a struct column')USING DELTA"""parsed_sql=parse_one(sql, read="databricks")
exp_schema=parsed_sql.find(exp.Schema, bfs=True)
column_def=exp_schema.find(exp.ColumnDef, bfs=True)
column_type=column_def.find(exp.DataType, bfs=True)
nested_type=column_type.find(exp.ColumnDef, bfs=True)
print([type(x) forxinnested_type.iter_expressions()])
Running the above code, the output with version 23.16.0 is
The following code will throw
sqlglot.errors.ParseError: Expecting >
, even though it was previously working.This code works until version
23.16.0
and fails starting from version23.17.0
(and including the latest version,24.0.0
).Additional notes
In addition to the behavior described above, version
23.17.0
also changed the result of parsing complex types, even when the parsing does not fail:Running the above code, the output with version
23.16.0
isWith version
23.17.0
instead, it isThe text was updated successfully, but these errors were encountered: