Skip to content

Commit a3028d5

Browse files
committed
fix ms sql test
1 parent f11a687 commit a3028d5

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('MSSqlPreAggregations', () => {
1818
sql: \`
1919
select * from ##visitors
2020
\`,
21-
21+
2222
joins: {
2323
visitor_checkins: {
2424
relationship: 'hasMany',
@@ -30,22 +30,22 @@ describe('MSSqlPreAggregations', () => {
3030
count: {
3131
type: 'count'
3232
},
33-
33+
3434
checkinsTotal: {
3535
sql: \`\${checkinsCount}\`,
3636
type: 'sum'
3737
},
38-
38+
3939
uniqueSourceCount: {
4040
sql: 'source',
4141
type: 'countDistinct'
4242
},
43-
43+
4444
countDistinctApprox: {
4545
sql: 'id',
4646
type: 'countDistinctApprox'
4747
},
48-
48+
4949
ratio: {
5050
sql: \`1.0 * \${uniqueSourceCount} / nullif(\${checkinsTotal}, 0)\`,
5151
type: 'number'
@@ -72,13 +72,13 @@ describe('MSSqlPreAggregations', () => {
7272
subQuery: true
7373
}
7474
},
75-
75+
7676
segments: {
7777
google: {
7878
sql: \`source = 'google'\`
7979
}
8080
},
81-
81+
8282
preAggregations: {
8383
default: {
8484
type: 'originalSql'
@@ -125,8 +125,8 @@ describe('MSSqlPreAggregations', () => {
125125
}
126126
}
127127
})
128-
129-
128+
129+
130130
cube('visitor_checkins', {
131131
sql: \`
132132
select * from ##visitor_checkins
@@ -157,7 +157,7 @@ describe('MSSqlPreAggregations', () => {
157157
sql: 'created_at'
158158
}
159159
},
160-
160+
161161
preAggregations: {
162162
main: {
163163
type: 'originalSql'
@@ -168,7 +168,7 @@ describe('MSSqlPreAggregations', () => {
168168
}
169169
}
170170
})
171-
171+
172172
cube('GoogleVisitors', {
173173
extends: visitors,
174174
sql: \`select v.* from \${visitors.sql()} v where v.source = 'google'\`
@@ -276,7 +276,7 @@ describe('MSSqlPreAggregations', () => {
276276

277277
expect(preAggregationsDescription[0].invalidateKeyQueries[0][0].replace(/(\r\n|\n|\r)/gm, '')
278278
.replace(/\s+/g, ' '))
279-
.toMatch('SELECT CASE WHEN CURRENT_TIMESTAMP < DATEADD(day, 7, CAST(@_1 AS DATETIME2)) THEN FLOOR((DATEDIFF(SECOND,\'1970-01-01\', GETUTCDATE())) / 3600) END');
279+
.toMatch('SELECT CASE WHEN CURRENT_TIMESTAMP < DATEADD(day, 7, CAST(@_1 AS DATETIMEOFFSET)) THEN FLOOR((DATEDIFF(SECOND,\'1970-01-01\', GETUTCDATE())) / 3600) END');
280280

281281
return dbRunner
282282
.evaluateQueryWithPreAggregations(query)

packages/cubejs-schema-compiler/test/unit/base-query.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ describe('SQL Generation', () => {
13561356
expect(preAggregations.length).toEqual(1);
13571357
expect(preAggregations[0].invalidateKeyQueries).toEqual([
13581358
[
1359-
'SELECT CASE\n WHEN CURRENT_TIMESTAMP < CAST(@_1 AS DATETIME2) THEN FLOOR((DATEDIFF(SECOND,\'1970-01-01\', GETUTCDATE())) / 3600) END as refresh_key',
1359+
'SELECT CASE\n WHEN CURRENT_TIMESTAMP < CAST(@_1 AS DATETIMEOFFSET) THEN FLOOR((DATEDIFF(SECOND,\'1970-01-01\', GETUTCDATE())) / 3600) END as refresh_key',
13601360
[
13611361
'__TO_PARTITION_RANGE',
13621362
],

0 commit comments

Comments
 (0)