Skip to content

Commit

Permalink
fix test in postgres pre agregations due to empty order by feature ch…
Browse files Browse the repository at this point in the history
…ange
  • Loading branch information
KSDaemon committed Jun 27, 2024
1 parent 888b8f4 commit 53893fc
Showing 1 changed file with 35 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ describe('PreAggregations', () => {
select * from visitors WHERE \${FILTER_PARAMS.visitors.createdAt.filter('created_at')}
AND \${FILTER_PARAMS.ReferenceOriginalSql.createdAt.filter('created_at')}
\`,
joins: {
visitor_checkins: {
relationship: 'hasMany',
sql: \`\${CUBE.id} = \${visitor_checkins.visitor_id}\`
},
cards: {
relationship: 'hasMany',
sql: \`\${visitors.id} = \${cards.visitorId}\`
Expand All @@ -30,52 +30,52 @@ describe('PreAggregations', () => {
count: {
type: 'count'
},
checkinsTotal: {
sql: \`\${checkinsCount}\`,
type: 'sum'
},
checkinsRollingTotal: {
sql: \`\${checkinsCount}\`,
type: 'sum',
rollingWindow: {
trailing: 'unbounded'
}
},
checkinsRolling2day: {
sql: \`\${checkinsCount}\`,
type: 'sum',
rollingWindow: {
trailing: '2 day'
}
},
uniqueSourceCount: {
sql: 'source',
type: 'countDistinct'
},
countDistinctApprox: {
sql: 'id',
type: 'countDistinctApprox'
},
ratio: {
sql: \`\${uniqueSourceCount} / nullif(\${checkinsTotal}, 0)\`,
type: 'number'
},
googleUniqueSourceCount: {
sql: \`\${CUBE.source}\`,
filters: [{
sql: \`\${CUBE}.source = 'google'\`
}],
type: 'countDistinct'
},
},
dimensions: {
Expand Down Expand Up @@ -107,13 +107,13 @@ describe('PreAggregations', () => {
propagateFiltersToSubQuery: true
}
},
segments: {
google: {
sql: \`source = 'google'\`
}
},
preAggregations: {
default: {
type: 'originalSql',
Expand Down Expand Up @@ -238,13 +238,13 @@ describe('PreAggregations', () => {
}
}
})
cube('visitor_checkins', {
sql: \`
select * from visitor_checkins
\`,
sqlAlias: 'vc',
measures: {
Expand Down Expand Up @@ -272,7 +272,7 @@ describe('PreAggregations', () => {
sql: 'created_at'
}
},
preAggregations: {
main: {
type: 'originalSql'
Expand Down Expand Up @@ -333,7 +333,7 @@ describe('PreAggregations', () => {
}
}
});
cube('cards', {
sql: \`
select * from cards
Expand All @@ -351,13 +351,13 @@ describe('PreAggregations', () => {
sql: 'id',
primaryKey: true
},
visitorId: {
type: 'number',
sql: 'visitor_id'
}
},
preAggregations: {
forJoin: {
type: 'rollup',
Expand All @@ -366,22 +366,22 @@ describe('PreAggregations', () => {
},
}
});
cube('GoogleVisitors', {
refreshKey: {
immutable: true,
},
extends: visitors,
sql: \`select v.* from \${visitors.sql()} v where v.source = 'google'\`
})
cube('EveryHourVisitors', {
refreshKey: {
immutable: true,
},
extends: visitors,
sql: \`select v.* from \${visitors.sql()} v where v.source = 'google'\`,
preAggregations: {
default: {
type: 'originalSql',
Expand All @@ -404,16 +404,16 @@ describe('PreAggregations', () => {
}
}
})
cube('EmptyHourVisitors', {
extends: EveryHourVisitors,
sql: \`select v.* from \${visitors.sql()} v where created_at < '2000-01-01'\`
})
cube('ReferenceOriginalSql', {
extends: visitors,
sql: \`select v.* from \${visitors.sql()} v where v.source = 'google'\`,
preAggregations: {
partitioned: {
type: 'rollup',
Expand All @@ -431,33 +431,33 @@ describe('PreAggregations', () => {
}
}
})
cube('VisitorView', {
sql: \`SELECT 1\`,
measures: {
checkinsTotal: {
sql: \`\${visitors.checkinsTotal}\`,
type: 'number',
}
},
dimensions: {
source: {
sql: \`\${visitors.source}\`,
type: 'string',
},
createdAt: {
sql: \`\${visitors.createdAt}\`,
type: 'time'
}
},
});
cube('LambdaVisitors', {
extends: visitors,
preAggregations: {
partitionedLambda: {
type: 'rollupLambda',
Expand All @@ -478,11 +478,11 @@ describe('PreAggregations', () => {
}
}
});
cube('RealTimeLambdaVisitors', {
dataSource: 'ksql',
extends: visitors,
preAggregations: {
partitioned: {
type: 'rollup',
Expand All @@ -494,7 +494,7 @@ describe('PreAggregations', () => {
}
}
});
view('visitors_view', {
cubes: [{
join_path: visitors,
Expand Down Expand Up @@ -1894,7 +1894,6 @@ describe('PreAggregations', () => {
timezone: 'America/Los_Angeles',
preAggregationsSchema: '',
timeDimensions: [],
order: [],
});

const queryAndParams = query.buildSqlAndParams();
Expand Down

0 comments on commit 53893fc

Please sign in to comment.