duckdb 0.3.5-dev346.0 → 0.3.5-dev355.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 +99 -50
- package/src/duckdb.hpp +2 -2
- package/src/parquet-amalgamation.cpp +23134 -23134
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -83676,7 +83676,7 @@ struct HistogramFun {
|
|
|
83676
83676
|
|
|
83677
83677
|
namespace duckdb {
|
|
83678
83678
|
|
|
83679
|
-
struct
|
|
83679
|
+
struct HistogramFunctor {
|
|
83680
83680
|
template <class T, class MAP_TYPE = map<T, idx_t>>
|
|
83681
83681
|
static void HistogramUpdate(VectorData &sdata, VectorData &input_data, idx_t count) {
|
|
83682
83682
|
|
|
@@ -83692,9 +83692,14 @@ struct HistogramUpdateFunctor {
|
|
|
83692
83692
|
}
|
|
83693
83693
|
}
|
|
83694
83694
|
}
|
|
83695
|
+
|
|
83696
|
+
template <class T>
|
|
83697
|
+
static Value HistogramFinalize(T first) {
|
|
83698
|
+
return Value::CreateValue(first);
|
|
83699
|
+
}
|
|
83695
83700
|
};
|
|
83696
83701
|
|
|
83697
|
-
struct
|
|
83702
|
+
struct HistogramStringFunctor {
|
|
83698
83703
|
template <class T, class MAP_TYPE = map<T, idx_t>>
|
|
83699
83704
|
static void HistogramUpdate(VectorData &sdata, VectorData &input_data, idx_t count) {
|
|
83700
83705
|
|
|
@@ -83710,6 +83715,12 @@ struct HistogramStringUpdateFunctor {
|
|
|
83710
83715
|
}
|
|
83711
83716
|
}
|
|
83712
83717
|
}
|
|
83718
|
+
|
|
83719
|
+
template <class T>
|
|
83720
|
+
static Value HistogramFinalize(T first) {
|
|
83721
|
+
string_t value = first;
|
|
83722
|
+
return Value::CreateValue(value);
|
|
83723
|
+
}
|
|
83713
83724
|
};
|
|
83714
83725
|
|
|
83715
83726
|
struct HistogramFunction {
|
|
@@ -83770,8 +83781,8 @@ static void HistogramCombineFunction(Vector &state, Vector &combined, FunctionDa
|
|
|
83770
83781
|
}
|
|
83771
83782
|
}
|
|
83772
83783
|
|
|
83773
|
-
template <class T, class MAP_TYPE>
|
|
83774
|
-
static void
|
|
83784
|
+
template <class OP, class T, class MAP_TYPE>
|
|
83785
|
+
static void HistogramFinalizeFunction(Vector &state_vector, FunctionData *, Vector &result, idx_t count, idx_t offset) {
|
|
83775
83786
|
|
|
83776
83787
|
VectorData sdata;
|
|
83777
83788
|
state_vector.Orrify(count, sdata);
|
|
@@ -83787,7 +83798,9 @@ static void HistogramFinalize(Vector &state_vector, FunctionData *, Vector &resu
|
|
|
83787
83798
|
|
|
83788
83799
|
auto &bucket_validity = FlatVector::Validity(*bucket_list);
|
|
83789
83800
|
auto &count_validity = FlatVector::Validity(*count_list);
|
|
83801
|
+
|
|
83790
83802
|
for (idx_t i = 0; i < count; i++) {
|
|
83803
|
+
|
|
83791
83804
|
const auto rid = i + offset;
|
|
83792
83805
|
auto state = states[sdata.sel->get_index(i)];
|
|
83793
83806
|
if (!state->hist) {
|
|
@@ -83796,12 +83809,14 @@ static void HistogramFinalize(Vector &state_vector, FunctionData *, Vector &resu
|
|
|
83796
83809
|
count_validity.SetInvalid(rid);
|
|
83797
83810
|
continue;
|
|
83798
83811
|
}
|
|
83812
|
+
|
|
83799
83813
|
for (auto &entry : *state->hist) {
|
|
83800
|
-
|
|
83814
|
+
Value bucket_value = OP::template HistogramFinalize<T>(entry.first);
|
|
83801
83815
|
ListVector::PushBack(*bucket_list, bucket_value);
|
|
83802
83816
|
auto count_value = Value::CreateValue(entry.second);
|
|
83803
83817
|
ListVector::PushBack(*count_list, count_value);
|
|
83804
83818
|
}
|
|
83819
|
+
|
|
83805
83820
|
auto list_struct_data = FlatVector::GetData<list_entry_t>(*bucket_list);
|
|
83806
83821
|
list_struct_data[rid].length = ListVector::GetListSize(*bucket_list) - old_len;
|
|
83807
83822
|
list_struct_data[rid].offset = old_len;
|
|
@@ -83834,7 +83849,7 @@ static AggregateFunction GetHistogramFunction(const LogicalType &type) {
|
|
|
83834
83849
|
return AggregateFunction("histogram", {type}, LogicalTypeId::MAP, AggregateFunction::StateSize<STATE_TYPE>,
|
|
83835
83850
|
AggregateFunction::StateInitialize<STATE_TYPE, HistogramFunction>,
|
|
83836
83851
|
HistogramUpdateFunction<OP, T, MAP_TYPE>, HistogramCombineFunction<T, MAP_TYPE>,
|
|
83837
|
-
|
|
83852
|
+
HistogramFinalizeFunction<OP, T, MAP_TYPE>, nullptr, HistogramBindFunction,
|
|
83838
83853
|
AggregateFunction::StateDestroy<STATE_TYPE, HistogramFunction>);
|
|
83839
83854
|
}
|
|
83840
83855
|
|
|
@@ -83852,45 +83867,45 @@ AggregateFunction GetHistogramFunction(const LogicalType &type) {
|
|
|
83852
83867
|
|
|
83853
83868
|
switch (type.id()) {
|
|
83854
83869
|
case LogicalType::BOOLEAN:
|
|
83855
|
-
return GetMapType<
|
|
83870
|
+
return GetMapType<HistogramFunctor, bool, IS_ORDERED>(type);
|
|
83856
83871
|
case LogicalType::UTINYINT:
|
|
83857
|
-
return GetMapType<
|
|
83872
|
+
return GetMapType<HistogramFunctor, uint8_t, IS_ORDERED>(type);
|
|
83858
83873
|
case LogicalType::USMALLINT:
|
|
83859
|
-
return GetMapType<
|
|
83874
|
+
return GetMapType<HistogramFunctor, uint16_t, IS_ORDERED>(type);
|
|
83860
83875
|
case LogicalType::UINTEGER:
|
|
83861
|
-
return GetMapType<
|
|
83876
|
+
return GetMapType<HistogramFunctor, uint32_t, IS_ORDERED>(type);
|
|
83862
83877
|
case LogicalType::UBIGINT:
|
|
83863
|
-
return GetMapType<
|
|
83878
|
+
return GetMapType<HistogramFunctor, uint64_t, IS_ORDERED>(type);
|
|
83864
83879
|
case LogicalType::TINYINT:
|
|
83865
|
-
return GetMapType<
|
|
83880
|
+
return GetMapType<HistogramFunctor, int8_t, IS_ORDERED>(type);
|
|
83866
83881
|
case LogicalType::SMALLINT:
|
|
83867
|
-
return GetMapType<
|
|
83882
|
+
return GetMapType<HistogramFunctor, int16_t, IS_ORDERED>(type);
|
|
83868
83883
|
case LogicalType::INTEGER:
|
|
83869
|
-
return GetMapType<
|
|
83884
|
+
return GetMapType<HistogramFunctor, int32_t, IS_ORDERED>(type);
|
|
83870
83885
|
case LogicalType::BIGINT:
|
|
83871
|
-
return GetMapType<
|
|
83886
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83872
83887
|
case LogicalType::FLOAT:
|
|
83873
|
-
return GetMapType<
|
|
83888
|
+
return GetMapType<HistogramFunctor, float, IS_ORDERED>(type);
|
|
83874
83889
|
case LogicalType::DOUBLE:
|
|
83875
|
-
return GetMapType<
|
|
83890
|
+
return GetMapType<HistogramFunctor, double, IS_ORDERED>(type);
|
|
83876
83891
|
case LogicalType::VARCHAR:
|
|
83877
|
-
return GetMapType<
|
|
83892
|
+
return GetMapType<HistogramStringFunctor, string, IS_ORDERED>(type);
|
|
83878
83893
|
case LogicalType::TIMESTAMP:
|
|
83879
|
-
return GetMapType<
|
|
83894
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83880
83895
|
case LogicalType::TIMESTAMP_TZ:
|
|
83881
|
-
return GetMapType<
|
|
83896
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83882
83897
|
case LogicalType::TIMESTAMP_S:
|
|
83883
|
-
return GetMapType<
|
|
83898
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83884
83899
|
case LogicalType::TIMESTAMP_MS:
|
|
83885
|
-
return GetMapType<
|
|
83900
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83886
83901
|
case LogicalType::TIMESTAMP_NS:
|
|
83887
|
-
return GetMapType<
|
|
83902
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83888
83903
|
case LogicalType::TIME:
|
|
83889
|
-
return GetMapType<
|
|
83904
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83890
83905
|
case LogicalType::TIME_TZ:
|
|
83891
|
-
return GetMapType<
|
|
83906
|
+
return GetMapType<HistogramFunctor, int64_t, IS_ORDERED>(type);
|
|
83892
83907
|
case LogicalType::DATE:
|
|
83893
|
-
return GetMapType<
|
|
83908
|
+
return GetMapType<HistogramFunctor, int32_t, IS_ORDERED>(type);
|
|
83894
83909
|
default:
|
|
83895
83910
|
throw InternalException("Unimplemented histogram aggregate");
|
|
83896
83911
|
}
|
|
@@ -92358,14 +92373,29 @@ struct StateVector {
|
|
|
92358
92373
|
Vector state_vector;
|
|
92359
92374
|
};
|
|
92360
92375
|
|
|
92376
|
+
struct FinalizeValueFunctor {
|
|
92377
|
+
template <class T>
|
|
92378
|
+
static Value FinalizeValue(T first) {
|
|
92379
|
+
return Value::CreateValue(first);
|
|
92380
|
+
}
|
|
92381
|
+
};
|
|
92382
|
+
|
|
92383
|
+
struct FinalizeStringValueFunctor {
|
|
92384
|
+
template <class T>
|
|
92385
|
+
static Value FinalizeValue(T first) {
|
|
92386
|
+
string_t value = first;
|
|
92387
|
+
return Value::CreateValue(value);
|
|
92388
|
+
}
|
|
92389
|
+
};
|
|
92390
|
+
|
|
92361
92391
|
struct AggregateFunctor {
|
|
92362
|
-
template <class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92392
|
+
template <class OP, class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92363
92393
|
static void ListExecuteFunction(Vector &result, Vector &state_vector, idx_t count) {
|
|
92364
92394
|
}
|
|
92365
92395
|
};
|
|
92366
92396
|
|
|
92367
92397
|
struct DistinctFunctor {
|
|
92368
|
-
template <class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92398
|
+
template <class OP, class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92369
92399
|
static void ListExecuteFunction(Vector &result, Vector &state_vector, idx_t count) {
|
|
92370
92400
|
|
|
92371
92401
|
VectorData sdata;
|
|
@@ -92389,7 +92419,7 @@ struct DistinctFunctor {
|
|
|
92389
92419
|
offset += state->hist->size();
|
|
92390
92420
|
|
|
92391
92421
|
for (auto &entry : *state->hist) {
|
|
92392
|
-
|
|
92422
|
+
Value bucket_value = OP::template FinalizeValue<T>(entry.first);
|
|
92393
92423
|
ListVector::PushBack(result, bucket_value);
|
|
92394
92424
|
}
|
|
92395
92425
|
}
|
|
@@ -92398,7 +92428,7 @@ struct DistinctFunctor {
|
|
|
92398
92428
|
};
|
|
92399
92429
|
|
|
92400
92430
|
struct UniqueFunctor {
|
|
92401
|
-
template <class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92431
|
+
template <class OP, class T, class MAP_TYPE = unordered_map<T, idx_t>>
|
|
92402
92432
|
static void ListExecuteFunction(Vector &result, Vector &state_vector, idx_t count) {
|
|
92403
92433
|
|
|
92404
92434
|
VectorData sdata;
|
|
@@ -92422,7 +92452,7 @@ struct UniqueFunctor {
|
|
|
92422
92452
|
}
|
|
92423
92453
|
};
|
|
92424
92454
|
|
|
92425
|
-
template <class
|
|
92455
|
+
template <class FUNCTION_FUNCTOR, bool IS_AGGR = false>
|
|
92426
92456
|
static void ListAggregatesFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
92427
92457
|
|
|
92428
92458
|
auto count = args.size();
|
|
@@ -92528,61 +92558,80 @@ static void ListAggregatesFunction(DataChunk &args, ExpressionState &state, Vect
|
|
|
92528
92558
|
|
|
92529
92559
|
switch (key_type.InternalType()) {
|
|
92530
92560
|
case PhysicalType::BOOL:
|
|
92531
|
-
|
|
92561
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, bool>(
|
|
92562
|
+
result, state_vector.state_vector, count);
|
|
92532
92563
|
break;
|
|
92533
92564
|
case PhysicalType::UINT8:
|
|
92534
|
-
|
|
92565
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, uint8_t>(
|
|
92566
|
+
result, state_vector.state_vector, count);
|
|
92535
92567
|
break;
|
|
92536
92568
|
case PhysicalType::UINT16:
|
|
92537
|
-
|
|
92569
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, uint16_t>(
|
|
92570
|
+
result, state_vector.state_vector, count);
|
|
92538
92571
|
break;
|
|
92539
92572
|
case PhysicalType::UINT32:
|
|
92540
|
-
|
|
92573
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, uint32_t>(
|
|
92574
|
+
result, state_vector.state_vector, count);
|
|
92541
92575
|
break;
|
|
92542
92576
|
case PhysicalType::UINT64:
|
|
92543
|
-
|
|
92577
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, uint64_t>(
|
|
92578
|
+
result, state_vector.state_vector, count);
|
|
92544
92579
|
break;
|
|
92545
92580
|
case PhysicalType::INT8:
|
|
92546
|
-
|
|
92581
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int8_t>(
|
|
92582
|
+
result, state_vector.state_vector, count);
|
|
92547
92583
|
break;
|
|
92548
92584
|
case PhysicalType::INT16:
|
|
92549
|
-
|
|
92585
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int16_t>(
|
|
92586
|
+
result, state_vector.state_vector, count);
|
|
92550
92587
|
break;
|
|
92551
92588
|
case PhysicalType::INT32:
|
|
92552
|
-
|
|
92589
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int32_t>(
|
|
92590
|
+
result, state_vector.state_vector, count);
|
|
92553
92591
|
break;
|
|
92554
92592
|
case PhysicalType::INT64:
|
|
92555
|
-
|
|
92593
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int64_t>(
|
|
92594
|
+
result, state_vector.state_vector, count);
|
|
92556
92595
|
break;
|
|
92557
92596
|
case PhysicalType::FLOAT:
|
|
92558
|
-
|
|
92597
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, float>(
|
|
92598
|
+
result, state_vector.state_vector, count);
|
|
92559
92599
|
break;
|
|
92560
92600
|
case PhysicalType::DOUBLE:
|
|
92561
|
-
|
|
92601
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, double>(
|
|
92602
|
+
result, state_vector.state_vector, count);
|
|
92562
92603
|
break;
|
|
92563
92604
|
case PhysicalType::DATE32:
|
|
92564
|
-
|
|
92605
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int32_t>(
|
|
92606
|
+
result, state_vector.state_vector, count);
|
|
92565
92607
|
break;
|
|
92566
92608
|
case PhysicalType::DATE64:
|
|
92567
|
-
|
|
92609
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int64_t>(
|
|
92610
|
+
result, state_vector.state_vector, count);
|
|
92568
92611
|
break;
|
|
92569
92612
|
case PhysicalType::TIMESTAMP:
|
|
92570
|
-
|
|
92613
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int64_t>(
|
|
92614
|
+
result, state_vector.state_vector, count);
|
|
92571
92615
|
break;
|
|
92572
92616
|
case PhysicalType::TIME32:
|
|
92573
|
-
|
|
92617
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int32_t>(
|
|
92618
|
+
result, state_vector.state_vector, count);
|
|
92574
92619
|
break;
|
|
92575
92620
|
case PhysicalType::TIME64:
|
|
92576
|
-
|
|
92621
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeValueFunctor, int64_t>(
|
|
92622
|
+
result, state_vector.state_vector, count);
|
|
92577
92623
|
break;
|
|
92578
92624
|
case PhysicalType::STRING:
|
|
92579
|
-
|
|
92625
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeStringValueFunctor, string>(
|
|
92626
|
+
result, state_vector.state_vector, count);
|
|
92580
92627
|
break;
|
|
92581
92628
|
case PhysicalType::LARGE_STRING:
|
|
92582
|
-
|
|
92629
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeStringValueFunctor, string>(
|
|
92630
|
+
result, state_vector.state_vector, count);
|
|
92583
92631
|
break;
|
|
92584
92632
|
case PhysicalType::VARCHAR:
|
|
92585
|
-
|
|
92633
|
+
FUNCTION_FUNCTOR::template ListExecuteFunction<FinalizeStringValueFunctor, string>(
|
|
92634
|
+
result, state_vector.state_vector, count);
|
|
92586
92635
|
break;
|
|
92587
92636
|
default:
|
|
92588
92637
|
throw InternalException("Unimplemented histogram aggregate");
|
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.5-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "94ae4fb8f"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.5-dev355"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|