Skip to content

Commit 0d6492f

Browse files
authored
chore(ci): Set up CI tesseract drivers testing (#9696)
1 parent 12458db commit 0d6492f

File tree

35 files changed

+454
-327
lines changed

35 files changed

+454
-327
lines changed

.github/workflows/drivers-tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ on:
6868
- 'true'
6969
- 'false'
7070

71-
env:
72-
USE_TESSERACT_SQL_PLANNER: false
73-
7471
jobs:
7572
latest-tag-sha:
7673
runs-on: ubuntu-24.04
@@ -268,6 +265,12 @@ jobs:
268265
- snowflake-export-bucket-azure-via-storage-integration
269266
- snowflake-export-bucket-gcs
270267
- snowflake-export-bucket-gcs-prefix
268+
use_tesseract_sql_planner: [ false ]
269+
include:
270+
- database: postgres
271+
use_tesseract_sql_planner: true
272+
- database: bigquery-export-bucket-gcs
273+
use_tesseract_sql_planner: true
271274
fail-fast: false
272275

273276
steps:
@@ -334,7 +337,7 @@ jobs:
334337
(contains(env.CLOUD_DATABASES, matrix.database) && env.DRIVERS_TESTS_ATHENA_CUBEJS_AWS_KEY != '') ||
335338
(!contains(env.CLOUD_DATABASES, matrix.database))
336339
env:
337-
DRIVERS_TESTS_CUBEJS_TESSERACT_SQL_PLANNER: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.use_tesseract_sql_planner || env.USE_TESSERACT_SQL_PLANNER }}
340+
DRIVERS_TESTS_CUBEJS_TESSERACT_SQL_PLANNER: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.use_tesseract_sql_planner) || matrix.use_tesseract_sql_planner }}
338341

339342
# Athena
340343
DRIVERS_TESTS_ATHENA_CUBEJS_AWS_KEY: ${{ secrets.DRIVERS_TESTS_ATHENA_CUBEJS_AWS_KEY }}

.github/workflows/push.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,11 @@ jobs:
416416
'clickhouse', 'druid', 'elasticsearch', 'mssql', 'mysql', 'postgres', 'prestodb',
417417
'mysql-aurora-serverless', 'crate', 'mongobi', 'firebolt', 'dremio', 'vertica'
418418
]
419+
use_tesseract_sql_planner: [ false ]
420+
include:
421+
- db: postgres
422+
node-version: 22.x
423+
use_tesseract_sql_planner: true
419424
fail-fast: false
420425

421426
steps:
@@ -481,6 +486,8 @@ jobs:
481486
(contains(env.CLOUD_DATABASES, matrix.db) && env.DRIVERS_TESTS_ATHENA_CUBEJS_AWS_KEY != '') ||
482487
(!contains(env.CLOUD_DATABASES, matrix.db))
483488
env:
489+
CUBEJS_TESSERACT_SQL_PLANNER: ${{ matrix.use_tesseract_sql_planner }}
490+
484491
# Firebolt Integration
485492
DRIVERS_TESTS_FIREBOLT_CUBEJS_FIREBOLT_ENGINE_NAME: ${{ secrets.DRIVERS_TESTS_FIREBOLT_CUBEJS_FIREBOLT_ENGINE_NAME }}
486493
DRIVERS_TESTS_FIREBOLT_CUBEJS_DB_NAME: ${{ secrets.DRIVERS_TESTS_FIREBOLT_CUBEJS_DB_NAME }}
@@ -507,13 +514,13 @@ jobs:
507514
./.github/actions/codecov-fix.sh
508515
- name: Combine all fixed LCOV files
509516
run: |
510-
echo "" > ./combined-integration-${{ matrix.db }}.lcov
517+
echo "" > ./combined-integration-${{ matrix.db }}-${{ matrix.use_tesseract_sql_planner }}.lcov
511518
find ./packages -type f -name lcov.fixed.info -exec cat {} + >> ./combined-integration-${{ matrix.db }}.lcov || true
512519
- name: Upload coverage artifact
513520
uses: actions/upload-artifact@v4
514521
with:
515-
name: coverage-integration-${{ matrix.db }}
516-
path: ./combined-integration-${{ matrix.db }}.lcov
522+
name: coverage-integration-${{ matrix.db }}-${{ matrix.use_tesseract_sql_planner }}
523+
path: ./combined-integration-${{ matrix.db }}-${{ matrix.use_tesseract_sql_planner }}.lcov
517524

518525
integration-smoke:
519526
needs: [latest-tag-sha, build-cubestore, build-native-linux]

packages/cubejs-schema-compiler/test/integration/postgres/multiple-join-paths.test.ts

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { getEnv } from '@cubejs-backend/shared';
12
import { PostgresQuery } from '../../../src/adapter/PostgresQuery';
23
import { prepareJsCompiler } from '../../unit/PrepareCompiler';
34
import { DataSchemaCompiler } from '../../../src/compiler/DataSchemaCompiler';
@@ -612,33 +613,45 @@ describe('Multiple join paths', () => {
612613
},
613614
];
614615
for (const { preAggregationId, addTimeRange, expectedData } of preAggregationTests) {
615-
// eslint-disable-next-line no-loop-func
616-
it(`pre-aggregation ${preAggregationId} should match its own references`, async () => {
617-
// Always not using range, because reference query would have no range to start from
618-
// but should match pre-aggregation anyway
619-
const query = makeReferenceQueryFor(preAggregationId);
620-
621-
const preAggregationsDescription: any = query.preAggregations?.preAggregationsDescription();
622-
const preAggregationFromQuery = preAggregationsDescription.find(p => p.preAggregationId === preAggregationId);
623-
if (preAggregationFromQuery === undefined) {
624-
throw expect(preAggregationFromQuery).toBeDefined();
625-
}
626-
});
627-
628-
// eslint-disable-next-line no-loop-func
629-
it(`pre-aggregation ${preAggregationId} reference query should be executable`, async () => {
630-
// Adding date range for rolling window measure
631-
const query = makeReferenceQueryFor(preAggregationId, addTimeRange);
632-
633-
const preAggregationsDescription: any = query.preAggregations?.preAggregationsDescription();
634-
const preAggregationFromQuery = preAggregationsDescription.find(p => p.preAggregationId === preAggregationId);
635-
if (preAggregationFromQuery === undefined) {
636-
throw expect(preAggregationFromQuery).toBeDefined();
637-
}
616+
if (!getEnv('nativeSqlPlanner')) {
617+
// eslint-disable-next-line no-loop-func
618+
it(`pre-aggregation ${preAggregationId} should match its own references`, async () => {
619+
// Always not using range, because reference query would have no range to start from
620+
// but should match pre-aggregation anyway
621+
const query = makeReferenceQueryFor(preAggregationId);
622+
623+
const preAggregationsDescription: any = query.preAggregations?.preAggregationsDescription();
624+
const preAggregationFromQuery = preAggregationsDescription.find(p => p.preAggregationId === preAggregationId);
625+
if (preAggregationFromQuery === undefined) {
626+
throw expect(preAggregationFromQuery).toBeDefined();
627+
}
628+
});
629+
} else {
630+
it.skip(`FIXME(tesseract): pre-aggregation ${preAggregationId} should match its own references`, async () => {
631+
// This should be implemented in Tesseract.
632+
});
633+
}
638634

639-
const res = await testWithPreAggregation(preAggregationFromQuery, query);
640-
expect(res).toEqual(expectedData);
641-
});
635+
if (!getEnv('nativeSqlPlanner')) {
636+
// eslint-disable-next-line no-loop-func
637+
it(`pre-aggregation ${preAggregationId} reference query should be executable`, async () => {
638+
// Adding date range for rolling window measure
639+
const query = makeReferenceQueryFor(preAggregationId, addTimeRange);
640+
641+
const preAggregationsDescription: any = query.preAggregations?.preAggregationsDescription();
642+
const preAggregationFromQuery = preAggregationsDescription.find(p => p.preAggregationId === preAggregationId);
643+
if (preAggregationFromQuery === undefined) {
644+
throw expect(preAggregationFromQuery).toBeDefined();
645+
}
646+
647+
const res = await testWithPreAggregation(preAggregationFromQuery, query);
648+
expect(res).toEqual(expectedData);
649+
});
650+
} else {
651+
it.skip(`FIXME(tesseract): pre-aggregation ${preAggregationId} reference query should be executable`, async () => {
652+
// This should be implemented in Tesseract.
653+
});
654+
}
642655
}
643656
});
644657

packages/cubejs-schema-compiler/test/integration/postgres/pre-aggregations.test.ts

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,10 @@ describe('PreAggregations', () => {
570570
});
571571

572572
if (getEnv('nativeSqlPlanner')) {
573-
it('simple pre-aggregation proxy time dimension', () => compiler.compile().then(() => {
573+
it.skip('FIXME(tesseract): simple pre-aggregation proxy time dimension', () => {
574+
// Should work after fallback for pre-aggregations is fully turned off
575+
});
576+
/* it('simple pre-aggregation proxy time dimension', () => compiler.compile().then(() => {
574577
const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
575578
measures: [
576579
'visitors.count'
@@ -616,7 +619,7 @@ describe('PreAggregations', () => {
616619
]
617620
);
618621
});
619-
}));
622+
})); */
620623
}
621624

622625
it('simple pre-aggregation (allowNonStrictDateRangeMatch: true)', async () => {
@@ -1078,44 +1081,51 @@ describe('PreAggregations', () => {
10781081
});
10791082
});
10801083

1081-
it('multiplied measure no match', async () => {
1082-
await compiler.compile();
1084+
if (!getEnv('nativeSqlPlanner')) {
1085+
it('multiplied measure no match', async () => {
1086+
await compiler.compile();
10831087

1084-
const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
1085-
measures: [
1086-
'visitors.count'
1087-
],
1088-
dimensions: ['visitor_checkins.source'],
1089-
order: [{
1090-
id: 'visitor_checkins.source'
1091-
}],
1092-
timezone: 'America/Los_Angeles',
1093-
preAggregationsSchema: ''
1094-
});
1088+
const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
1089+
measures: [
1090+
'visitors.count'
1091+
],
1092+
dimensions: ['visitor_checkins.source'],
1093+
order: [{
1094+
id: 'visitor_checkins.source'
1095+
}],
1096+
timezone: 'America/Los_Angeles',
1097+
preAggregationsSchema: ''
1098+
});
10951099

1096-
const queryAndParams = query.buildSqlAndParams();
1097-
console.log(queryAndParams);
1098-
expect(queryAndParams[0]).toMatch(/count\(distinct/ig);
1099-
expect(queryAndParams[0]).toMatch(/visitors_default/ig);
1100-
const preAggregationsDescription = query.preAggregations?.preAggregationsDescription();
1101-
console.log(preAggregationsDescription);
1102-
expect((<any>preAggregationsDescription).filter(p => p.type === 'rollup').length).toBe(0);
1100+
const queryAndParams = query.buildSqlAndParams();
1101+
console.log(queryAndParams);
1102+
expect(queryAndParams[0]).toMatch(/count\(distinct/ig);
1103+
expect(queryAndParams[0]).toMatch(/visitors_default/ig);
1104+
const preAggregationsDescription = query.preAggregations?.preAggregationsDescription();
1105+
console.log(preAggregationsDescription);
1106+
expect((<any>preAggregationsDescription).filter(p => p.type === 'rollup').length).toBe(0);
11031107

1104-
return dbRunner.evaluateQueryWithPreAggregations(query).then(res => {
1105-
expect(res).toEqual(
1106-
[
1107-
{
1108-
vc__source: 'google',
1109-
visitors__count: '1'
1110-
},
1111-
{
1112-
vc__source: null,
1113-
visitors__count: '6'
1114-
},
1115-
]
1116-
);
1108+
return dbRunner.evaluateQueryWithPreAggregations(query).then(res => {
1109+
expect(res).toEqual(
1110+
[
1111+
{
1112+
vc__source: 'google',
1113+
visitors__count: '1'
1114+
},
1115+
{
1116+
vc__source: null,
1117+
visitors__count: '6'
1118+
},
1119+
]
1120+
);
1121+
});
11171122
});
1118-
});
1123+
} else {
1124+
it.skip('FIXME(tesseract): multiplied measure no match', async () => {
1125+
// This should be fixed in Tesseract.
1126+
1127+
});
1128+
}
11191129

11201130
it('multiplied measure match', async () => {
11211131
await compiler.compile();

0 commit comments

Comments
 (0)