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

fix(schema-compiler) Resolve rollup join pre-aggregation param allocator issue #8279

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

pauldheinrichs
Copy link

@pauldheinrichs pauldheinrichs commented May 19, 2024

Check List

  • Tests has been run in packages where changes made if available
  • Linter has been run for changed code
  • Tests for the changes have been added if not covered yet
  • Docs have been added / updated if required

Issue Reference this PR resolves
Resolves: #8268

Description of Changes Made (if issue reference is not provided)

Resolves:

  • Pre aggregation rollup_join query invalidations for cross datasource utilizing different parameter symbols.
  • IE: Oracle, Postgres, Druid, MSSQL

Summary:

So this is a fun one, here's the situation. At first i thought this was entirely community druid problem but tracked it down to an underlying issue with rollup_joins.

If we rollup_join two datasources that contain a different paramAllocator symbol (IE: $1 and ?) the default paramAllocator would inject the wrong parameters into the pre-aggregation sql code invalidating the cache on the API node and causing weird behaviour. This would only present itself when actually querying the data and thus causing issues.


Smoke tested:

  • Refresh schedules refreshing pre-aggregations
  • Generated pre-aggregations

Thanks ❤️

@pauldheinrichs pauldheinrichs requested a review from a team as a code owner May 19, 2024 03:26
Copy link

vercel bot commented May 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

8 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-angular-dashboard ⬜️ Ignored (Inspect) Visit Preview May 23, 2024 0:33am
examples-react-d3 ⬜️ Ignored (Inspect) Visit Preview May 23, 2024 0:33am
examples-react-dashboard ⬜️ Ignored (Inspect) Visit Preview May 23, 2024 0:33am
examples-react-data-table ⬜️ Ignored (Inspect) Visit Preview May 23, 2024 0:33am
examples-react-highcharts ⬜️ Ignored (Inspect) Visit Preview May 23, 2024 0:33am
examples-react-material-ui ⬜️ Ignored (Inspect) Visit Preview May 23, 2024 0:33am
examples-react-pivot-table ⬜️ Ignored (Inspect) Visit Preview May 23, 2024 0:33am
examples-vue-query-builder ⬜️ Ignored (Inspect) Visit Preview May 23, 2024 0:33am

@github-actions github-actions bot added the pr:community Contribution from Cube.js community members. label May 19, 2024
@pauldheinrichs pauldheinrichs requested a review from a team as a code owner May 21, 2024 14:33
// By default, we'll use BaseQuery, but it's important to note that different databases (Oracle, PostgreSQL, MySQL, Druid, etc.)
// have unique parameter allocator symbols. Using the wrong allocator can break the query, especially when rollup joins involve
// different cubes that require different allocators.
return this.options.queryFactory.createQuery(cube, this.compilers, { ...this.subQueryOptions(options), paramAllocator: undefined });
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unset the paramAllocator set by this.subQueryOptions to allow QueryClasses to assume their default paramAllocator class

@pauldheinrichs pauldheinrichs changed the title Resolve rollup join pre-aggregation param allocator issue fix(schema-compiler) Resolve rollup join pre-aggregation param allocator issue May 21, 2024
@paveltiunov
Copy link
Member

@pauldheinrichs Thanks for contributing! Could you please set the allocator to undefined in the branch without queryFactory as well? It should be consistent.

@paveltiunov paveltiunov self-assigned this May 23, 2024
@pauldheinrichs
Copy link
Author

pauldheinrichs commented May 23, 2024

@pauldheinrichs Thanks for contributing! Could you please set the allocator to undefined in the branch without queryFactory as well? It should be consistent.

@paveltiunov For sure, i've updated the newSubQuery method to behave the same!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:community Contribution from Cube.js community members.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rollup joins across different data sources with different param allocators causing invalidations
2 participants