Skip to content

Commit 79ab001

Browse files
committed
Assert collation in the 'collation in order by' clickhouse integration test
1 parent 716f24b commit 79ab001

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

packages/cubejs-backend-shared/src/env.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,15 +1141,16 @@ const variables: Record<string, (...args: any) => any> = {
11411141
/**
11421142
* ClickHouse sort collation.
11431143
*/
1144-
clickhouseSortCollation: ({
1145-
dataSource
1146-
}: {
1147-
dataSource: string,
1148-
}) => (
1149-
process.env[
1144+
clickhouseSortCollation: ({ dataSource }: {dataSource: string }) => {
1145+
const val = process.env[
11501146
keyByDataSource('CUBEJS_DB_CLICKHOUSE_SORT_COLLATION', dataSource)
1151-
] || 'en'
1152-
),
1147+
];
1148+
if (!val) {
1149+
// Default to 'en' collation
1150+
return 'en';
1151+
}
1152+
return val;
1153+
},
11531154

11541155
/**
11551156
* Clickhouse use collation flag.

packages/cubejs-schema-compiler/test/integration/clickhouse/clickhouse-dataschema-compiler.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ describe('ClickHouse DataSchemaCompiler', () => {
411411
});
412412
logSqlAndParams(query);
413413

414+
const collation = query.getCollation();
415+
expect(collation).toEqual('en');
416+
414417
const sqlAndParams = query.buildSqlAndParams();
415418
const res = await dbRunner.testQuery(sqlAndParams);
416419
const sql = sqlAndParams[0];

0 commit comments

Comments
 (0)