forked from cube-js/cube
-
Notifications
You must be signed in to change notification settings - Fork 0
fix(schema-compiler): remove hardcoded AS keyword in subquery aliases for Oracle compatibility #1
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
Open
Tankilevitch
wants to merge
103
commits into
master
Choose a base branch
from
fix/oracle-subquery-as-syntax
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* add convertedToJs flag * pass toCompile to compileCubeFiles() * refactored compileYamlFile() to not call compileJsFile directly * moved yaml transpilation to transpile phase * removed dataSchemaCompiler from YamlCompiler's deps * renaming * simplified code * add PerfTracker * inject perTracker measures in dataschemacompiler * update CubePropContextTranspiler to support string keys * replace original content with js on first phase * update arrow func expression instead of blind copying + correct path collection * fix grammar * more types * Preload Jinja templates to the engine * remove perf logging * simplified compileFile * avoid mutating original repository files * linter fix * filter out files we don't transpile/compile * move PerfTracker to backend-shared * Refactor doCompile() to avoid content mutation * refactor: split first and later compile/transpile stages * improve transpilationNative
…9929) * extracted yaml and jinja transpilation in separate functions * implement yaml transpilation in worker threads * fix to allow use threads and native in parallel * just code polish * small fix * remove speed test as it is flacky * introduce compiledYamlCache
* Prepare transpileYaml in native + schema compiler * fix test fix/sync error message * fix test
* reuse yaml transpilation flow for jinja files * remove perf logging * introduce compiledJinjaCache * add a comment
…porter during transpilation (cube-js#9964)
…dimension filter in Playground (cube-js#9979)
Bumps [axios](https://github.com/axios/axios) from 1.8.4 to 1.12.0. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](axios/axios@v1.8.4...v1.12.0) --- updated-dependencies: - dependency-name: axios dependency-version: 1.12.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
| Stage | Description | Stack Size | Reduction | binary_expr | |-------|-------------|------------|-----------|-------------| | 1 | Original `Result<Expr>` | 11,429 bytes | baseline | - | | 2 | `Result<Box<Expr>>` | 8,206 bytes | -28.2% | - | | 3 | `grouping_set_normalize` opt | 7,990 bytes | -30.1% | 5,054 bytes | | **4** | **binary_expr optimize** | **7,990 bytes** | **-30.1%** | **3,918 bytes** |
Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
…construction (cube-js#10039) * add tests * enable view join tests for tesseract * fix test * temp comment out tests * correct additional hints predecessors comparator OMG! Is it really working?! everything works besides loop detection correct additional hints: everything works besides loop detection * trying to adopt loop test fix actually incorrect tests * linter fix * small fix in error handling * add test case for join maps test * implement join maps * update snapshot * refactor tests * add more tests * return back loop for join resolution * fix typo * join map in tesseract * enable view join tests for tesseract * cargo fmt * uncomment test * remove println! * remove unneeded rootOfJoin * refactor tests * fix linter warning * refactor allJoinHints() * refactor: extract inlined isJoinTreesEqual() * remove unused * add support for transitive joins in tesseract * uncomment transitive joins tests for tesseract * cargo fmt
… for Oracle compatibility Oracle database does not support the AS keyword for table/subquery aliasing, while other databases like PostgreSQL and MySQL do. The existing BaseQuery implementation hardcoded 'as' in subquery alias generation, causing Oracle queries to fail. This change: - Replaces hardcoded 'as' with asSyntaxJoin property in BaseQuery - Oracle returns empty string for asSyntaxJoin (no AS keyword) - PostgreSQL/MySQL return 'AS' (maintains existing behavior) - Adds comprehensive Oracle query test suite validating AS syntax removal - Adds PostgreSQL regression test ensuring AS keyword is still present This fixes queries with rolling windows and multiple subqueries on Oracle, which previously generated invalid SQL like: SELECT ... FROM (...) as q_0 INNER JOIN (...) as q_1 ON ... Now Oracle correctly generates: SELECT ... FROM (...) q_0 INNER JOIN (...) q_1 ON ...
- Fix AS keyword in subquery aliases (Oracle doesn't support it) - Handle time dimensions without granularity to prevent TypeError - Implement Oracle-specific interval arithmetic using ADD_MONTHS and NUMTODSINTERVAL - Add comprehensive test suite for Oracle query generation These changes enable Oracle users to execute queries with: - Time dimension filters without granularity specification - Rolling windows and time-based calculations - Multiple subqueries with proper aliasing All changes maintain backward compatibility with other database adapters.
…lower) (cube-js#10070) Allowing filters to be pushed down with `DATE_PART('year', ?column) = ?year AND DATE_PART('quarter', ?column) = ?quarter` by pushing it as inDateRange. Now, such queries will be accelerated with pre-aggregations. I am re-using code that we have for tablea, but without usage of `Trunc` as wrapper. I've added ability to merge date range with `quarter`.
…ubeScan (cube-js#10068) Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
… Z` for date and timestamp (cube-js#9970) * fix(schema-compiler): use TO_TIMESTAMP_TZ for ISO 8601 with Z; keep index-friendly casts; add Oracle unit test * fix lint * fix * fix(schema-compiler): Update Oracle test to expect both date range parameters * fix * cr comments fixes --------- Co-authored-by: Konstantin Burkalev <KSDaemon@gmail.com>
…week') (cube-js#10071) Allow to merge the week granularity date_part filter into the inDateRange. After that, it's possible to push down a complex filter: WHERE DATE_PART('year', "order_date") = 2019 AND DATE_PART('quarter', "order_date") = 2 AND DATE_PART('month', "order_date") = 4 AND DATE_PART('week', "order_date") = 15 We are using such filters in the MDX API
* fix(tesseract): Fix member name case conversion Prepend "_" even to the first UPPERCASE letter in the name * add tests * fix tests * cargo fmt
…e-js#10081) Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
cube-js#10063) * chore(ci): Increase jest timeout for redshift tests to be able to pass * set CUBEJS_DB_MAX_POOL for Redshift Tests * add delays between pre-aggs build * decrease CUBEJS_DB_MAX_POOL * decrease CUBEJS_DB_MAX_POOL * add delay between create tables queries * more delays for redshift * more timeout adjustments * increase timeouts * comment put heavy tests * skip tests for tesseract
…n Tesseract (cube-js#10078) * fix formatInterval() as MySQL doesn't support milliseconds * more types * add ilike templates for tesseract * add time_series_* templates * update snapshots * add mysql + tesseract tests in CI * skip some tests for tesseract * cast as TIMESTAMP * skip some tests for tesseract * fix templates * skip some tests for tesseract * fix templates * update snapshots * fix skip tests
…be-js#9972) * add cache option to the query * Pass CacheMode from /cubesql to backend * imject CacheMode into more places * update normalizeQuery with cache mode * pass cache mode within graphql * pass new cache mode in sqlApiLoad in API GW * fix types imports * update preAggs to use cache option instead of renewQuery * code polish * comments with types * fix query type * set default cacheMode = 'stale-if-slow' in normalize() * more types and polish * backbone code for 'stale-if-slow' & 'stale-while-revalidate' * make query cache aware of queryBody.cache === 'must-revalidate' * First attempt to implement 'no-cache' scenario * add cache to open api spec and regenerate rust client * pass cache mode to cubeScan * cargo clippy/fmt * Implement background refresh * add cache mode descriptions * remove query cache mode from normalize query * pass cacheMode to getSqlResponseInternal * remove obsolete * add cacheMode as input param in orchestratorApi * open api spec fix * fix cubesql after introducing cacheMode * rename cache → cacheMode * clean up obsolete * pass cache_mode from SqlApiLoadPayload * fix important * move 'no-cache' variant into queryCache.cachedQueryResult() * remove cacheMode from client query body types (it's incorrect) * switch RefreshScheduler to use cacheMode instead of renewQuery * remove obsolete continueWait flag * fix refresh scheduler * add fallback to renewQuery in api gw * fix tests * Docs * Deprecation * refactor api gw: move copy/paste into this.normalizeCacheMode() * fix tests snapshots * return cacheMode into query object * fix tests * some cleanup (removed renewQuery) * update cacheMod in graphql * return back cache as public prop in query * fix * lint fix # Conflicts: # packages/cubejs-api-gateway/package.json * fix subscribe() * remove cache from subscribe * fix CacheMode serialization * refactor: move normalizeQueryCacheMode to normalize --------- Co-authored-by: Igor Lukanin <igor@cube.dev>
…re-aggregations (cube-js#10020) * feat(schema-compiler): Support joins for proxied time dimensions in pre-aggregations * add tests
…cle-subquery-as-syntax
Oracle's custom groupByClause() was incorrectly including time dimensions without granularity in the GROUP BY clause, causing SQL errors when time dimensions were used solely for filtering (no grouping). Changes: - Update OracleQuery.groupByClause() to check selectColumns() before including dimensions in GROUP BY - Time dimensions without granularity return null from selectColumns(), so they are now properly excluded - Add comprehensive tests for both PostgreSQL and Oracle covering: * Time dimensions without granularity (filtering only) * Time dimensions with granularity (grouping and filtering) - Remove unnecessary guard in BaseQuery.dimensionTimeGroupedColumn() as it's no longer needed with the Oracle-specific fix The fix aligns Oracle's behavior with PostgreSQL, which already handles this correctly through its base implementation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Oracle database does not support the AS keyword for table/subquery aliasing, while other databases like PostgreSQL and MySQL do. The existing BaseQuery implementation hardcoded
asin subquery alias generation, causing Oracle queries with multiple subqueries to fail.Changes
'as'withasSyntaxJoinproperty in subquery alias generationINNER JOINclause now usesasSyntaxJoinasSyntaxJoinasSyntaxJoinasSyntaxJoin(no AS keyword)'AS'(maintains existing behavior)Test Coverage
New Tests
Regression Tests
Problem Solved
Before (Invalid Oracle SQL)
After (Valid Oracle SQL)
Testing
All tests pass ✅
Impact
Checklist