cube-js / cube-js/cube

Cubestore Does Not Support `timestamp(6)` in Pre-Aggregations

Open
#9,843 1 comment 0 reactions 0 assignees View on GitHub
cube store
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Describe the bug**
Similar to #5536, building pre-aggregations using trino as a data source fails whenever a field of `type: time` are present, with the following error message:

```
Error during create table: CREATE TABLE : Internal: ParserError("Expected ',' or ')' after column definition, found: (")
```

**To Reproduce**
Steps to reproduce the behavior:
1. Create the attached data model.
2. Launch cube.
3. Wait for cube to start building pre-aggregations.
4. See error.

**Expected behavior**
Cubestore successfully builds the pre-aggregation.

**Minimally reproducible Cube Schema**

```yaml
cubes:
- name: orders
sql: |
SELECT 1 as user_id, 2025-01-01T00:00:00.000+00 as created_at
UNION ALL
SELECT 1 as user_id, 2025-01-02T00:00:00.000+00 as created_at
UNION ALL
SELECT 2 as user_id, 2025-01-01T00:00:00.000+00 as created_at

pre_aggregations:
- name: first_order_by_user_id
measures:
- CUBE.first_order
dimensions:
- CUBE.user_id
time_dimension: CUBE.created_at
granularity: day

measures:
- name: first_order
type: min
sql: created_at

dimensions:
- name: user_id
sql: user_id
type: number

- name: created_at
sql: created_at
type: time

```

**Version:**
v1.3.46

**Additional Context**

In this case, cubestore receives `timestamp(6)` instead of `timestamp` when querying for information schemas. The fix should be very similar to #6324, i.e. adding the following to the `GenericTypeToCubeStore` map:

```typescript
timestamp(6): timestamp
```

As a workaround, it is possible to `cast(created_at as timestamp(3))` in the data model.

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.