duckdb 0.4.1-dev2358.0 → 0.4.1-dev2371.0
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/lib/duckdb.js +28 -9
- package/package.json +1 -1
- package/src/connection.cpp +21 -0
- package/src/database.cpp +1 -1
- package/src/duckdb.cpp +6 -4
- package/src/duckdb.hpp +2 -2
- package/src/parquet-amalgamation.cpp +29319 -29319
package/lib/duckdb.js
CHANGED
|
@@ -92,6 +92,7 @@ QueryResult.prototype[Symbol.asyncIterator] = async function*() {
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
+
* Run a SQL statement and trigger a callback when done
|
|
95
96
|
* @arg sql
|
|
96
97
|
* @param {...*} params
|
|
97
98
|
* @param callback
|
|
@@ -103,6 +104,7 @@ Connection.prototype.run = function (sql) {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
/**
|
|
107
|
+
* Run a SQL query and triggers the callback once for all result rows
|
|
106
108
|
* @arg sql
|
|
107
109
|
* @param {...*} params
|
|
108
110
|
* @param callback
|
|
@@ -114,6 +116,7 @@ Connection.prototype.all = function (sql) {
|
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
/**
|
|
119
|
+
* Runs a SQL query and triggers the callback for each result row
|
|
117
120
|
* @arg sql
|
|
118
121
|
* @param {...*} params
|
|
119
122
|
* @param callback
|
|
@@ -260,6 +263,7 @@ Connection.prototype.register = function (name, return_type, fun) {
|
|
|
260
263
|
}
|
|
261
264
|
|
|
262
265
|
/**
|
|
266
|
+
* Prepare a SQL query for execution
|
|
263
267
|
* @method
|
|
264
268
|
* @arg sql
|
|
265
269
|
* @param {...*} params
|
|
@@ -268,6 +272,7 @@ Connection.prototype.register = function (name, return_type, fun) {
|
|
|
268
272
|
*/
|
|
269
273
|
Connection.prototype.prepare;
|
|
270
274
|
/**
|
|
275
|
+
* Execute a SQL query
|
|
271
276
|
* @method
|
|
272
277
|
* @arg sql
|
|
273
278
|
* @param {...*} params
|
|
@@ -305,16 +310,28 @@ var default_connection = function (o) {
|
|
|
305
310
|
|
|
306
311
|
|
|
307
312
|
/**
|
|
313
|
+
* Closes database instance
|
|
308
314
|
* @method
|
|
309
315
|
* @param callback
|
|
310
316
|
* @return {void}
|
|
311
317
|
*/
|
|
312
|
-
Database.prototype.close
|
|
318
|
+
Database.prototype.close = function() {
|
|
319
|
+
this.default_connection = null
|
|
320
|
+
this.close_internal.apply(this, arguments);
|
|
321
|
+
};
|
|
313
322
|
|
|
314
323
|
/**
|
|
324
|
+
* Internal method. Do not use, call Connection#close instead
|
|
325
|
+
* @method
|
|
326
|
+
* @param callback
|
|
327
|
+
* @return {void}
|
|
328
|
+
*/
|
|
329
|
+
Database.prototype.close_internal;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Triggers callback when all scheduled database tasks have completed.
|
|
315
333
|
* @method
|
|
316
334
|
* @param callback
|
|
317
|
-
* TODO: what does this do?
|
|
318
335
|
* @return {void}
|
|
319
336
|
*/
|
|
320
337
|
Database.prototype.wait;
|
|
@@ -336,6 +353,7 @@ Database.prototype.serialize;
|
|
|
336
353
|
Database.prototype.parallelize;
|
|
337
354
|
|
|
338
355
|
/**
|
|
356
|
+
* Create a new database connection
|
|
339
357
|
* @method
|
|
340
358
|
* @arg path the database to connect to, either a file path, or `:memory:`
|
|
341
359
|
* @return {Connection}
|
|
@@ -343,7 +361,7 @@ Database.prototype.parallelize;
|
|
|
343
361
|
Database.prototype.connect;
|
|
344
362
|
|
|
345
363
|
/**
|
|
346
|
-
*
|
|
364
|
+
* Supposedly interrupt queries, but currently does not do anything.
|
|
347
365
|
* @method
|
|
348
366
|
* @param callback
|
|
349
367
|
* @return {void}
|
|
@@ -351,6 +369,7 @@ Database.prototype.connect;
|
|
|
351
369
|
Database.prototype.interrupt;
|
|
352
370
|
|
|
353
371
|
/**
|
|
372
|
+
* Prepare a SQL query for execution
|
|
354
373
|
* @arg sql
|
|
355
374
|
* @return {Statement}
|
|
356
375
|
*/
|
|
@@ -359,6 +378,7 @@ Database.prototype.prepare = function () {
|
|
|
359
378
|
}
|
|
360
379
|
|
|
361
380
|
/**
|
|
381
|
+
* Convenience method for Connection#run using a built-in default connection
|
|
362
382
|
* @arg sql
|
|
363
383
|
* @param {...*} params
|
|
364
384
|
* @param callback
|
|
@@ -370,6 +390,7 @@ Database.prototype.run = function () {
|
|
|
370
390
|
}
|
|
371
391
|
|
|
372
392
|
/**
|
|
393
|
+
* Convenience method for Connection#each using a built-in default connection
|
|
373
394
|
* @arg sql
|
|
374
395
|
* @param {...*} params
|
|
375
396
|
* @param callback
|
|
@@ -381,6 +402,7 @@ Database.prototype.each = function () {
|
|
|
381
402
|
}
|
|
382
403
|
|
|
383
404
|
/**
|
|
405
|
+
* Convenience method for Connection#apply using a built-in default connection
|
|
384
406
|
* @arg sql
|
|
385
407
|
* @param {...*} params
|
|
386
408
|
* @param callback
|
|
@@ -392,6 +414,7 @@ Database.prototype.all = function () {
|
|
|
392
414
|
}
|
|
393
415
|
|
|
394
416
|
/**
|
|
417
|
+
* Convenience method for Connection#exec using a built-in default connection
|
|
395
418
|
* @arg sql
|
|
396
419
|
* @param {...*} params
|
|
397
420
|
* @param callback
|
|
@@ -403,9 +426,7 @@ Database.prototype.exec = function () {
|
|
|
403
426
|
}
|
|
404
427
|
|
|
405
428
|
/**
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
* Convenience method for Connection#register
|
|
429
|
+
* Convenience method for Connection#register using a built-in default connection
|
|
409
430
|
* @arg name
|
|
410
431
|
* @arg return_type
|
|
411
432
|
* @arg fun
|
|
@@ -417,9 +438,7 @@ Database.prototype.register = function () {
|
|
|
417
438
|
}
|
|
418
439
|
|
|
419
440
|
/**
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
* Convenience method for Connection#unregister
|
|
441
|
+
* Convenience method for Connection#unregister using a built-in default connection
|
|
423
442
|
* @arg name
|
|
424
443
|
* @return {this}
|
|
425
444
|
*/
|
package/package.json
CHANGED
package/src/connection.cpp
CHANGED
|
@@ -31,8 +31,29 @@ struct ConnectTask : public Task {
|
|
|
31
31
|
|
|
32
32
|
void DoWork() override {
|
|
33
33
|
auto &connection = Get<Connection>();
|
|
34
|
+
if (!connection.database_ref || !connection.database_ref->database) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
34
37
|
connection.connection = duckdb::make_unique<duckdb::Connection>(*connection.database_ref->database);
|
|
38
|
+
success = true;
|
|
39
|
+
}
|
|
40
|
+
void Callback() override {
|
|
41
|
+
auto &connection = Get<Connection>();
|
|
42
|
+
Napi::Env env = connection.Env();
|
|
43
|
+
|
|
44
|
+
std::vector<napi_value> args;
|
|
45
|
+
if (!success) {
|
|
46
|
+
args.push_back(Utils::CreateError(env, "Invalid database object"));
|
|
47
|
+
} else {
|
|
48
|
+
args.push_back(env.Null());
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
Napi::HandleScope scope(env);
|
|
52
|
+
|
|
53
|
+
callback.Value().MakeCallback(connection.Value(), args);
|
|
35
54
|
}
|
|
55
|
+
|
|
56
|
+
bool success = false;
|
|
36
57
|
};
|
|
37
58
|
|
|
38
59
|
Connection::Connection(const Napi::CallbackInfo &info) : Napi::ObjectWrap<Connection>(info) {
|
package/src/database.cpp
CHANGED
|
@@ -11,7 +11,7 @@ Napi::Object Database::Init(Napi::Env env, Napi::Object exports) {
|
|
|
11
11
|
|
|
12
12
|
Napi::Function t = DefineClass(
|
|
13
13
|
env, "Database",
|
|
14
|
-
{InstanceMethod("
|
|
14
|
+
{InstanceMethod("close_internal", &Database::Close), InstanceMethod("wait", &Database::Wait),
|
|
15
15
|
InstanceMethod("serialize", &Database::Serialize), InstanceMethod("parallelize", &Database::Parallelize),
|
|
16
16
|
InstanceMethod("connect", &Database::Connect), InstanceMethod("interrupt", &Database::Interrupt)});
|
|
17
17
|
|
package/src/duckdb.cpp
CHANGED
|
@@ -141850,7 +141850,7 @@ private:
|
|
|
141850
141850
|
|
|
141851
141851
|
bool full_plan_found;
|
|
141852
141852
|
bool must_update_full_plan;
|
|
141853
|
-
unordered_set<
|
|
141853
|
+
unordered_set<std::string> join_nodes_in_full_plan;
|
|
141854
141854
|
|
|
141855
141855
|
//! Extract the bindings referred to by an Expression
|
|
141856
141856
|
bool ExtractBindings(Expression &expression, unordered_set<idx_t> &bindings);
|
|
@@ -142161,6 +142161,8 @@ double CardinalityEstimator::EstimateCardinalityWithSet(JoinRelationSet *new_set
|
|
|
142161
142161
|
}
|
|
142162
142162
|
}
|
|
142163
142163
|
double denom = 1;
|
|
142164
|
+
// TODO: It's possible cross-products were added and are not present in the filters in the relation_2_tdom
|
|
142165
|
+
// structures. When that's the case, multiply the denom structures that have no intersection
|
|
142164
142166
|
for (auto &match : subgraphs) {
|
|
142165
142167
|
// It's possible that in production, one of the D_ASSERTS above will fail and not all subgraphs
|
|
142166
142168
|
// were connected. When this happens, just use the largest denominator of all the subgraphs.
|
|
@@ -145960,7 +145962,7 @@ void JoinOrderOptimizer::UpdateJoinNodesInFullPlan(JoinNode *node) {
|
|
|
145960
145962
|
join_nodes_in_full_plan.clear();
|
|
145961
145963
|
}
|
|
145962
145964
|
if (node->set->count < relations.size()) {
|
|
145963
|
-
join_nodes_in_full_plan.insert(node);
|
|
145965
|
+
join_nodes_in_full_plan.insert(node->set->ToString());
|
|
145964
145966
|
}
|
|
145965
145967
|
UpdateJoinNodesInFullPlan(node->left);
|
|
145966
145968
|
UpdateJoinNodesInFullPlan(node->right);
|
|
@@ -145984,8 +145986,8 @@ JoinNode *JoinOrderOptimizer::EmitPair(JoinRelationSet *left, JoinRelationSet *r
|
|
|
145984
145986
|
if (entry != plans.end()) {
|
|
145985
145987
|
cardinality_estimator.VerifySymmetry(result, entry->second.get());
|
|
145986
145988
|
}
|
|
145987
|
-
|
|
145988
|
-
|
|
145989
|
+
if (full_plan_found &&
|
|
145990
|
+
join_nodes_in_full_plan.find(new_plan->set->ToString()) != join_nodes_in_full_plan.end()) {
|
|
145989
145991
|
must_update_full_plan = true;
|
|
145990
145992
|
}
|
|
145991
145993
|
if (new_set->count == relations.size()) {
|
package/src/duckdb.hpp
CHANGED
|
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
13
|
#define DUCKDB_AMALGAMATION_EXTENDED 1
|
|
14
|
-
#define DUCKDB_SOURCE_ID "
|
|
15
|
-
#define DUCKDB_VERSION "v0.4.1-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "3825e0ee7"
|
|
15
|
+
#define DUCKDB_VERSION "v0.4.1-dev2371"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|