duckdb 0.3.3-dev117.0 → 0.3.3-dev153.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/duckdb.cpp +141 -63
- package/src/duckdb.hpp +2 -2
- package/src/parquet-amalgamation.cpp +36544 -36544
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -42519,12 +42519,18 @@ void VectorOperations::Copy(const Vector &source, Vector &target, idx_t source_c
|
|
|
42519
42519
|
namespace duckdb {
|
|
42520
42520
|
|
|
42521
42521
|
struct HashOp {
|
|
42522
|
+
static const hash_t NULL_HASH = 0xbf58476d1ce4e5b9;
|
|
42523
|
+
|
|
42522
42524
|
template <class T>
|
|
42523
42525
|
static inline hash_t Operation(T input, bool is_null) {
|
|
42524
|
-
return
|
|
42526
|
+
return is_null ? NULL_HASH : duckdb::Hash<T>(input);
|
|
42525
42527
|
}
|
|
42526
42528
|
};
|
|
42527
42529
|
|
|
42530
|
+
static inline hash_t CombineHashScalar(hash_t a, hash_t b) {
|
|
42531
|
+
return (a * UINT64_C(0xbf58476d1ce4e5b9)) ^ b;
|
|
42532
|
+
}
|
|
42533
|
+
|
|
42528
42534
|
template <bool HAS_RSEL, class T>
|
|
42529
42535
|
static inline void TightLoopHash(T *__restrict ldata, hash_t *__restrict result_data, const SelectionVector *rsel,
|
|
42530
42536
|
idx_t count, const SelectionVector *__restrict sel_vector, ValidityMask &mask) {
|
|
@@ -42566,7 +42572,7 @@ template <bool HAS_RSEL, bool FIRST_HASH>
|
|
|
42566
42572
|
static inline void StructLoopHash(Vector &input, Vector &hashes, const SelectionVector *rsel, idx_t count) {
|
|
42567
42573
|
auto &children = StructVector::GetEntries(input);
|
|
42568
42574
|
|
|
42569
|
-
D_ASSERT(children.
|
|
42575
|
+
D_ASSERT(!children.empty());
|
|
42570
42576
|
idx_t col_no = 0;
|
|
42571
42577
|
if (HAS_RSEL) {
|
|
42572
42578
|
if (FIRST_HASH) {
|
|
@@ -42596,14 +42602,81 @@ static inline void ListLoopHash(Vector &input, Vector &hashes, const SelectionVe
|
|
|
42596
42602
|
VectorData idata;
|
|
42597
42603
|
input.Orrify(count, idata);
|
|
42598
42604
|
const auto ldata = (const list_entry_t *)idata.data;
|
|
42599
|
-
|
|
42605
|
+
|
|
42606
|
+
// Hash the children into a temporary
|
|
42607
|
+
auto &child = ListVector::GetEntry(input);
|
|
42608
|
+
const auto child_count = ListVector::GetListSize(input);
|
|
42609
|
+
|
|
42610
|
+
Vector child_hashes(LogicalType::HASH, child_count);
|
|
42611
|
+
VectorOperations::Hash(child, child_hashes, child_count);
|
|
42612
|
+
auto chdata = FlatVector::GetData<hash_t>(child_hashes);
|
|
42613
|
+
|
|
42614
|
+
// Reduce the number of entries to check to the non-empty ones
|
|
42615
|
+
SelectionVector unprocessed(count);
|
|
42616
|
+
SelectionVector cursor(HAS_RSEL ? STANDARD_VECTOR_SIZE : count);
|
|
42617
|
+
idx_t remaining = 0;
|
|
42618
|
+
for (idx_t i = 0; i < count; ++i) {
|
|
42600
42619
|
const idx_t ridx = HAS_RSEL ? rsel->get_index(i) : i;
|
|
42601
42620
|
const auto lidx = idata.sel->get_index(ridx);
|
|
42602
42621
|
const auto &entry = ldata[lidx];
|
|
42603
|
-
if (idata.validity.RowIsValid(lidx)) {
|
|
42604
|
-
|
|
42605
|
-
|
|
42606
|
-
|
|
42622
|
+
if (idata.validity.RowIsValid(lidx) && entry.length > 0) {
|
|
42623
|
+
unprocessed.set_index(remaining++, ridx);
|
|
42624
|
+
cursor.set_index(ridx, entry.offset);
|
|
42625
|
+
} else if (FIRST_HASH) {
|
|
42626
|
+
hdata[ridx] = HashOp::NULL_HASH;
|
|
42627
|
+
}
|
|
42628
|
+
// Empty or NULL non-first elements have no effect.
|
|
42629
|
+
}
|
|
42630
|
+
|
|
42631
|
+
count = remaining;
|
|
42632
|
+
if (count == 0) {
|
|
42633
|
+
return;
|
|
42634
|
+
}
|
|
42635
|
+
|
|
42636
|
+
// Merge the first position hash into the main hash
|
|
42637
|
+
idx_t position = 1;
|
|
42638
|
+
if (FIRST_HASH) {
|
|
42639
|
+
remaining = 0;
|
|
42640
|
+
for (idx_t i = 0; i < count; ++i) {
|
|
42641
|
+
const auto ridx = unprocessed.get_index(i);
|
|
42642
|
+
const auto cidx = cursor.get_index(ridx);
|
|
42643
|
+
hdata[ridx] = chdata[cidx];
|
|
42644
|
+
|
|
42645
|
+
const auto lidx = idata.sel->get_index(ridx);
|
|
42646
|
+
const auto &entry = ldata[lidx];
|
|
42647
|
+
if (entry.length > position) {
|
|
42648
|
+
// Entry still has values to hash
|
|
42649
|
+
unprocessed.set_index(remaining++, ridx);
|
|
42650
|
+
cursor.set_index(ridx, cidx + 1);
|
|
42651
|
+
}
|
|
42652
|
+
}
|
|
42653
|
+
count = remaining;
|
|
42654
|
+
if (count == 0) {
|
|
42655
|
+
return;
|
|
42656
|
+
}
|
|
42657
|
+
++position;
|
|
42658
|
+
}
|
|
42659
|
+
|
|
42660
|
+
// Combine the hashes for the remaining positions until there are none left
|
|
42661
|
+
for (;; ++position) {
|
|
42662
|
+
remaining = 0;
|
|
42663
|
+
for (idx_t i = 0; i < count; ++i) {
|
|
42664
|
+
const auto ridx = unprocessed.get_index(i);
|
|
42665
|
+
const auto cidx = cursor.get_index(ridx);
|
|
42666
|
+
hdata[ridx] = CombineHashScalar(hdata[ridx], chdata[cidx]);
|
|
42667
|
+
|
|
42668
|
+
const auto lidx = idata.sel->get_index(ridx);
|
|
42669
|
+
const auto &entry = ldata[lidx];
|
|
42670
|
+
if (entry.length > position) {
|
|
42671
|
+
// Entry still has values to hash
|
|
42672
|
+
unprocessed.set_index(remaining++, ridx);
|
|
42673
|
+
cursor.set_index(ridx, cidx + 1);
|
|
42674
|
+
}
|
|
42675
|
+
}
|
|
42676
|
+
|
|
42677
|
+
count = remaining;
|
|
42678
|
+
if (count == 0) {
|
|
42679
|
+
break;
|
|
42607
42680
|
}
|
|
42608
42681
|
}
|
|
42609
42682
|
}
|
|
@@ -42672,10 +42745,6 @@ void VectorOperations::Hash(Vector &input, Vector &result, const SelectionVector
|
|
|
42672
42745
|
HashTypeSwitch<true>(input, result, &sel, count);
|
|
42673
42746
|
}
|
|
42674
42747
|
|
|
42675
|
-
static inline hash_t CombineHashScalar(hash_t a, hash_t b) {
|
|
42676
|
-
return (a * UINT64_C(0xbf58476d1ce4e5b9)) ^ b;
|
|
42677
|
-
}
|
|
42678
|
-
|
|
42679
42748
|
template <bool HAS_RSEL, class T>
|
|
42680
42749
|
static inline void TightLoopCombineHashConstant(T *__restrict ldata, hash_t constant_hash, hash_t *__restrict hash_data,
|
|
42681
42750
|
const SelectionVector *rsel, idx_t count,
|
|
@@ -80230,6 +80299,10 @@ struct AliasFun {
|
|
|
80230
80299
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
80231
80300
|
};
|
|
80232
80301
|
|
|
80302
|
+
struct HashFun {
|
|
80303
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
80304
|
+
};
|
|
80305
|
+
|
|
80233
80306
|
struct LeastFun {
|
|
80234
80307
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
80235
80308
|
};
|
|
@@ -80431,6 +80504,21 @@ void CurrentSettingFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
80431
80504
|
} // namespace duckdb
|
|
80432
80505
|
|
|
80433
80506
|
|
|
80507
|
+
namespace duckdb {
|
|
80508
|
+
|
|
80509
|
+
static void HashFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
80510
|
+
args.Hash(result);
|
|
80511
|
+
}
|
|
80512
|
+
|
|
80513
|
+
void HashFun::RegisterFunction(BuiltinFunctions &set) {
|
|
80514
|
+
auto hash_fun = ScalarFunction("hash", {LogicalType::ANY}, LogicalType::HASH, HashFunction);
|
|
80515
|
+
hash_fun.varargs = LogicalType::ANY;
|
|
80516
|
+
set.AddFunction(hash_fun);
|
|
80517
|
+
}
|
|
80518
|
+
|
|
80519
|
+
} // namespace duckdb
|
|
80520
|
+
|
|
80521
|
+
|
|
80434
80522
|
|
|
80435
80523
|
namespace duckdb {
|
|
80436
80524
|
|
|
@@ -80631,6 +80719,7 @@ namespace duckdb {
|
|
|
80631
80719
|
|
|
80632
80720
|
void BuiltinFunctions::RegisterGenericFunctions() {
|
|
80633
80721
|
Register<AliasFun>();
|
|
80722
|
+
Register<HashFun>();
|
|
80634
80723
|
Register<LeastFun>();
|
|
80635
80724
|
Register<GreatestFun>();
|
|
80636
80725
|
Register<StatsFun>();
|
|
@@ -81085,59 +81174,48 @@ void ListExtractTemplate(idx_t count, VectorData &list_data, VectorData &offsets
|
|
|
81085
81174
|
static void ExecuteListExtractInternal(const idx_t count, VectorData &list, VectorData &offsets, Vector &child_vector,
|
|
81086
81175
|
idx_t list_size, Vector &result) {
|
|
81087
81176
|
D_ASSERT(child_vector.GetType() == result.GetType());
|
|
81088
|
-
switch (result.GetType().
|
|
81089
|
-
case
|
|
81090
|
-
|
|
81091
|
-
break;
|
|
81092
|
-
case LogicalTypeId::TINYINT:
|
|
81177
|
+
switch (result.GetType().InternalType()) {
|
|
81178
|
+
case PhysicalType::BOOL:
|
|
81179
|
+
case PhysicalType::INT8:
|
|
81093
81180
|
ListExtractTemplate<int8_t>(count, list, offsets, child_vector, list_size, result);
|
|
81094
81181
|
break;
|
|
81095
|
-
case
|
|
81096
|
-
ListExtractTemplate<uint16_t>(count, list, offsets, child_vector, list_size, result);
|
|
81097
|
-
break;
|
|
81098
|
-
case LogicalTypeId::SMALLINT:
|
|
81182
|
+
case PhysicalType::INT16:
|
|
81099
81183
|
ListExtractTemplate<int16_t>(count, list, offsets, child_vector, list_size, result);
|
|
81100
81184
|
break;
|
|
81101
|
-
case
|
|
81102
|
-
ListExtractTemplate<uint32_t>(count, list, offsets, child_vector, list_size, result);
|
|
81103
|
-
break;
|
|
81104
|
-
case LogicalTypeId::INTEGER:
|
|
81185
|
+
case PhysicalType::INT32:
|
|
81105
81186
|
ListExtractTemplate<int32_t>(count, list, offsets, child_vector, list_size, result);
|
|
81106
81187
|
break;
|
|
81107
|
-
case
|
|
81108
|
-
ListExtractTemplate<uint64_t>(count, list, offsets, child_vector, list_size, result);
|
|
81109
|
-
break;
|
|
81110
|
-
case LogicalTypeId::BIGINT:
|
|
81188
|
+
case PhysicalType::INT64:
|
|
81111
81189
|
ListExtractTemplate<int64_t>(count, list, offsets, child_vector, list_size, result);
|
|
81112
81190
|
break;
|
|
81113
|
-
case
|
|
81191
|
+
case PhysicalType::INT128:
|
|
81114
81192
|
ListExtractTemplate<hugeint_t>(count, list, offsets, child_vector, list_size, result);
|
|
81115
81193
|
break;
|
|
81116
|
-
case
|
|
81117
|
-
ListExtractTemplate<
|
|
81194
|
+
case PhysicalType::UINT8:
|
|
81195
|
+
ListExtractTemplate<uint8_t>(count, list, offsets, child_vector, list_size, result);
|
|
81118
81196
|
break;
|
|
81119
|
-
case
|
|
81120
|
-
ListExtractTemplate<
|
|
81197
|
+
case PhysicalType::UINT16:
|
|
81198
|
+
ListExtractTemplate<uint16_t>(count, list, offsets, child_vector, list_size, result);
|
|
81121
81199
|
break;
|
|
81122
|
-
case
|
|
81123
|
-
ListExtractTemplate<
|
|
81200
|
+
case PhysicalType::UINT32:
|
|
81201
|
+
ListExtractTemplate<uint32_t>(count, list, offsets, child_vector, list_size, result);
|
|
81124
81202
|
break;
|
|
81125
|
-
case
|
|
81126
|
-
|
|
81127
|
-
ListExtractTemplate<dtime_t>(count, list, offsets, child_vector, list_size, result);
|
|
81203
|
+
case PhysicalType::UINT64:
|
|
81204
|
+
ListExtractTemplate<uint64_t>(count, list, offsets, child_vector, list_size, result);
|
|
81128
81205
|
break;
|
|
81129
|
-
case
|
|
81130
|
-
|
|
81131
|
-
ListExtractTemplate<timestamp_t>(count, list, offsets, child_vector, list_size, result);
|
|
81206
|
+
case PhysicalType::FLOAT:
|
|
81207
|
+
ListExtractTemplate<float>(count, list, offsets, child_vector, list_size, result);
|
|
81132
81208
|
break;
|
|
81133
|
-
case
|
|
81134
|
-
|
|
81209
|
+
case PhysicalType::DOUBLE:
|
|
81210
|
+
ListExtractTemplate<double>(count, list, offsets, child_vector, list_size, result);
|
|
81211
|
+
break;
|
|
81212
|
+
case PhysicalType::VARCHAR:
|
|
81135
81213
|
ListExtractTemplate<string_t, true>(count, list, offsets, child_vector, list_size, result);
|
|
81136
81214
|
break;
|
|
81137
|
-
case
|
|
81138
|
-
result
|
|
81215
|
+
case PhysicalType::INTERVAL:
|
|
81216
|
+
ListExtractTemplate<interval_t>(count, list, offsets, child_vector, list_size, result);
|
|
81139
81217
|
break;
|
|
81140
|
-
case
|
|
81218
|
+
case PhysicalType::STRUCT: {
|
|
81141
81219
|
auto &entries = StructVector::GetEntries(child_vector);
|
|
81142
81220
|
auto &result_entries = StructVector::GetEntries(result);
|
|
81143
81221
|
D_ASSERT(entries.size() == result_entries.size());
|
|
@@ -81149,7 +81227,7 @@ static void ExecuteListExtractInternal(const idx_t count, VectorData &list, Vect
|
|
|
81149
81227
|
ListExtractTemplate<bool, false, true>(count, list, offsets, child_vector, list_size, result);
|
|
81150
81228
|
break;
|
|
81151
81229
|
}
|
|
81152
|
-
case
|
|
81230
|
+
case PhysicalType::LIST: {
|
|
81153
81231
|
// nested list: we have to reference the child
|
|
81154
81232
|
auto &child_child_list = ListVector::GetEntry(child_vector);
|
|
81155
81233
|
|
|
@@ -101749,35 +101827,35 @@ void DuckDB::SetExtensionLoaded(const std::string &name) {
|
|
|
101749
101827
|
|
|
101750
101828
|
|
|
101751
101829
|
|
|
101752
|
-
#
|
|
101830
|
+
#if defined(BUILD_ICU_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101753
101831
|
#include "icu-extension.hpp"
|
|
101754
101832
|
#endif
|
|
101755
101833
|
|
|
101756
|
-
#
|
|
101834
|
+
#if defined(BUILD_PARQUET_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101757
101835
|
#include "parquet-extension.hpp"
|
|
101758
101836
|
#endif
|
|
101759
101837
|
|
|
101760
|
-
#
|
|
101838
|
+
#if defined(BUILD_TPCH_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101761
101839
|
#include "tpch-extension.hpp"
|
|
101762
101840
|
#endif
|
|
101763
101841
|
|
|
101764
|
-
#
|
|
101842
|
+
#if defined(BUILD_TPCDS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101765
101843
|
#include "tpcds-extension.hpp"
|
|
101766
101844
|
#endif
|
|
101767
101845
|
|
|
101768
|
-
#
|
|
101846
|
+
#if defined(BUILD_FTS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101769
101847
|
#include "fts-extension.hpp"
|
|
101770
101848
|
#endif
|
|
101771
101849
|
|
|
101772
|
-
#
|
|
101850
|
+
#if defined(BUILD_HTTPFS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101773
101851
|
#include "httpfs-extension.hpp"
|
|
101774
101852
|
#endif
|
|
101775
101853
|
|
|
101776
|
-
#
|
|
101854
|
+
#if defined(BUILD_VISUALIZER_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101777
101855
|
#include "visualizer-extension.hpp"
|
|
101778
101856
|
#endif
|
|
101779
101857
|
|
|
101780
|
-
#
|
|
101858
|
+
#if defined(BUILD_EXCEL_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101781
101859
|
#include "excel-extension.hpp"
|
|
101782
101860
|
#endif
|
|
101783
101861
|
|
|
@@ -101816,55 +101894,55 @@ ExtensionLoadResult ExtensionHelper::LoadExtensionInternal(DuckDB &db, const std
|
|
|
101816
101894
|
}
|
|
101817
101895
|
#endif
|
|
101818
101896
|
if (extension == "parquet") {
|
|
101819
|
-
#
|
|
101897
|
+
#if defined(BUILD_PARQUET_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101820
101898
|
db.LoadExtension<ParquetExtension>();
|
|
101821
101899
|
#else
|
|
101822
101900
|
// parquet extension required but not build: skip this test
|
|
101823
101901
|
return ExtensionLoadResult::NOT_LOADED;
|
|
101824
101902
|
#endif
|
|
101825
101903
|
} else if (extension == "icu") {
|
|
101826
|
-
#
|
|
101904
|
+
#if defined(BUILD_ICU_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101827
101905
|
db.LoadExtension<ICUExtension>();
|
|
101828
101906
|
#else
|
|
101829
101907
|
// icu extension required but not build: skip this test
|
|
101830
101908
|
return ExtensionLoadResult::NOT_LOADED;
|
|
101831
101909
|
#endif
|
|
101832
101910
|
} else if (extension == "tpch") {
|
|
101833
|
-
#
|
|
101911
|
+
#if defined(BUILD_TPCH_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101834
101912
|
db.LoadExtension<TPCHExtension>();
|
|
101835
101913
|
#else
|
|
101836
101914
|
// icu extension required but not build: skip this test
|
|
101837
101915
|
return ExtensionLoadResult::NOT_LOADED;
|
|
101838
101916
|
#endif
|
|
101839
101917
|
} else if (extension == "tpcds") {
|
|
101840
|
-
#
|
|
101918
|
+
#if defined(BUILD_TPCDS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101841
101919
|
db.LoadExtension<TPCDSExtension>();
|
|
101842
101920
|
#else
|
|
101843
101921
|
// icu extension required but not build: skip this test
|
|
101844
101922
|
return ExtensionLoadResult::NOT_LOADED;
|
|
101845
101923
|
#endif
|
|
101846
101924
|
} else if (extension == "fts") {
|
|
101847
|
-
#
|
|
101925
|
+
#if defined(BUILD_FTS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101848
101926
|
db.LoadExtension<FTSExtension>();
|
|
101849
101927
|
#else
|
|
101850
101928
|
// fts extension required but not build: skip this test
|
|
101851
101929
|
return ExtensionLoadResult::NOT_LOADED;
|
|
101852
101930
|
#endif
|
|
101853
101931
|
} else if (extension == "httpfs") {
|
|
101854
|
-
#
|
|
101932
|
+
#if defined(BUILD_HTTPFS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101855
101933
|
db.LoadExtension<HTTPFsExtension>();
|
|
101856
101934
|
#else
|
|
101857
101935
|
return ExtensionLoadResult::NOT_LOADED;
|
|
101858
101936
|
#endif
|
|
101859
101937
|
} else if (extension == "visualizer") {
|
|
101860
|
-
#
|
|
101938
|
+
#if defined(BUILD_VISUALIZER_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101861
101939
|
db.LoadExtension<VisualizerExtension>();
|
|
101862
101940
|
#else
|
|
101863
101941
|
// visualizer extension required but not build: skip this test
|
|
101864
101942
|
return ExtensionLoadResult::NOT_LOADED;
|
|
101865
101943
|
#endif
|
|
101866
101944
|
} else if (extension == "excel") {
|
|
101867
|
-
#
|
|
101945
|
+
#if defined(BUILD_EXCEL_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS)
|
|
101868
101946
|
db.LoadExtension<EXCELExtension>();
|
|
101869
101947
|
#else
|
|
101870
101948
|
// excel extension required but not build: skip this test
|
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.3.3-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "16069e3be"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.3-dev153"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|