Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/drivers-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ on:
- 'true'
- 'false'

env:
USE_TESSERACT_SQL_PLANNER: false

jobs:
latest-tag-sha:
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -268,6 +265,12 @@ jobs:
- snowflake-export-bucket-azure-via-storage-integration
- snowflake-export-bucket-gcs
- snowflake-export-bucket-gcs-prefix
use_tesseract_sql_planner: [ false ]
include:
- database: postgres
use_tesseract_sql_planner: true
- database: bigquery-export-bucket-gcs
use_tesseract_sql_planner: true
fail-fast: false

steps:
Expand Down Expand Up @@ -334,7 +337,7 @@ jobs:
(contains(env.CLOUD_DATABASES, matrix.database) && env.DRIVERS_TESTS_ATHENA_CUBEJS_AWS_KEY != '') ||
(!contains(env.CLOUD_DATABASES, matrix.database))
env:
DRIVERS_TESTS_CUBEJS_TESSERACT_SQL_PLANNER: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.use_tesseract_sql_planner || env.USE_TESSERACT_SQL_PLANNER }}
DRIVERS_TESTS_CUBEJS_TESSERACT_SQL_PLANNER: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.use_tesseract_sql_planner) || matrix.use_tesseract_sql_planner }}

# Athena
DRIVERS_TESTS_ATHENA_CUBEJS_AWS_KEY: ${{ secrets.DRIVERS_TESTS_ATHENA_CUBEJS_AWS_KEY }}
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@ jobs:
'clickhouse', 'druid', 'elasticsearch', 'mssql', 'mysql', 'postgres', 'prestodb',
'mysql-aurora-serverless', 'crate', 'mongobi', 'firebolt', 'dremio', 'vertica'
]
use_tesseract_sql_planner: [ false ]
include:
- db: postgres
node-version: 22.x
use_tesseract_sql_planner: true
fail-fast: false

steps:
Expand Down Expand Up @@ -481,6 +486,8 @@ jobs:
(contains(env.CLOUD_DATABASES, matrix.db) && env.DRIVERS_TESTS_ATHENA_CUBEJS_AWS_KEY != '') ||
(!contains(env.CLOUD_DATABASES, matrix.db))
env:
CUBEJS_TESSERACT_SQL_PLANNER: ${{ matrix.use_tesseract_sql_planner }}

# Firebolt Integration
DRIVERS_TESTS_FIREBOLT_CUBEJS_FIREBOLT_ENGINE_NAME: ${{ secrets.DRIVERS_TESTS_FIREBOLT_CUBEJS_FIREBOLT_ENGINE_NAME }}
DRIVERS_TESTS_FIREBOLT_CUBEJS_DB_NAME: ${{ secrets.DRIVERS_TESTS_FIREBOLT_CUBEJS_DB_NAME }}
Expand All @@ -507,13 +514,13 @@ jobs:
./.github/actions/codecov-fix.sh
- name: Combine all fixed LCOV files
run: |
echo "" > ./combined-integration-${{ matrix.db }}.lcov
echo "" > ./combined-integration-${{ matrix.db }}-${{ matrix.use_tesseract_sql_planner }}.lcov
find ./packages -type f -name lcov.fixed.info -exec cat {} + >> ./combined-integration-${{ matrix.db }}.lcov || true
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-integration-${{ matrix.db }}
path: ./combined-integration-${{ matrix.db }}.lcov
name: coverage-integration-${{ matrix.db }}-${{ matrix.use_tesseract_sql_planner }}
path: ./combined-integration-${{ matrix.db }}-${{ matrix.use_tesseract_sql_planner }}.lcov

integration-smoke:
needs: [latest-tag-sha, build-cubestore, build-native-linux]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getEnv } from '@cubejs-backend/shared';
import { PostgresQuery } from '../../../src/adapter/PostgresQuery';
import { prepareJsCompiler } from '../../unit/PrepareCompiler';
import { DataSchemaCompiler } from '../../../src/compiler/DataSchemaCompiler';
Expand Down Expand Up @@ -612,33 +613,45 @@ describe('Multiple join paths', () => {
},
];
for (const { preAggregationId, addTimeRange, expectedData } of preAggregationTests) {
// eslint-disable-next-line no-loop-func
it(`pre-aggregation ${preAggregationId} should match its own references`, async () => {
// Always not using range, because reference query would have no range to start from
// but should match pre-aggregation anyway
const query = makeReferenceQueryFor(preAggregationId);

const preAggregationsDescription: any = query.preAggregations?.preAggregationsDescription();
const preAggregationFromQuery = preAggregationsDescription.find(p => p.preAggregationId === preAggregationId);
if (preAggregationFromQuery === undefined) {
throw expect(preAggregationFromQuery).toBeDefined();
}
});

// eslint-disable-next-line no-loop-func
it(`pre-aggregation ${preAggregationId} reference query should be executable`, async () => {
// Adding date range for rolling window measure
const query = makeReferenceQueryFor(preAggregationId, addTimeRange);

const preAggregationsDescription: any = query.preAggregations?.preAggregationsDescription();
const preAggregationFromQuery = preAggregationsDescription.find(p => p.preAggregationId === preAggregationId);
if (preAggregationFromQuery === undefined) {
throw expect(preAggregationFromQuery).toBeDefined();
}
if (!getEnv('nativeSqlPlanner')) {
// eslint-disable-next-line no-loop-func
it(`pre-aggregation ${preAggregationId} should match its own references`, async () => {
// Always not using range, because reference query would have no range to start from
// but should match pre-aggregation anyway
const query = makeReferenceQueryFor(preAggregationId);

const preAggregationsDescription: any = query.preAggregations?.preAggregationsDescription();
const preAggregationFromQuery = preAggregationsDescription.find(p => p.preAggregationId === preAggregationId);
if (preAggregationFromQuery === undefined) {
throw expect(preAggregationFromQuery).toBeDefined();
}
});
} else {
it.skip('FIXME(tesseract): This should be implemented in Tesseract.', async () => {
// Skipping because it not works in Tesseract yet
});
}

const res = await testWithPreAggregation(preAggregationFromQuery, query);
expect(res).toEqual(expectedData);
});
if (!getEnv('nativeSqlPlanner')) {
// eslint-disable-next-line no-loop-func
it(`pre-aggregation ${preAggregationId} reference query should be executable`, async () => {
// Adding date range for rolling window measure
const query = makeReferenceQueryFor(preAggregationId, addTimeRange);

const preAggregationsDescription: any = query.preAggregations?.preAggregationsDescription();
const preAggregationFromQuery = preAggregationsDescription.find(p => p.preAggregationId === preAggregationId);
if (preAggregationFromQuery === undefined) {
throw expect(preAggregationFromQuery).toBeDefined();
}

const res = await testWithPreAggregation(preAggregationFromQuery, query);
expect(res).toEqual(expectedData);
});
} else {
it.skip('FIXME(tesseract): This should be implemented in Tesseract.', async () => {
// Skipping because it not works in Tesseract yet
});
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,10 @@ describe('PreAggregations', () => {
});

if (getEnv('nativeSqlPlanner')) {
it('simple pre-aggregation proxy time dimension', () => compiler.compile().then(() => {
it.skip('FIXME(tesseract): Should work after fallback for pre-aggregations is fully turned off.', () => {
// Skipping because it not works in Tesseract yet
});
/* it('simple pre-aggregation proxy time dimension', () => compiler.compile().then(() => {
const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
measures: [
'visitors.count'
Expand Down Expand Up @@ -616,7 +619,7 @@ describe('PreAggregations', () => {
]
);
});
}));
})); */
}

it('simple pre-aggregation (allowNonStrictDateRangeMatch: true)', async () => {
Expand Down Expand Up @@ -1078,44 +1081,50 @@ describe('PreAggregations', () => {
});
});

it('multiplied measure no match', async () => {
await compiler.compile();
if (!getEnv('nativeSqlPlanner')) {
it('multiplied measure no match', async () => {
await compiler.compile();

const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
measures: [
'visitors.count'
],
dimensions: ['visitor_checkins.source'],
order: [{
id: 'visitor_checkins.source'
}],
timezone: 'America/Los_Angeles',
preAggregationsSchema: ''
});
const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
measures: [
'visitors.count'
],
dimensions: ['visitor_checkins.source'],
order: [{
id: 'visitor_checkins.source'
}],
timezone: 'America/Los_Angeles',
preAggregationsSchema: ''
});

const queryAndParams = query.buildSqlAndParams();
console.log(queryAndParams);
expect(queryAndParams[0]).toMatch(/count\(distinct/ig);
expect(queryAndParams[0]).toMatch(/visitors_default/ig);
const preAggregationsDescription = query.preAggregations?.preAggregationsDescription();
console.log(preAggregationsDescription);
expect((<any>preAggregationsDescription).filter(p => p.type === 'rollup').length).toBe(0);
const queryAndParams = query.buildSqlAndParams();
console.log(queryAndParams);
expect(queryAndParams[0]).toMatch(/count\(distinct/ig);
expect(queryAndParams[0]).toMatch(/visitors_default/ig);
const preAggregationsDescription = query.preAggregations?.preAggregationsDescription();
console.log(preAggregationsDescription);
expect((<any>preAggregationsDescription).filter(p => p.type === 'rollup').length).toBe(0);

return dbRunner.evaluateQueryWithPreAggregations(query).then(res => {
expect(res).toEqual(
[
{
vc__source: 'google',
visitors__count: '1'
},
{
vc__source: null,
visitors__count: '6'
},
]
);
return dbRunner.evaluateQueryWithPreAggregations(query).then(res => {
expect(res).toEqual(
[
{
vc__source: 'google',
visitors__count: '1'
},
{
vc__source: null,
visitors__count: '6'
},
]
);
});
});
});
} else {
it.skip('FIXME(tesseract): This should be fixed in Tesseract.', async () => {
// Skipping because it not works in Tesseract yet
});
}

it('multiplied measure match', async () => {
await compiler.compile();
Expand Down
Loading
Loading