Skip to content

Commit

Permalink
Merge pull request #321 from Canner/develop
Browse files Browse the repository at this point in the history
Chore: Bump to 0.10.2 in main
  • Loading branch information
kokokuo authored Oct 24, 2023
2 parents 6fa5052 + 85062fe commit 46b8773
Show file tree
Hide file tree
Showing 26 changed files with 132 additions and 75 deletions.
4 changes: 2 additions & 2 deletions packages/build/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/build",
"description": "VulcanSQL package for building projects",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"publishConfig": {
"access": "public"
Expand All @@ -22,6 +22,6 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@vulcan-sql/core": "~0.10.1-0"
"@vulcan-sql/core": "~0.10.2-0"
}
}
2 changes: 1 addition & 1 deletion packages/catalog-server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/catalog-server",
"description": "Catalog server for VulcanSQL",
"version": "0.10.1",
"version": "0.10.2",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/cli",
"description": "CLI tools for VulcanSQL",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"bin": {
"vulcan": "./src/index.js"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/core",
"description": "Core package of VulcanSQL",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { UniqueFilterBuilder } from './uniqueFilterBuilder';
import { UniqueFilterRunner } from './uniqueFilterRunner';
import { TypeofBuilder } from './typeofBuilder';
import { TypeofRunner } from './typeofRunner';

export default [UniqueFilterBuilder, UniqueFilterRunner];
export default [
UniqueFilterBuilder,
UniqueFilterRunner,
TypeofBuilder,
TypeofRunner,
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {
FilterBuilder,
VulcanInternalExtension,
} from '@vulcan-sql/core/models';

@VulcanInternalExtension()
export class TypeofBuilder extends FilterBuilder {
public filterName = 'typeof';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {
FilterRunner,
FilterRunnerTransformOptions,
VulcanInternalExtension,
} from '@vulcan-sql/core/models';

@VulcanInternalExtension()
export class TypeofRunner extends FilterRunner {
public filterName = 'typeof';
public async transform({
value,
}: FilterRunnerTransformOptions): Promise<any> {
return typeof value;
}
}
4 changes: 2 additions & 2 deletions packages/extension-api-caller/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/extension-api-caller",
"description": "Calling APIs to get data from other sources",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"publishConfig": {
"access": "public"
Expand All @@ -23,6 +23,6 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@vulcan-sql/core": "^0.10.1"
"@vulcan-sql/core": "^0.10.2"
}
}
6 changes: 3 additions & 3 deletions packages/extension-authenticator-canner/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/extension-authenticator-canner",
"description": "Canner Enterprise authenticator for Vulcan SQL",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"publishConfig": {
"access": "public"
Expand All @@ -24,7 +24,7 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@vulcan-sql/core": "~0.10.1-0",
"@vulcan-sql/serve": "~0.10.1-0"
"@vulcan-sql/core": "~0.10.2-0",
"@vulcan-sql/serve": "~0.10.2-0"
}
}
4 changes: 2 additions & 2 deletions packages/extension-dbt/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/extension-dbt",
"description": "Using dbt models form VulcanSQL projects",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"publishConfig": {
"access": "public"
Expand All @@ -23,6 +23,6 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@vulcan-sql/core": "~0.10.1-0"
"@vulcan-sql/core": "~0.10.2-0"
}
}
6 changes: 3 additions & 3 deletions packages/extension-debug-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/extension-debug-tools",
"description": "A collection of Vulcan extension debug tools",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"publishConfig": {
"access": "public"
Expand All @@ -22,9 +22,9 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@vulcan-sql/core": "~0.10.1-0"
"@vulcan-sql/core": "~0.10.2-0"
},
"devDependencies": {
"@vulcan-sql/test-utility": "~0.10.1-0"
"@vulcan-sql/test-utility": "~0.10.2-0"
}
}
4 changes: 2 additions & 2 deletions packages/extension-driver-bq/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/extension-driver-bq",
"description": "BigQuery driver for Vulcan SQL",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"publishConfig": {
"access": "public"
Expand All @@ -24,6 +24,6 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@vulcan-sql/core": "~0.10.1-0"
"@vulcan-sql/core": "~0.10.2-0"
}
}
4 changes: 2 additions & 2 deletions packages/extension-driver-canner/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/extension-driver-canner",
"description": "Canner Enterprise driver for Vulcan SQL",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"publishConfig": {
"access": "public"
Expand All @@ -24,6 +24,6 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@vulcan-sql/core": "~0.10.1-0"
"@vulcan-sql/core": "~0.10.2-0"
}
}
4 changes: 2 additions & 2 deletions packages/extension-driver-clickhouse/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/extension-driver-clickhouse",
"description": "Clickhouse driver for VulcanSQL",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"publishConfig": {
"access": "public"
Expand All @@ -27,6 +27,6 @@
"@clickhouse/client": "^0.1.1"
},
"peerDependencies": {
"@vulcan-sql/core": "~0.10.1-0"
"@vulcan-sql/core": "~0.10.2-0"
}
}
4 changes: 2 additions & 2 deletions packages/extension-driver-duckdb/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/extension-driver-duckdb",
"description": "duckdb driver for Vulcan SQL",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"publishConfig": {
"access": "public"
Expand All @@ -23,6 +23,6 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@vulcan-sql/core": "~0.10.1-0"
"@vulcan-sql/core": "~0.10.2-0"
}
}
24 changes: 15 additions & 9 deletions packages/extension-driver-duckdb/src/lib/duckdbDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,13 @@ export class DuckDBDataSource extends DataSource<any, DuckDBOptions> {
// create new connection for each query
const parameters = Array.from(bindParams.values());
this.logRequest(firstDataSQL, parameters, options);
const connection = db.connect();
await this.loadExtensions(connection, configurationParameters);
await this.setExecConfig(connection);
if (restDataSQL) this.logRequest(restDataSQL, parameters, options);
const [firstData, restDataStream] = await this.acquireData(
firstDataSQL,
restDataSQL,
parameters,
db
db,
configurationParameters
);
const readable = this.createReadableStream(firstData, restDataStream);
return {
Expand Down Expand Up @@ -168,15 +166,24 @@ export class DuckDBDataSource extends DataSource<any, DuckDBOptions> {
firstDataSql: string,
restDataSql: string | undefined,
parameters: any[],
db: duckdb.Database
db: duckdb.Database,
configurationParameters: ConfigurationParameters
) {
// conn.all() is faster then stream.checkChunk().
// For the small size data we use conn.all() to get the data at once
// To limit memory use and prevent server crashes, we will use conn.all() to acquire the initial chunk of data, then conn.stream() to receive the remainder of the data.
const c1 = db.connect();
const c2 = db.connect();
await Promise.all([
await this.loadExtensions(c1, configurationParameters),
await this.setExecConfig(c1),
await this.loadExtensions(c2, configurationParameters),
await this.setExecConfig(c2),
]);

return await Promise.all([
new Promise<duckdb.TableData>((resolve, reject) => {
const c = db.connect();
c.all(
c1.all(
firstDataSql,
...parameters,
(err: duckdb.DuckDbError | null, res: duckdb.TableData) => {
Expand All @@ -190,8 +197,7 @@ export class DuckDBDataSource extends DataSource<any, DuckDBOptions> {
new Promise<duckdb.QueryResult | undefined>((resolve, reject) => {
if (!restDataSql) resolve(undefined);
try {
const c = db.connect();
const result = c.stream(restDataSql, ...parameters);
const result = c2.stream(restDataSql, ...parameters);
resolve(result);
} catch (err: any) {
reject(err);
Expand Down
61 changes: 38 additions & 23 deletions packages/extension-driver-duckdb/src/lib/duckdbExtensionLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,51 @@ export class DuckDBExtensionLoader {
return;
}
try {
conn.run(`LOAD ${extensionName}`);
await new Promise<void>((resolve, reject) => {
conn.run(`LOAD ${extensionName}`, (err: any) => {
if (err) reject(err);
this.logger.debug('Extension loaded');
resolve();
});
});
} catch (error) {
this.logger.debug(`Error when loading extension:${extensionName}`);
throw error;
}
await Promise.all(
Object.entries(extensionConfigurations).map(
async ([dbParameterName, configurationKey]) => {
const configurationValue =
this.configurations[
configurationKey as keyof ConfigurationParameters
];
// if configuration is not undefined
if (configurationValue !== undefined) {
return await new Promise<void>((resolve, reject) => {
conn.run(
`SET ${dbParameterName}='${configurationValue}'`,
(err: any) => {
if (err) {
this.logger.debug(
`Configuration error "${dbParameterName}": ${err}`
);
reject(err);
}

Object.entries(extensionConfigurations).forEach(
([dbParameterName, configurationKey]) => {
const configurationValue =
this.configurations[
configurationKey as keyof ConfigurationParameters
];
// if configuration is not undefined
if (configurationValue !== undefined) {
conn.run(
`SET ${dbParameterName}='${configurationValue}'`,
(err: any) => {
if (err) throw err;
this.logger.debug(
`Configuration error "${dbParameterName}": ${err}`
this.logger.debug(
`Configuration parameter "${dbParameterName}" set`
);
resolve();
}
);
}
);
this.logger.debug(`Configuration parameter "${dbParameterName}" set`);
} else {
this.logger.debug(
`Configuration "${dbParameterName}" has not been set`
);
});
} else {
this.logger.debug(
`Configuration "${dbParameterName}" has not been set`
);
}
}
}
)
);
}
}
11 changes: 8 additions & 3 deletions packages/extension-driver-duckdb/tests/duckdbDataSource.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ it('Should print queries without binding when log-queries = true', async () => {
profileName: 'mocked-profile',
});
// Assert
expect(/select \$1::INTEGER as test/.test(logs.slice(-1)[0][0])).toBe(true);
expect(
logs.flat(2).find((log) => /select \$1::INTEGER as test/.test(log))
).not.toBe(undefined);
});

it('Should print queries with binding when log-queries = true and log-parameters = true', async () => {
Expand Down Expand Up @@ -357,8 +359,11 @@ it('Should print queries with binding when log-queries = true and log-parameters
profileName: 'mocked-profile',
});
// Assert
expect(/select \$1::INTEGER as test/.test(logs.slice(-1)[0][0])).toBe(true);
expect(logs.slice(-1)[0][1]).toEqual([1234]);
expect(
logs.flat(2).find((log) => /select \$1::INTEGER as test/.test(log))
).not.toBe(undefined);

expect(logs.flat(2)).toContain(1234);
});

it('Should share db instances for same path besides in-memory only db', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/extension-driver-ksqldb/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcan-sql/extension-driver-ksqldb",
"description": "ksqlDB driver for VulcanSQL",
"version": "0.10.1",
"version": "0.10.2",
"type": "commonjs",
"publishConfig": {
"access": "public"
Expand All @@ -23,6 +23,6 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@vulcan-sql/core": "~0.10.1-0"
"@vulcan-sql/core": "~0.10.2-0"
}
}
Loading

1 comment on commit 46b8773

@vercel
Copy link

@vercel vercel bot commented on 46b8773 Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.