Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions packages/cubejs-druid-driver/src/DruidQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class DruidFilter extends BaseFilter {
public likeIgnoreCase(column, not, param, type: string) {
const p = (!type || type === 'contains' || type === 'ends') ? '%' : '';
const s = (!type || type === 'contains' || type === 'starts') ? '%' : '';
return `${column}${not ? ' NOT' : ''} LIKE CONCAT('${p}', ${this.allocateParam(param)}, '${s}')`;
return `LOWER(${column})${not ? ' NOT' : ''} LIKE CONCAT('${p}', LOWER(${this.allocateParam(param)}), '${s}')`;
}
}

export class DruidQuery extends BaseQuery {
public newFilter(filter) {
return new DruidFilter(this, filter);
}

public timeGroupedColumn(granularity: string, dimension: string) {
return GRANULARITY_TO_INTERVAL[granularity](dimension);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cubejs-druid-driver/test/druid-query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('DruidQuery', () => {
type: 'time',
}
}

})
`, {});

Expand All @@ -54,7 +54,7 @@ describe('DruidQuery', () => {
},
);
const queryAndParams = query.buildSqlAndParams();
expect(queryAndParams[0]).toContain('LIKE CONCAT(\'%\', ?, \'%\'))');
expect(queryAndParams[0]).toContain('LIKE CONCAT(\'%\', LOWER(?), \'%\'))');
}));

it('druid query timezone shift test', () => compiler.compile().then(() => {
Expand Down
Loading