Skip to content

Commit

Permalink
fix(@cubejs-backend/query-orchestrator): Throw an exception on empty …
Browse files Browse the repository at this point in the history
…pre-agg in readOnly mode, refs #1597
  • Loading branch information
ovr committed Dec 24, 2020
1 parent 2549004 commit 17d5fdb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/cubejs-query-orchestrator/src/driver/BaseDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,30 @@ export class BaseDriver {
return ssl;
}

/**
* @abstract
* @return Promise<Array<unknown>>
*/
testConnection() {
throw new Error('Not implemented');
}

/**
* @abstract
* @param {string} query
* @param {Array<unknown>} values
* @return Promise<Array<unknown>>
*/
query(query, values) {
throw new Error('Not implemented');
}

async downloadQueryResults(query, values) {
const rows = await this.query(query, values);
if (rows.length === 0) {
throw new Error('Unable to detect column types for pre-aggregation on empty values in readOnly mode');
}

const fields = Object.keys(rows[0]);

const types = fields.map(field => ({
Expand Down

0 comments on commit 17d5fdb

Please sign in to comment.