diff --git a/packages/cubejs-druid-driver/src/DruidQuery.ts b/packages/cubejs-druid-driver/src/DruidQuery.ts index cdcedeb7e97df..c22abc450101b 100644 --- a/packages/cubejs-druid-driver/src/DruidQuery.ts +++ b/packages/cubejs-druid-driver/src/DruidQuery.ts @@ -16,7 +16,7 @@ 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}')`; } } @@ -24,7 +24,7 @@ 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); } diff --git a/packages/cubejs-druid-driver/test/druid-query.test.ts b/packages/cubejs-druid-driver/test/druid-query.test.ts index 9f9a8eb6dec5f..09bc54cfd3859 100644 --- a/packages/cubejs-druid-driver/test/druid-query.test.ts +++ b/packages/cubejs-druid-driver/test/druid-query.test.ts @@ -32,7 +32,7 @@ describe('DruidQuery', () => { type: 'time', } } - + }) `, {}); @@ -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(() => {