duckdb 0.4.1-dev2364.0 → 0.4.1-dev2374.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/package.json +1 -1
- package/src/connection.cpp +21 -0
- package/src/duckdb.cpp +12 -32
- package/src/duckdb.hpp +2 -2
- package/src/parquet-amalgamation.cpp +30369 -30369
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/duckdb.cpp
CHANGED
|
@@ -114809,10 +114809,8 @@ typedef unique_ptr<ArrowArrayStreamWrapper> (*stream_factory_produce_t)(uintptr_
|
|
|
114809
114809
|
typedef void (*stream_factory_get_schema_t)(uintptr_t stream_factory_ptr, ArrowSchemaWrapper &schema);
|
|
114810
114810
|
|
|
114811
114811
|
struct ArrowScanFunctionData : public PyTableFunctionData {
|
|
114812
|
-
ArrowScanFunctionData(
|
|
114813
|
-
|
|
114814
|
-
: lines_read(0), rows_per_thread(rows_per_thread_p), stream_factory_ptr(stream_factory_ptr_p),
|
|
114815
|
-
scanner_producer(scanner_producer_p), number_of_rows(0) {
|
|
114812
|
+
ArrowScanFunctionData(stream_factory_produce_t scanner_producer_p, uintptr_t stream_factory_ptr_p)
|
|
114813
|
+
: lines_read(0), stream_factory_ptr(stream_factory_ptr_p), scanner_producer(scanner_producer_p) {
|
|
114816
114814
|
}
|
|
114817
114815
|
//! This holds the original list type (col_idx, [ArrowListType,size])
|
|
114818
114816
|
unordered_map<idx_t, unique_ptr<ArrowConvertData>> arrow_convert_data;
|
|
@@ -114823,8 +114821,6 @@ struct ArrowScanFunctionData : public PyTableFunctionData {
|
|
|
114823
114821
|
uintptr_t stream_factory_ptr;
|
|
114824
114822
|
//! Pointer to the scanner factory produce
|
|
114825
114823
|
stream_factory_produce_t scanner_producer;
|
|
114826
|
-
//! Number of rows (Used in cardinality and progress bar)
|
|
114827
|
-
int64_t number_of_rows;
|
|
114828
114824
|
};
|
|
114829
114825
|
|
|
114830
114826
|
struct ArrowScanLocalState : public LocalTableFunctionState {
|
|
@@ -115080,9 +115076,8 @@ unique_ptr<FunctionData> ArrowTableFunction::ArrowScanBind(ClientContext &contex
|
|
|
115080
115076
|
auto stream_factory_ptr = input.inputs[0].GetPointer();
|
|
115081
115077
|
auto stream_factory_produce = (stream_factory_produce_t)input.inputs[1].GetPointer();
|
|
115082
115078
|
auto stream_factory_get_schema = (stream_factory_get_schema_t)input.inputs[2].GetPointer();
|
|
115083
|
-
auto rows_per_thread = input.inputs[3].GetValue<uint64_t>();
|
|
115084
115079
|
|
|
115085
|
-
auto res = make_unique<ArrowScanFunctionData>(
|
|
115080
|
+
auto res = make_unique<ArrowScanFunctionData>(stream_factory_produce, stream_factory_ptr);
|
|
115086
115081
|
|
|
115087
115082
|
auto &data = *res;
|
|
115088
115083
|
stream_factory_get_schema(stream_factory_ptr, data.schema_root);
|
|
@@ -115127,11 +115122,7 @@ unique_ptr<ArrowArrayStreamWrapper> ProduceArrowScan(const ArrowScanFunctionData
|
|
|
115127
115122
|
}
|
|
115128
115123
|
|
|
115129
115124
|
idx_t ArrowTableFunction::ArrowScanMaxThreads(ClientContext &context, const FunctionData *bind_data_p) {
|
|
115130
|
-
|
|
115131
|
-
if (bind_data.number_of_rows <= 0 || ClientConfig::GetConfig(context).verify_parallelism) {
|
|
115132
|
-
return context.db->NumberOfThreads();
|
|
115133
|
-
}
|
|
115134
|
-
return ((bind_data.number_of_rows + bind_data.rows_per_thread - 1) / bind_data.rows_per_thread) + 1;
|
|
115125
|
+
return context.db->NumberOfThreads();
|
|
115135
115126
|
}
|
|
115136
115127
|
|
|
115137
115128
|
bool ArrowScanParallelStateNext(ClientContext &context, const FunctionData *bind_data_p, ArrowScanLocalState &state,
|
|
@@ -115197,28 +115188,15 @@ void ArrowTableFunction::ArrowScanFunction(ClientContext &context, TableFunction
|
|
|
115197
115188
|
}
|
|
115198
115189
|
|
|
115199
115190
|
unique_ptr<NodeStatistics> ArrowTableFunction::ArrowScanCardinality(ClientContext &context, const FunctionData *data) {
|
|
115200
|
-
|
|
115201
|
-
return make_unique<NodeStatistics>(bind_data.number_of_rows, bind_data.number_of_rows);
|
|
115202
|
-
}
|
|
115203
|
-
|
|
115204
|
-
double ArrowTableFunction::ArrowProgress(ClientContext &context, const FunctionData *bind_data_p,
|
|
115205
|
-
const GlobalTableFunctionState *global_state) {
|
|
115206
|
-
auto &bind_data = (const ArrowScanFunctionData &)*bind_data_p;
|
|
115207
|
-
if (bind_data.number_of_rows == 0) {
|
|
115208
|
-
return 100;
|
|
115209
|
-
}
|
|
115210
|
-
auto percentage = bind_data.lines_read * 100.0 / bind_data.number_of_rows;
|
|
115211
|
-
return percentage;
|
|
115191
|
+
return make_unique<NodeStatistics>();
|
|
115212
115192
|
}
|
|
115213
115193
|
|
|
115214
115194
|
void ArrowTableFunction::RegisterFunction(BuiltinFunctions &set) {
|
|
115215
|
-
TableFunction arrow("arrow_scan",
|
|
115216
|
-
{LogicalType::POINTER, LogicalType::POINTER, LogicalType::POINTER, LogicalType::UBIGINT},
|
|
115195
|
+
TableFunction arrow("arrow_scan", {LogicalType::POINTER, LogicalType::POINTER, LogicalType::POINTER},
|
|
115217
115196
|
ArrowScanFunction, ArrowScanBind, ArrowScanInitGlobal, ArrowScanInitLocal);
|
|
115218
115197
|
arrow.cardinality = ArrowScanCardinality;
|
|
115219
115198
|
arrow.projection_pushdown = true;
|
|
115220
115199
|
arrow.filter_pushdown = true;
|
|
115221
|
-
arrow.table_scan_progress = ArrowProgress;
|
|
115222
115200
|
set.AddFunction(arrow);
|
|
115223
115201
|
}
|
|
115224
115202
|
|
|
@@ -141850,7 +141828,7 @@ private:
|
|
|
141850
141828
|
|
|
141851
141829
|
bool full_plan_found;
|
|
141852
141830
|
bool must_update_full_plan;
|
|
141853
|
-
unordered_set<
|
|
141831
|
+
unordered_set<std::string> join_nodes_in_full_plan;
|
|
141854
141832
|
|
|
141855
141833
|
//! Extract the bindings referred to by an Expression
|
|
141856
141834
|
bool ExtractBindings(Expression &expression, unordered_set<idx_t> &bindings);
|
|
@@ -142161,6 +142139,8 @@ double CardinalityEstimator::EstimateCardinalityWithSet(JoinRelationSet *new_set
|
|
|
142161
142139
|
}
|
|
142162
142140
|
}
|
|
142163
142141
|
double denom = 1;
|
|
142142
|
+
// TODO: It's possible cross-products were added and are not present in the filters in the relation_2_tdom
|
|
142143
|
+
// structures. When that's the case, multiply the denom structures that have no intersection
|
|
142164
142144
|
for (auto &match : subgraphs) {
|
|
142165
142145
|
// It's possible that in production, one of the D_ASSERTS above will fail and not all subgraphs
|
|
142166
142146
|
// were connected. When this happens, just use the largest denominator of all the subgraphs.
|
|
@@ -145960,7 +145940,7 @@ void JoinOrderOptimizer::UpdateJoinNodesInFullPlan(JoinNode *node) {
|
|
|
145960
145940
|
join_nodes_in_full_plan.clear();
|
|
145961
145941
|
}
|
|
145962
145942
|
if (node->set->count < relations.size()) {
|
|
145963
|
-
join_nodes_in_full_plan.insert(node);
|
|
145943
|
+
join_nodes_in_full_plan.insert(node->set->ToString());
|
|
145964
145944
|
}
|
|
145965
145945
|
UpdateJoinNodesInFullPlan(node->left);
|
|
145966
145946
|
UpdateJoinNodesInFullPlan(node->right);
|
|
@@ -145984,8 +145964,8 @@ JoinNode *JoinOrderOptimizer::EmitPair(JoinRelationSet *left, JoinRelationSet *r
|
|
|
145984
145964
|
if (entry != plans.end()) {
|
|
145985
145965
|
cardinality_estimator.VerifySymmetry(result, entry->second.get());
|
|
145986
145966
|
}
|
|
145987
|
-
|
|
145988
|
-
|
|
145967
|
+
if (full_plan_found &&
|
|
145968
|
+
join_nodes_in_full_plan.find(new_plan->set->ToString()) != join_nodes_in_full_plan.end()) {
|
|
145989
145969
|
must_update_full_plan = true;
|
|
145990
145970
|
}
|
|
145991
145971
|
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 "0d2d7930d"
|
|
15
|
+
#define DUCKDB_VERSION "v0.4.1-dev2374"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|