cube-js / cube-js/cube

`chartPivot` and `tablePivot` methods of `ResultSet` don't throw error for un-decomposed datasets of `compareDateRange` type queries

Open
#8,050 2 comments 0 reactions 0 assignees View on GitHub
client:core good first issue help wanted
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Describe the bug**
If you run a [`compareDateRange` query](https://cube.dev/blog/comparing-data-over-different-time-periods#a-single-query-for-a-single-chart), you will get a result set that needs to be "decomposed" first using the [`decompose` method](https://cube.dev/docs/reference/frontend/cubejs-client-core#decompose) of the client library. Calling the `rawData` method on it would correctly emit this error:

> Error: Method is not supported for a 'compareDateRangeQuery' query type. Please use decompose

However, calling `tablePivot` and `chartPivot` would not emit any errors—which is quite confusing for someone who doesn't know about `decompose` and quirks of `compareDateRange`.

**Expected behavior**
Calling `tablePivot` and `chartPivot` on `compareDateRange` result set should emit the same error as shown above.

**Version:**
0.35.4

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.