Skip to content

Commit 579b92e

Browse files
committed
update getFieldIndex() in DatabricksQuery
1 parent 4cb89d4 commit 579b92e

File tree

2 files changed

+6
-29
lines changed

2 files changed

+6
-29
lines changed

packages/cubejs-databricks-jdbc-driver/src/DatabricksQuery.ts

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -144,42 +144,19 @@ export class DatabricksQuery extends BaseQuery {
144144
return `\`${name}\``;
145145
}
146146

147-
public getFieldIndex(id: string) {
148-
const dimension = this.dimensionsForSelect().find((d: any) => d.dimension === id);
149-
if (dimension) {
150-
return super.getFieldIndex(id);
147+
public override getFieldIndex(id: string): string | number | null {
148+
const idx = super.getFieldIndex(id);
149+
if (idx !== null) {
150+
return idx;
151151
}
152+
152153
return this.escapeColumnName(this.aliasName(id, false));
153154
}
154155

155156
public unixTimestampSql() {
156157
return 'unix_timestamp()';
157158
}
158159

159-
public orderHashToString(hash: any) {
160-
if (!hash || !hash.id) {
161-
return null;
162-
}
163-
164-
const fieldIndex = this.getFieldIndex(hash.id);
165-
if (fieldIndex === null) {
166-
return null;
167-
}
168-
169-
const dimensionsForSelect = this.dimensionsForSelect();
170-
const dimensionColumns = R.flatten(
171-
dimensionsForSelect.map((s: any) => s.selectColumns() && s.aliasName())
172-
)
173-
.filter(s => !!s);
174-
175-
if (dimensionColumns.length) {
176-
const direction = hash.desc ? 'DESC' : 'ASC';
177-
return `${fieldIndex} ${direction}`;
178-
}
179-
180-
return null;
181-
}
182-
183160
public defaultRefreshKeyRenewalThreshold() {
184161
return 120;
185162
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2568,7 +2568,7 @@ export class BaseQuery {
25682568
}
25692569

25702570
/**
2571-
* XXX: String as return value is added because of HiveQuery.getFieldIndex()
2571+
* XXX: String as return value is added because of HiveQuery.getFieldIndex() and DatabricksQuery.getFieldIndex()
25722572
* @protected
25732573
* @param {string} id member name in form of "cube.member[.granularity]"
25742574
* @returns {number|string|null}

0 commit comments

Comments
 (0)