Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

original_sql pre aggregation not working with ClickHouse driver when it's a Replicated db #9074

Open
or3330 opened this issue Jan 7, 2025 · 1 comment
Labels
driver:clickhouse Issues related to the ClickHouse driver enhancement New feature proposal help wanted Community contributions are welcome.

Comments

@or3330
Copy link

or3330 commented Jan 7, 2025

Describe the bug
Using original_sql pre aggregation on ClickHouse driver doesn't work, due to CREATE AS SELECT operation not supported with Replicated databases.

Expected behavior
Using original_sql pre aggregation type on clickhouse driver should work on any database type, including Replicated one.

Screenshots
image

Minimally reproducible Cube Schema

- name: users_auto_complete_props
    sql: >
      select property_name, property_value, any(tenantId) as tenantId, max(date) as date from
      (SELECT tenantId, 
      toDate(eventTime / 1000) date,
      arrayJoin(JSONExtractKeys(ifNull(props, ''))) AS property_name,
      JSONExtractString(props, property_name) AS property_value
      From coho_db."users_replacing" where 
      tenantId = '{{ COMPILE_CONTEXT.securityContext.tenantId | safe }}' and 
      date > DATEADD(DAY,-2,today()) 
      AND date < today() and props is not null and property_value is not null)
      group by property_name, property_value
    
    dimensions:
      - name: property_name
        type: string
        sql: property_name

      - name: date
        type: time
        sql: date

      - name: property_value
        type: string
        sql: property_value 

      - name: tenant_id
        type: string
        sql: tenantId
        public: false

    pre_aggregations:
      - name: live
        type: rollup_lambda
        union_with_source_data: true
        rollups:
          - CUBE.batch

      - name: batch
        type: original_sql
        time_dimension: CUBE.date
        partition_granularity: month
        refresh_key:
          every: 1 day
        indexes:
          - name: main_index
            columns:
              - tenant_id
              - property_name

Version:
0.35.54

@igorlukanin igorlukanin added enhancement New feature proposal driver:clickhouse Issues related to the ClickHouse driver help wanted Community contributions are welcome. labels Jan 8, 2025
Copy link

github-actions bot commented Jan 8, 2025

If you are interested in working on this issue, please go ahead and provide PR for that.
We'd be happy to review it and merge it.
If this is the first time you are contributing a Pull Request to Cube, please check our contribution guidelines.
You can also post any questions while contributing in the #contributors channel in the Cube Slack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
driver:clickhouse Issues related to the ClickHouse driver enhancement New feature proposal help wanted Community contributions are welcome.
Projects
None yet
Development

No branches or pull requests

2 participants