duckdb 0.3.5-dev692.0 → 0.3.5-dev705.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 +7 -0
- package/src/duckdb.cpp +22 -12
- package/src/duckdb.hpp +602 -602
- package/src/parquet-amalgamation.cpp +30897 -30897
- package/src/statement.cpp +2 -1
- package/test/data_type_support.test.js +22 -1
package/package.json
CHANGED
package/src/connection.cpp
CHANGED
|
@@ -363,6 +363,13 @@ struct ExecTask : public Task {
|
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
+
|
|
367
|
+
void Callback() override {
|
|
368
|
+
auto env = object.Env();
|
|
369
|
+
Napi::HandleScope scope(env);
|
|
370
|
+
callback.Value().MakeCallback(object.Value(), {success ? env.Null() : Napi::String::New(env, error)});
|
|
371
|
+
};
|
|
372
|
+
|
|
366
373
|
std::string sql;
|
|
367
374
|
bool success;
|
|
368
375
|
std::string error;
|
package/src/duckdb.cpp
CHANGED
|
@@ -41296,11 +41296,11 @@ inline uint64_t TemplatedHash(const string_t &elem) {
|
|
|
41296
41296
|
data_ptr_t data = (data_ptr_t)elem.GetDataUnsafe();
|
|
41297
41297
|
const auto &len = elem.GetSize();
|
|
41298
41298
|
uint64_t h = 0;
|
|
41299
|
-
for (idx_t i = 0; i
|
|
41299
|
+
for (idx_t i = 0; i + sizeof(uint64_t) <= len; i += sizeof(uint64_t)) {
|
|
41300
41300
|
h ^= TemplatedHash<uint64_t>(Load<uint64_t>(data));
|
|
41301
|
-
data +=
|
|
41301
|
+
data += sizeof(uint64_t);
|
|
41302
41302
|
}
|
|
41303
|
-
switch (len &
|
|
41303
|
+
switch (len & (sizeof(uint64_t) - 1)) {
|
|
41304
41304
|
case 4:
|
|
41305
41305
|
h ^= TemplatedHash<uint32_t>(Load<uint32_t>(data));
|
|
41306
41306
|
break;
|
|
@@ -46260,7 +46260,6 @@ const SelectionVector *ConstantVector::ZeroSelectionVector(idx_t count, Selectio
|
|
|
46260
46260
|
}
|
|
46261
46261
|
|
|
46262
46262
|
void ConstantVector::Reference(Vector &vector, Vector &source, idx_t position, idx_t count) {
|
|
46263
|
-
D_ASSERT(position < count);
|
|
46264
46263
|
auto &source_type = source.GetType();
|
|
46265
46264
|
switch (source_type.InternalType()) {
|
|
46266
46265
|
case PhysicalType::LIST: {
|
|
@@ -46308,7 +46307,7 @@ void ConstantVector::Reference(Vector &vector, Vector &source, idx_t position, i
|
|
|
46308
46307
|
auto &source_entries = StructVector::GetEntries(source);
|
|
46309
46308
|
auto &target_entries = StructVector::GetEntries(vector);
|
|
46310
46309
|
for (idx_t i = 0; i < source_entries.size(); i++) {
|
|
46311
|
-
ConstantVector::Reference(*target_entries[i], *source_entries[i],
|
|
46310
|
+
ConstantVector::Reference(*target_entries[i], *source_entries[i], struct_index, count);
|
|
46312
46311
|
}
|
|
46313
46312
|
vector.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
46314
46313
|
break;
|
|
@@ -51740,6 +51739,7 @@ static inline void TemplatedLoopHash(Vector &input, Vector &result, const Select
|
|
|
51740
51739
|
|
|
51741
51740
|
template <bool HAS_RSEL, bool FIRST_HASH>
|
|
51742
51741
|
static inline void StructLoopHash(Vector &input, Vector &hashes, const SelectionVector *rsel, idx_t count) {
|
|
51742
|
+
input.Normalify(count);
|
|
51743
51743
|
auto &children = StructVector::GetEntries(input);
|
|
51744
51744
|
|
|
51745
51745
|
D_ASSERT(!children.empty());
|
|
@@ -114875,6 +114875,9 @@ void ClientContext::LogQueryInternal(ClientContextLock &, const string &query) {
|
|
|
114875
114875
|
|
|
114876
114876
|
unique_ptr<QueryResult> ClientContext::Query(unique_ptr<SQLStatement> statement, bool allow_stream_result) {
|
|
114877
114877
|
auto pending_query = PendingQuery(move(statement), allow_stream_result);
|
|
114878
|
+
if (!pending_query->success) {
|
|
114879
|
+
return make_unique<MaterializedQueryResult>(pending_query->error);
|
|
114880
|
+
}
|
|
114878
114881
|
return pending_query->Execute();
|
|
114879
114882
|
}
|
|
114880
114883
|
|
|
@@ -181055,6 +181058,8 @@ void BaseStatistics::Verify(Vector &vector, idx_t count) const {
|
|
|
181055
181058
|
|
|
181056
181059
|
|
|
181057
181060
|
|
|
181061
|
+
#include <math.h>
|
|
181062
|
+
|
|
181058
181063
|
namespace duckdb {
|
|
181059
181064
|
|
|
181060
181065
|
DistinctStatistics::DistinctStatistics()
|
|
@@ -181115,7 +181120,7 @@ void DistinctStatistics::Update(VectorData &vdata, const LogicalType &type, idx_
|
|
|
181115
181120
|
return;
|
|
181116
181121
|
}
|
|
181117
181122
|
total_count += count;
|
|
181118
|
-
count =
|
|
181123
|
+
count = MinValue<idx_t>(idx_t(SAMPLE_RATE * MaxValue<idx_t>(STANDARD_VECTOR_SIZE, count)), count);
|
|
181119
181124
|
sample_count += count;
|
|
181120
181125
|
|
|
181121
181126
|
uint64_t indices[STANDARD_VECTOR_SIZE];
|
|
@@ -181133,12 +181138,17 @@ idx_t DistinctStatistics::GetCount() const {
|
|
|
181133
181138
|
if (sample_count == 0 || total_count == 0) {
|
|
181134
181139
|
return 0;
|
|
181135
181140
|
}
|
|
181136
|
-
|
|
181137
|
-
double
|
|
181138
|
-
double
|
|
181139
|
-
double
|
|
181140
|
-
|
|
181141
|
-
|
|
181141
|
+
|
|
181142
|
+
double u = MinValue<idx_t>(log->Count(), sample_count);
|
|
181143
|
+
double s = sample_count;
|
|
181144
|
+
double n = total_count;
|
|
181145
|
+
|
|
181146
|
+
// Assume this proportion of the the sampled values occurred only once
|
|
181147
|
+
double u1 = pow(u / s, 2) * u;
|
|
181148
|
+
|
|
181149
|
+
// Estimate total uniques using Good Turing Estimation
|
|
181150
|
+
idx_t estimate = u + u1 / s * (n - s);
|
|
181151
|
+
return MinValue<idx_t>(estimate, total_count);
|
|
181142
181152
|
}
|
|
181143
181153
|
|
|
181144
181154
|
} // namespace duckdb
|