-
Notifications
You must be signed in to change notification settings - Fork 769
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
Error Result Sql After Optimize #2131
Comments
@245Bluesky can you be more specific and explain why it's not correct? |
After Run The Result Sql : With Trino With Awsathena: |
Thanks, please add this additional detail next time. |
👍 ok, thanks. Solved so quickly! |
Hi, tobymao, May I ask a question? How to judge a expression in Select with ‘CASE WHEN’ is Nested or Parallel by using sqlglot? for example: 2、Parallel My code like: |
Sql Fragment:
((CAST(random_id AS BIGINT) % 20 = 0) = TRUE)
Optimize with rules:
pushdown_predicates
simplify
Result:
CAST(random_id AS BIGINT) % 20 = 0 = TRUE
ps: The Result Sql is a wrong sql.
A Test Example:
sql = """
SELECT DATE_TRUNC('day', CAST("dt" AS TIMESTAMP)) AS "dt1",
APPROX_DISTINCT(CASE
WHEN "event" = 'Start' THEN "distinct_id"
END, 0.0040625) + 6 AS "metric#q3ll_g"
FROM table_1
WHERE "dt" < '2023-08-30'
AND "dt" >= '2023-08-29'
AND ((CAST("random_id" AS BIGINT) % 20 = 0) = TRUE)
GROUP BY DATE_TRUNC('day', CAST("dt" AS TIMESTAMP))
ORDER BY "metric#q3ll_g" DESC
LIMIT 10
"""
The text was updated successfully, but these errors were encountered: