Skip to content

pre-aggregation tables in bigquery are being dropped immediately #10038

@VictorAtTransmit

Description

@VictorAtTransmit

Problem

I'm trying to run a simple test with a rollup pre aggregation.
I'm running the latest cube.js image in a docker container on my local machine, and configured it (using a service account) with a remote BigQuery dataset.
testing it using the playground seems to work - I can query data and even see the "Query was accelerated with pre-aggregation".

however, when looking at the dev-pre-aggregations dataset, I can notice sporadically aggregated tables being created but then they are being dropped immediately.
looking at the BQ jobs, I can clearly see the table creation, followed by a select and immediate drop - all within a 2-3 seconds.

Image

relevant cubejs env vars:

CUBEJS_DB_BQ_PROJECT_ID=...
CUBEJS_DB_BQ_CREDENTIALS=...
CUBEJS_DB_TYPE=bigquery
CUBEJS_DEV_MODE=true
CUBEJS_SCHEMA_PATH=model
CUBEJS_DB_BQ_LOCATION=europe-west3
CUBEJS_LOG_LEVEL=trace
DEBUG_LOG=true

Related Cube.js schema

cubes:
  - name: people
    sql: |
      SELECT * 
      FROM victor_test_dataset.people2
      WHERE {FILTER_PARAMS.people.age.filter('age')}
    data_source: default

    joins: []

    dimensions:
      - name: age
        sql: age
        type: number

      - name: firstname
        sql: firstname
        type: string

      - name: lastname
        sql: lastname
        type: string

      - name: region
        sql: region
        type: string
    
      - name: timestamp
        sql: timestamp
        type: time

    measures:
      - name: count
        type: count

      - name: min_age
        sql: age
        type: min

      - name: max_age
        sql: age
        type: max        

    pre_aggregations:
      - name: age_region_hourly
        type: rollup
        measures:
          - count
          - min_age
          - max_age
        dimensions:
          - age
          - region
          
        external: true
        scheduledRefresh: true
        time_dimension: timestamp
        granularity: hour
        refresh_key:
          every: 1 minute

Related Cube.js generated SQL

SELECT
  `people__region` `people__region`,
  sum(`people__count`) `people__count`,
  max(`people__max_age`) `people__max_age`,
  min(`people__min_age`) `people__min_age`
FROM
  dev_pre_aggregations.people_age_region_hourly AS `people__age_region_hourly`
WHERE
  (
    (`people__age` > ?)
    AND (`people__age` < ?)
  )
GROUP BY
  1
ORDER BY
  2 DESC
LIMIT
  10000

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionThe issue is a question. Please use Stack Overflow for questions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions