cube-js / cube-js/cube

Metabase Query with ABS function throw error with Pivot table

Open
#9,327 2 comments 0 reactions 1 assignee Claimed by @igorlukanin View on GitHub
question
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

Hi!

Based on docs, Cube supports ABS in projections (e.g., SELECT).
But when we use a pivot table in Metabase, it generates a query like this, and then Cube throws an error.

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

Query:
```sql
select
"source"."calendar_retention_by_day" as "calendar_retention_by_day",
"source"."pivot-grouping" as "pivot-grouping",
sum("source"."measure__af_ad_revenue") as "sum_2"
from
(
select
"public"."cohort_analysis"."measure__af_ad_revenue"
as "measure__af_ad_revenue",
"public"."cohort_analysis"."cohort_date" as "cohort_date",
"public"."cohort_analysis"."calendar_retention_by_day"
as "calendar_retention_by_day",
abs(0) as "pivot-grouping"
from "public"."cohort_analysis"
where
(
"public"."cohort_analysis"."cohort_date"
>= cast(cast((now() + interval '-7 day') as date) as timestamp)
)
and (
"public"."cohort_analysis"."cohort_date"
< cast(cast(now() as date) as timestamp)
)
) as "source"
group by "source"."calendar_retention_by_day", "source"."pivot-grouping"
order by "source"."calendar_retention_by_day" asc, "source"."pivot-grouping" asc
```

Can you add abs function support?

cube: v1.2.9 (push_dowh = false)
metabase: v0.53.5

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.