cube-js / cube-js/cube

Default TimeDimensions when Select Dimensions

Open
#5,279 1 comment 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Problem**

I'm wondering if we can given a default timeDimensions when only selecting dimensions in one query. I mean, it look like cube won't offer a timeDimensions automatically if I firstly choose dimensions. However, if I select measures at the beginning, it will automatically give the first timeDimensions which is defined in backend Schema.

Below are two example, we can clearly see timeDimensions differed from each other.

**Firstly choose measures**
```javascript
query {"measures":["AlarmCodeHistory.count"],"dimensions":[],"segments":[],"timeDimensions":[{"dimension":"AlarmCodeHistory.startTime","dateRange":["2022-09-12T00:00:00.000","2022-09-12T23:59:59.999"]}],"filters":[],"order":[{"id":"AlarmCodeHistory.count","desc":false}],"timezone":"Asia/Taipei"}
```
![image](https://user-images.githubusercontent.com/68407336/189794441-ed2e56dd-4977-4ef5-943c-692106fbc966.png)

**Firstly choose dimensions**
```javascript
query {"measures":[],"dimensions":["AlarmCodeHistory.code"],"segments":[],"timeDimensions":[],"filters":[],"order":[{"id":"AlarmCodeHistory.code","desc":false}],"timezone":"Asia/Taipei"}
```
![image](https://user-images.githubusercontent.com/68407336/189794494-39e5ba74-e769-4186-a459-d1108cf48e66.png)

My concern is if we don't give a timeDimension automatically, the query might take much time.

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.