Skip to content

Commit 0949d69

Browse files
committed
fix(presto-driver): optimize testConnection() to issue simple select 1 test instead of heavy show catalogs
1 parent 6d75c60 commit 0949d69

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/cubejs-prestodb-driver/src/PrestoDriver.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class PrestoDriver extends BaseDriver implements DriverInterface {
103103
}
104104

105105
public testConnection() {
106-
const query = SqlString.format('show catalogs like ?', [`%${this.catalog}%`]);
106+
const query = ('SELECT 1');
107107

108108
return (<Promise<any[]>> this.queryPromised(query, false))
109109
.then(catalogs => {
@@ -230,7 +230,7 @@ export class PrestoDriver extends BaseDriver implements DriverInterface {
230230
if (!this.config.exportBucket) {
231231
throw new Error('Export bucket is not configured.');
232232
}
233-
233+
234234
if (!SUPPORTED_BUCKET_TYPES.includes(this.config.bucketType as string)) {
235235
throw new Error(`Unsupported export bucket type: ${
236236
this.config.bucketType
@@ -240,7 +240,7 @@ export class PrestoDriver extends BaseDriver implements DriverInterface {
240240
const types = options.query
241241
? await this.unloadWithSql(tableName, options.query.sql, options.query.params)
242242
: await this.unloadWithTable(tableName);
243-
243+
244244
const csvFile = await this.getCsvFiles(tableName);
245245

246246
return {
@@ -287,7 +287,7 @@ export class PrestoDriver extends BaseDriver implements DriverInterface {
287287

288288
const { bucketType, exportBucket } = this.config;
289289
const types = await this.queryColumnTypes(params.typeSql, params.typeParams);
290-
290+
291291
const { schema, tableName } = this.splitTableFullName(params.tableFullName);
292292
const tableWithCatalogAndSchema = `${this.config.catalog}.${schema}.${tableName}`;
293293
const protocol = bucketType === 'gcs' ? 'gs' : bucketType;

0 commit comments

Comments
 (0)