Skip to content

Commit cf98e55

Browse files
authored
chore(query-orchestrator): Get rid fetchSchema (#6423)
1 parent 67565b9 commit cf98e55

File tree

3 files changed

+3
-35
lines changed

3 files changed

+3
-35
lines changed

packages/cubejs-query-orchestrator/src/orchestrator/QueryCache.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@ export class QueryCache {
431431
lambdaTypes,
432432
persistent,
433433
aliasNameToMember,
434-
tablesSchema,
435434
}: {
436435
cacheKey: CacheKey,
437436
dataSource: string,
@@ -443,7 +442,6 @@ export class QueryCache {
443442
lambdaTypes?: TableStructure,
444443
persistent?: boolean,
445444
aliasNameToMember?: { [alias: string]: string },
446-
tablesSchema?: boolean,
447445
}
448446
) {
449447
const queue = external
@@ -458,7 +456,6 @@ export class QueryCache {
458456
inlineTables,
459457
useCsvQuery,
460458
lambdaTypes,
461-
tablesSchema,
462459
};
463460

464461
const opt = {
@@ -487,8 +484,6 @@ export class QueryCache {
487484
this.logger('Executing SQL', { ...req });
488485
if (req.useCsvQuery) {
489486
return this.csvQuery(client, req);
490-
} else if (req.tablesSchema) {
491-
return client.tablesSchema();
492487
} else {
493488
return client.query(req.query, req.values, req);
494489
}
@@ -555,10 +550,6 @@ export class QueryCache {
555550
`SQL_QUERY_EXT_${this.redisPrefix}`,
556551
this.options.externalDriverFactory,
557552
(client, q) => {
558-
if (q.tablesSchema) {
559-
return client.tablesSchema();
560-
}
561-
562553
this.logger('Executing SQL', {
563554
...q
564555
});

packages/cubejs-query-orchestrator/src/orchestrator/QueryOrchestrator.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -481,13 +481,4 @@ export class QueryOrchestrator {
481481
public async updateRefreshEndReached() {
482482
return this.preAggregations.updateRefreshEndReached();
483483
}
484-
485-
public async fetchSchema(dataSource?: string, external?: boolean) {
486-
return this.queryCache.queryWithRetryAndRelease('', [], {
487-
cacheKey: [`Fetch schema for ${dataSource}`, []],
488-
dataSource,
489-
external,
490-
tablesSchema: true
491-
});
492-
}
493484
}

packages/cubejs-query-orchestrator/test/unit/QueryOrchestrator.test.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,15 @@ class MockDriver {
117117
capabilities() {
118118
return {};
119119
}
120-
121-
tablesSchema() {
122-
return this.schemaData;
123-
}
124120

125121
async streamQuery(sql) {
126122
return Readable.from((await this.query(sql)).map(r => (typeof r === 'string' ? { query: r } : r)));
127123
}
128124
}
129125

130126
class ExternalMockDriver extends MockDriver {
131-
constructor({ schemaData } = {}) {
132-
super({ schemaData });
127+
constructor() {
128+
super();
133129
this.indexes = [];
134130
this.csvFiles = [];
135131
}
@@ -223,7 +219,7 @@ describe('QueryOrchestrator', () => {
223219
const csvMockDriverLocal = new MockDriver({ csvImport: 'true' });
224220
const mockDriverUnloadWithoutTempTableSupportLocal = new MockDriverUnloadWithoutTempTableSupport();
225221
const streamingSourceMockDriverLocal = new StreamingSourceMockDriver();
226-
const externalMockDriverLocal = new ExternalMockDriver({ schemaData });
222+
const externalMockDriverLocal = new ExternalMockDriver();
227223

228224
const redisPrefix = `ORCHESTRATOR_TEST_${testCount++}`;
229225
const driverFactory = (dataSource) => {
@@ -1636,11 +1632,6 @@ describe('QueryOrchestrator', () => {
16361632
expect(mockDriver.tables).toContainEqual(expect.stringMatching(/orders_delay/));
16371633
});
16381634

1639-
test('fetch table schema', async () => {
1640-
const schema = await queryOrchestrator.fetchSchema('foo');
1641-
expect(schema).toEqual(schemaData);
1642-
});
1643-
16441635
test('streaming simple', async () => {
16451636
const query = (id) => ({
16461637
query: `SELECT * FROM stb_pre_aggregations.orders_d WHERE id = ${id}`,
@@ -1713,9 +1704,4 @@ describe('QueryOrchestrator', () => {
17131704
expect(data['Foo.query']).toMatch(/orders_d/);
17141705
}));
17151706
});
1716-
1717-
test('fetch table schema from external db', async () => {
1718-
const schema = await queryOrchestrator.fetchSchema(undefined, true);
1719-
expect(schema).toEqual(schemaData);
1720-
});
17211707
});

0 commit comments

Comments
 (0)