-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snowflake nested fields are incorrectly translated using JSON_EXTRACT
#3713
Comments
Hey @Leonti, thanks for reporting this. Right now, SQLGlot generates mostly JSONPath functions when parsing semi-structured accesses (e.g. However, I think the |
Quick follow up to gain more context, could you provide an example of how your data is structured in Snowflake and in what way would they be transformed to Trino's |
Hi @VaggelisD!
because it's a
Since it's an Iceberg table it can also be queried directly from Athena/Trino. In Trino Iceberg/Parquet |
Thanks for the detailed explanation! Did some research over the last days and came to the conclusion that there's ambiguity in transpiling Snowflake's Since SQLGlot cannot analyze the data to infer what's stored under |
Before you file an issue
parse_one(sql, read="spark")
ast.sql(dialect="duckdb")
Fully reproducible code snippet
Output:
Expected output:
payload:testField
is how nested fields of VARIANT type are accessed in Snowflake, they should be translated intopayload.testField
for Trino, since they would be orrow
type in Trino and not JSON.Official Documentation
Querying VARIANT nested fields in Snowflake
Trino nested field query example
The text was updated successfully, but these errors were encountered: