Skip to content

Commit ca314a0

Browse files
committed
fix(schema-compiler): Fix ORDER BY clause generation for queries with td with filters
1 parent c19fb8a commit ca314a0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/cubejs-schema-compiler/src/adapter/BaseQuery.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2191,9 +2191,13 @@ export class BaseQuery {
21912191

21922192
let index;
21932193

2194-
index = this.dimensionsForSelect().findIndex(
2195-
d => equalIgnoreCase(d.dimension, id) || equalIgnoreCase(d.expressionName, id)
2196-
);
2194+
index = this.dimensionsForSelect()
2195+
// Not all time dimensions are used in select list, some are just filters,
2196+
// but they exist in this.timeDimensions, so need to filter them out
2197+
.filter(d => d.selectColumns())
2198+
.findIndex(
2199+
d => equalIgnoreCase(d.dimension, id) || equalIgnoreCase(d.expressionName, id)
2200+
);
21972201

21982202
if (index > -1) {
21992203
return index + 1;

0 commit comments

Comments
 (0)