Skip to content

Commit beac449

Browse files
committed
Fix getFieldType by using hash.id instead
1 parent f660674 commit beac449

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/cubejs-schema-compiler/src/adapter/ClickHouseQuery.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,12 @@ export class ClickHouseQuery extends BaseQuery {
155155
return null;
156156
}
157157

158-
public getFieldType(id) {
159-
const field = this.getField(id);
158+
public getFieldType(hash) {
159+
if (!hash || !hash.id) {
160+
return null;
161+
}
162+
163+
const field = this.getField(hash.id);
160164

161165
if (field) {
162166
return field.definition().type;

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,15 +411,12 @@ describe('ClickHouse DataSchemaCompiler', () => {
411411
});
412412
logSqlAndParams(query);
413413

414-
const collation = query.getCollation();
415-
expect(collation).toEqual('en');
416-
417414
const sqlAndParams = query.buildSqlAndParams();
418415
const res = await dbRunner.testQuery(sqlAndParams);
419416
const sql = sqlAndParams[0];
420417
expect(sql).toMatch('ORDER BY `visitors__source` ASC COLLATE \'en\'');
421418

422-
expect(res).toEqual([{ visitors__source: 'google' }, { visitors__source: 'Gork' }, { visitors__source: 'some' }]);
419+
expect(res).toEqual([{ visitors__source: 'google' }, { visitors__source: 'Gork' }, { visitors__source: 'some' }, { visitors__source: null }]);
423420
});
424421

425422
it('export import', () => {

0 commit comments

Comments
 (0)