@malloydata/db-duckdb 0.0.80-dev230822210650 → 0.0.80-dev230824170739
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/duckdb_common.d.ts +1 -0
- package/dist/duckdb_common.js +6 -22
- package/package.json +2 -2
package/dist/duckdb_common.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface DuckDBQueryOptions {
|
|
|
5
5
|
export type QueryOptionsReader = Partial<DuckDBQueryOptions> | (() => Partial<DuckDBQueryOptions>);
|
|
6
6
|
export declare abstract class DuckDBCommon implements TestableConnection, PersistSQLResults, StreamingConnection {
|
|
7
7
|
private queryOptions?;
|
|
8
|
+
private readonly dialect;
|
|
8
9
|
static DEFAULT_QUERY_OPTIONS: DuckDBQueryOptions;
|
|
9
10
|
private schemaCache;
|
|
10
11
|
private sqlSchemaCache;
|
package/dist/duckdb_common.js
CHANGED
|
@@ -23,24 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.DuckDBCommon = void 0;
|
|
26
|
-
const
|
|
27
|
-
'BIGINT': 'number',
|
|
28
|
-
'INTEGER': 'number',
|
|
29
|
-
'TINYINT': 'number',
|
|
30
|
-
'SMALLINT': 'number',
|
|
31
|
-
'UBIGINT': 'number',
|
|
32
|
-
'UINTEGER': 'number',
|
|
33
|
-
'UTINYINT': 'number',
|
|
34
|
-
'USMALLINT': 'number',
|
|
35
|
-
'HUGEINT': 'number',
|
|
36
|
-
'DOUBLE': 'number',
|
|
37
|
-
'VARCHAR': 'string',
|
|
38
|
-
'DATE': 'date',
|
|
39
|
-
'TIMESTAMP': 'timestamp',
|
|
40
|
-
'TIME': 'string',
|
|
41
|
-
'DECIMAL': 'number',
|
|
42
|
-
'BOOLEAN': 'boolean',
|
|
43
|
-
};
|
|
26
|
+
const malloy_1 = require("@malloydata/malloy");
|
|
44
27
|
const unquoteName = (name) => {
|
|
45
28
|
const match = /^"(.*)"$/.exec(name);
|
|
46
29
|
if (match) {
|
|
@@ -68,6 +51,7 @@ class DuckDBCommon {
|
|
|
68
51
|
}
|
|
69
52
|
constructor(queryOptions) {
|
|
70
53
|
this.queryOptions = queryOptions;
|
|
54
|
+
this.dialect = new malloy_1.DuckDBDialect();
|
|
71
55
|
this.schemaCache = new Map();
|
|
72
56
|
this.sqlSchemaCache = new Map();
|
|
73
57
|
this.name = 'duckdb_common';
|
|
@@ -183,7 +167,7 @@ class DuckDBCommon {
|
|
|
183
167
|
const name = unquoteName(fieldName);
|
|
184
168
|
// Remove DECIMAL(x,y) precision to simplify lookup
|
|
185
169
|
duckDBType = duckDBType.replace(/^DECIMAL\(\d+,\d+\)/g, 'DECIMAL');
|
|
186
|
-
let malloyType =
|
|
170
|
+
let malloyType = this.dialect.sqlTypeToMalloyType(duckDBType);
|
|
187
171
|
const arrayMatch = duckDBType.match(/(?<duckDBType>.*)\[\]$/);
|
|
188
172
|
if (arrayMatch && arrayMatch.groups) {
|
|
189
173
|
duckDBType = arrayMatch.groups['duckDBType'];
|
|
@@ -208,7 +192,7 @@ class DuckDBCommon {
|
|
|
208
192
|
}
|
|
209
193
|
else {
|
|
210
194
|
if (arrayMatch) {
|
|
211
|
-
malloyType =
|
|
195
|
+
malloyType = this.dialect.sqlTypeToMalloyType(duckDBType);
|
|
212
196
|
const innerStructDef = {
|
|
213
197
|
type: 'struct',
|
|
214
198
|
name,
|
|
@@ -219,13 +203,13 @@ class DuckDBCommon {
|
|
|
219
203
|
field: name,
|
|
220
204
|
isArray: true,
|
|
221
205
|
},
|
|
222
|
-
fields: [{
|
|
206
|
+
fields: [{ ...malloyType, name: 'value' }],
|
|
223
207
|
};
|
|
224
208
|
structDef.fields.push(innerStructDef);
|
|
225
209
|
}
|
|
226
210
|
else {
|
|
227
211
|
if (malloyType) {
|
|
228
|
-
structDef.fields.push({
|
|
212
|
+
structDef.fields.push({ ...malloyType, name });
|
|
229
213
|
}
|
|
230
214
|
else {
|
|
231
215
|
structDef.fields.push({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/db-duckdb",
|
|
3
|
-
"version": "0.0.80-
|
|
3
|
+
"version": "0.0.80-dev230824170739",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@malloydata/duckdb-wasm": "0.0.2",
|
|
44
|
-
"@malloydata/malloy": "^0.0.80-
|
|
44
|
+
"@malloydata/malloy": "^0.0.80-dev230824170739",
|
|
45
45
|
"apache-arrow": "^11.0.0",
|
|
46
46
|
"duckdb": "0.8.1",
|
|
47
47
|
"web-worker": "^1.2.0"
|