Skip to content

Commit 0229aba

Browse files
committed
chore(tesseract): ci for tesseract
1 parent dddd59d commit 0229aba

File tree

3 files changed

+116
-88
lines changed

3 files changed

+116
-88
lines changed

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): This should be implemented in Tesseract.', async () => {
631+
// Skipping because it not works in Tesseract yet
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): This should be implemented in Tesseract.', async () => {
652+
// Skipping because it not works in Tesseract yet
653+
});
654+
}
642655
}
643656
});
644657

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

Lines changed: 45 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): Should work after fallback for pre-aggregations is fully turned off.', () => {
574+
// Skipping because it not works in Tesseract yet
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,50 @@ 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): This should be fixed in Tesseract.', async () => {
1125+
// Skipping because it not works in Tesseract yet
1126+
});
1127+
}
11191128

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

packages/cubejs-schema-compiler/test/integration/postgres/sql-generation.test.ts

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3468,32 +3468,38 @@ SELECT 1 AS revenue, cast('2024-01-01' AS timestamp) as time UNION ALL
34683468
}]
34693469
));
34703470

3471-
it('multi stage revenue_sum_group_by_granularity and group by td with granularity', async () => runQueryTest(
3472-
{
3473-
measures: ['visitors.revenue_sum_group_by_granularity'],
3474-
dimensions: ['visitors.source'],
3475-
order: [{
3476-
id: 'visitors.source'
3477-
}],
3478-
timezone: 'UTC',
3479-
},
3480-
[{
3481-
visitors__revenue_sum_group_by_granularity: '300',
3482-
visitors__source: 'google',
3483-
},
3484-
{
3485-
visitors__revenue_sum_group_by_granularity: '300',
3486-
visitors__source: 'some',
3487-
},
3488-
{
3489-
visitors__revenue_sum_group_by_granularity: '900',
3490-
visitors__source: null,
3491-
},
3492-
{
3493-
visitors__revenue_sum_group_by_granularity: '500',
3494-
visitors__source: null,
3495-
}]
3496-
));
3471+
if (!getEnv('nativeSqlPlanner')) {
3472+
it('multi stage revenue_sum_group_by_granularity and group by td with granularity', async () => runQueryTest(
3473+
{
3474+
measures: ['visitors.revenue_sum_group_by_granularity'],
3475+
dimensions: ['visitors.source'],
3476+
order: [{
3477+
id: 'visitors.source'
3478+
}],
3479+
timezone: 'UTC',
3480+
},
3481+
[{
3482+
visitors__revenue_sum_group_by_granularity: '300',
3483+
visitors__source: 'google',
3484+
},
3485+
{
3486+
visitors__revenue_sum_group_by_granularity: '300',
3487+
visitors__source: 'some',
3488+
},
3489+
{
3490+
visitors__revenue_sum_group_by_granularity: '900',
3491+
visitors__source: null,
3492+
},
3493+
{
3494+
visitors__revenue_sum_group_by_granularity: '500',
3495+
visitors__source: null,
3496+
}]
3497+
));
3498+
} else {
3499+
it.skip('FIXME(tesseract): Should be fixed in tesseract', () => {
3500+
// Skipping because it not works in Tesseract yet
3501+
});
3502+
}
34973503

34983504
it('multi stage complex graph with time dimension no granularity', async () => runQueryTest(
34993505
{

0 commit comments

Comments
 (0)