Skip to content
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

Metabase week time dimension error #8157

Open
itestyoy opened this issue Apr 16, 2024 · 3 comments
Open

Metabase week time dimension error #8157

itestyoy opened this issue Apr 16, 2024 · 3 comments
Labels
question The issue is a question. Please use Stack Overflow for questions.

Comments

@itestyoy
Copy link

When we use week as granularity in Metabase, Metabase create query

SELECT (CAST(DATE_TRUNC('week', ("public"."analytics_analysis_view"."date" + INTERVAL '1 day')) AS timestamp) + INTERVAL '-1 day') AS "date", SUM("public"."analytics_analysis_view"."sessions_start_count") AS "sum"
FROM "public"."analytics_analysis_view"
GROUP BY (CAST(DATE_TRUNC('week', ("public"."analytics_analysis_view"."date" + INTERVAL '1 day')) AS timestamp) + INTERVAL '-1 day')
ORDER BY (CAST(DATE_TRUNC('week', ("public"."analytics_analysis_view"."date" + INTERVAL '1 day')) AS timestamp) + INTERVAL '-1 day') ASC
image

and then cube throw an error

Error during rewrite: Can't detect Cube query and it may be not supported yet. Please check logs for additional information.

@paveltiunov
Copy link
Member

@itestyoy Could you please try to run this query with CUBESQL_SQL_PUSH_DOWN=true enabled on the latest version? Also, you can update metabase settings to use Monday week instead of Sunday.

@paveltiunov paveltiunov added the question The issue is a question. Please use Stack Overflow for questions. label Apr 17, 2024
@igorlukanin
Copy link
Member

@itestyoy Did Pavel's advice help?

@itestyoy
Copy link
Author

@igorlukanin Yes, we started using Monday week instead of Sunday. Thanks.

With env CUBESQL_SQL_PUSH_DOWN=true we got error:

Arrow error: Compute error: Error: Parameter types must be provided for null values via the 'types' field in query options

May be it related, may be no, but this query doesn't work

Can't detect Cube query and it may not be supported yet. Please check logs for additional information.

SELECT CAST("public"."analytics_view"."user_first_touch" AS date) AS "user_first_touch" 
FROM "public"."analytics_view" 
WHERE CAST("public"."analytics_view"."user_first_touch" AS date) = date '2024-03-26' 
GROUP BY CAST("public"."analytics_view"."user_first_touch" AS date) 

this works correctly:

SELECT CAST("public"."analytics_view"."user_first_touch" AS date) AS "user_first_touch" 
FROM "public"."analytics_view" 
WHERE "public"."analytics_view"."user_first_touch" = date '2024-03-26' 
GROUP BY CAST("public"."analytics_view"."user_first_touch" AS date)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question The issue is a question. Please use Stack Overflow for questions.
Projects
None yet
Development

No branches or pull requests

3 participants