duckdb 0.3.5-dev1360.0 → 0.3.5-dev1398.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 +486 -153
- package/src/duckdb.hpp +6 -2
- package/src/parquet-amalgamation.cpp +35006 -35006
package/src/duckdb.cpp
CHANGED
|
@@ -7663,6 +7663,18 @@ string StatementTypeToString(StatementType type) {
|
|
|
7663
7663
|
}
|
|
7664
7664
|
return "INVALID";
|
|
7665
7665
|
}
|
|
7666
|
+
|
|
7667
|
+
string StatementReturnTypeToString(StatementReturnType type) {
|
|
7668
|
+
switch (type) {
|
|
7669
|
+
case StatementReturnType::QUERY_RESULT:
|
|
7670
|
+
return "QUERY_RESULT";
|
|
7671
|
+
case StatementReturnType::CHANGED_ROWS:
|
|
7672
|
+
return "CHANGED_ROWS";
|
|
7673
|
+
case StatementReturnType::NOTHING:
|
|
7674
|
+
return "NOTHING";
|
|
7675
|
+
}
|
|
7676
|
+
return "INVALID";
|
|
7677
|
+
}
|
|
7666
7678
|
// LCOV_EXCL_STOP
|
|
7667
7679
|
|
|
7668
7680
|
} // namespace duckdb
|
|
@@ -45593,6 +45605,126 @@ bool Value::ValuesAreEqual(const Value &result_value, const Value &value) {
|
|
|
45593
45605
|
|
|
45594
45606
|
|
|
45595
45607
|
|
|
45608
|
+
//===----------------------------------------------------------------------===//
|
|
45609
|
+
// DuckDB
|
|
45610
|
+
//
|
|
45611
|
+
// duckdb/function/scalar/nested_functions.hpp
|
|
45612
|
+
//
|
|
45613
|
+
//
|
|
45614
|
+
//===----------------------------------------------------------------------===//
|
|
45615
|
+
|
|
45616
|
+
|
|
45617
|
+
|
|
45618
|
+
|
|
45619
|
+
|
|
45620
|
+
|
|
45621
|
+
|
|
45622
|
+
|
|
45623
|
+
namespace duckdb {
|
|
45624
|
+
|
|
45625
|
+
enum class MapInvalidReason : uint8_t { VALID, NULL_KEY_LIST, NULL_KEY, DUPLICATE_KEY };
|
|
45626
|
+
|
|
45627
|
+
struct VariableReturnBindData : public FunctionData {
|
|
45628
|
+
LogicalType stype;
|
|
45629
|
+
|
|
45630
|
+
explicit VariableReturnBindData(const LogicalType &stype_p) : stype(stype_p) {
|
|
45631
|
+
}
|
|
45632
|
+
|
|
45633
|
+
unique_ptr<FunctionData> Copy() const override {
|
|
45634
|
+
return make_unique<VariableReturnBindData>(stype);
|
|
45635
|
+
}
|
|
45636
|
+
bool Equals(const FunctionData &other_p) const override {
|
|
45637
|
+
auto &other = (const VariableReturnBindData &)other_p;
|
|
45638
|
+
return stype == other.stype;
|
|
45639
|
+
}
|
|
45640
|
+
};
|
|
45641
|
+
|
|
45642
|
+
template <class T, class MAP_TYPE = map<T, idx_t>>
|
|
45643
|
+
struct HistogramAggState {
|
|
45644
|
+
MAP_TYPE *hist;
|
|
45645
|
+
};
|
|
45646
|
+
|
|
45647
|
+
struct ArraySliceFun {
|
|
45648
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45649
|
+
};
|
|
45650
|
+
|
|
45651
|
+
struct StructPackFun {
|
|
45652
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45653
|
+
};
|
|
45654
|
+
|
|
45655
|
+
struct ListValueFun {
|
|
45656
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45657
|
+
};
|
|
45658
|
+
|
|
45659
|
+
struct ListRangeFun {
|
|
45660
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45661
|
+
};
|
|
45662
|
+
|
|
45663
|
+
struct MapFun {
|
|
45664
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45665
|
+
};
|
|
45666
|
+
|
|
45667
|
+
struct MapExtractFun {
|
|
45668
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45669
|
+
};
|
|
45670
|
+
|
|
45671
|
+
struct ListExtractFun {
|
|
45672
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45673
|
+
};
|
|
45674
|
+
|
|
45675
|
+
struct ListConcatFun {
|
|
45676
|
+
static ScalarFunction GetFunction();
|
|
45677
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45678
|
+
};
|
|
45679
|
+
|
|
45680
|
+
struct ListContainsFun {
|
|
45681
|
+
static ScalarFunction GetFunction();
|
|
45682
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45683
|
+
};
|
|
45684
|
+
|
|
45685
|
+
struct ListFlattenFun {
|
|
45686
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45687
|
+
};
|
|
45688
|
+
|
|
45689
|
+
struct ListPositionFun {
|
|
45690
|
+
static ScalarFunction GetFunction();
|
|
45691
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45692
|
+
};
|
|
45693
|
+
|
|
45694
|
+
struct ListAggregateFun {
|
|
45695
|
+
static ScalarFunction GetFunction();
|
|
45696
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45697
|
+
};
|
|
45698
|
+
|
|
45699
|
+
struct ListDistinctFun {
|
|
45700
|
+
static ScalarFunction GetFunction();
|
|
45701
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45702
|
+
};
|
|
45703
|
+
|
|
45704
|
+
struct ListUniqueFun {
|
|
45705
|
+
static ScalarFunction GetFunction();
|
|
45706
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45707
|
+
};
|
|
45708
|
+
|
|
45709
|
+
struct ListSortFun {
|
|
45710
|
+
static ScalarFunction GetFunction();
|
|
45711
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45712
|
+
};
|
|
45713
|
+
|
|
45714
|
+
struct CardinalityFun {
|
|
45715
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45716
|
+
};
|
|
45717
|
+
|
|
45718
|
+
struct StructExtractFun {
|
|
45719
|
+
static ScalarFunction GetFunction();
|
|
45720
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45721
|
+
};
|
|
45722
|
+
|
|
45723
|
+
MapInvalidReason CheckMapValidity(Vector &map, idx_t count,
|
|
45724
|
+
const SelectionVector &sel = *FlatVector::IncrementalSelectionVector());
|
|
45725
|
+
|
|
45726
|
+
} // namespace duckdb
|
|
45727
|
+
|
|
45596
45728
|
|
|
45597
45729
|
#include <cstring> // strlen() on Solaris
|
|
45598
45730
|
|
|
@@ -46573,6 +46705,14 @@ void Vector::UTFVerify(idx_t count) {
|
|
|
46573
46705
|
UTFVerify(*flat_sel, count);
|
|
46574
46706
|
}
|
|
46575
46707
|
|
|
46708
|
+
void Vector::VerifyMap(Vector &vector_p, const SelectionVector &sel_p, idx_t count) {
|
|
46709
|
+
#ifdef DEBUG
|
|
46710
|
+
D_ASSERT(vector_p.GetType().id() == LogicalTypeId::MAP);
|
|
46711
|
+
auto valid_check = CheckMapValidity(vector_p, count, sel_p);
|
|
46712
|
+
D_ASSERT(valid_check == MapInvalidReason::VALID);
|
|
46713
|
+
#endif // DEBUG
|
|
46714
|
+
}
|
|
46715
|
+
|
|
46576
46716
|
void Vector::Verify(Vector &vector_p, const SelectionVector &sel_p, idx_t count) {
|
|
46577
46717
|
#ifdef DEBUG
|
|
46578
46718
|
if (count == 0) {
|
|
@@ -46664,6 +46804,9 @@ void Vector::Verify(Vector &vector_p, const SelectionVector &sel_p, idx_t count)
|
|
|
46664
46804
|
}
|
|
46665
46805
|
}
|
|
46666
46806
|
}
|
|
46807
|
+
if (vector->GetType().id() == LogicalTypeId::MAP) {
|
|
46808
|
+
VerifyMap(*vector, *sel, count);
|
|
46809
|
+
}
|
|
46667
46810
|
}
|
|
46668
46811
|
|
|
46669
46812
|
if (type.InternalType() == PhysicalType::LIST) {
|
|
@@ -86113,120 +86256,6 @@ void BuiltinFunctions::RegisterHolisticAggregates() {
|
|
|
86113
86256
|
Register<ReservoirQuantileFun>();
|
|
86114
86257
|
}
|
|
86115
86258
|
|
|
86116
|
-
} // namespace duckdb
|
|
86117
|
-
//===----------------------------------------------------------------------===//
|
|
86118
|
-
// DuckDB
|
|
86119
|
-
//
|
|
86120
|
-
// duckdb/function/scalar/nested_functions.hpp
|
|
86121
|
-
//
|
|
86122
|
-
//
|
|
86123
|
-
//===----------------------------------------------------------------------===//
|
|
86124
|
-
|
|
86125
|
-
|
|
86126
|
-
|
|
86127
|
-
|
|
86128
|
-
|
|
86129
|
-
|
|
86130
|
-
|
|
86131
|
-
|
|
86132
|
-
namespace duckdb {
|
|
86133
|
-
|
|
86134
|
-
struct VariableReturnBindData : public FunctionData {
|
|
86135
|
-
LogicalType stype;
|
|
86136
|
-
|
|
86137
|
-
explicit VariableReturnBindData(const LogicalType &stype_p) : stype(stype_p) {
|
|
86138
|
-
}
|
|
86139
|
-
|
|
86140
|
-
unique_ptr<FunctionData> Copy() const override {
|
|
86141
|
-
return make_unique<VariableReturnBindData>(stype);
|
|
86142
|
-
}
|
|
86143
|
-
bool Equals(const FunctionData &other_p) const override {
|
|
86144
|
-
auto &other = (const VariableReturnBindData &)other_p;
|
|
86145
|
-
return stype == other.stype;
|
|
86146
|
-
}
|
|
86147
|
-
};
|
|
86148
|
-
|
|
86149
|
-
template <class T, class MAP_TYPE = map<T, idx_t>>
|
|
86150
|
-
struct HistogramAggState {
|
|
86151
|
-
MAP_TYPE *hist;
|
|
86152
|
-
};
|
|
86153
|
-
|
|
86154
|
-
struct ArraySliceFun {
|
|
86155
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86156
|
-
};
|
|
86157
|
-
|
|
86158
|
-
struct StructPackFun {
|
|
86159
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86160
|
-
};
|
|
86161
|
-
|
|
86162
|
-
struct ListValueFun {
|
|
86163
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86164
|
-
};
|
|
86165
|
-
|
|
86166
|
-
struct ListRangeFun {
|
|
86167
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86168
|
-
};
|
|
86169
|
-
|
|
86170
|
-
struct MapFun {
|
|
86171
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86172
|
-
};
|
|
86173
|
-
|
|
86174
|
-
struct MapExtractFun {
|
|
86175
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86176
|
-
};
|
|
86177
|
-
|
|
86178
|
-
struct ListExtractFun {
|
|
86179
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86180
|
-
};
|
|
86181
|
-
|
|
86182
|
-
struct ListConcatFun {
|
|
86183
|
-
static ScalarFunction GetFunction();
|
|
86184
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86185
|
-
};
|
|
86186
|
-
|
|
86187
|
-
struct ListContainsFun {
|
|
86188
|
-
static ScalarFunction GetFunction();
|
|
86189
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86190
|
-
};
|
|
86191
|
-
|
|
86192
|
-
struct ListFlattenFun {
|
|
86193
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86194
|
-
};
|
|
86195
|
-
|
|
86196
|
-
struct ListPositionFun {
|
|
86197
|
-
static ScalarFunction GetFunction();
|
|
86198
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86199
|
-
};
|
|
86200
|
-
|
|
86201
|
-
struct ListAggregateFun {
|
|
86202
|
-
static ScalarFunction GetFunction();
|
|
86203
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86204
|
-
};
|
|
86205
|
-
|
|
86206
|
-
struct ListDistinctFun {
|
|
86207
|
-
static ScalarFunction GetFunction();
|
|
86208
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86209
|
-
};
|
|
86210
|
-
|
|
86211
|
-
struct ListUniqueFun {
|
|
86212
|
-
static ScalarFunction GetFunction();
|
|
86213
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86214
|
-
};
|
|
86215
|
-
|
|
86216
|
-
struct ListSortFun {
|
|
86217
|
-
static ScalarFunction GetFunction();
|
|
86218
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86219
|
-
};
|
|
86220
|
-
|
|
86221
|
-
struct CardinalityFun {
|
|
86222
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86223
|
-
};
|
|
86224
|
-
|
|
86225
|
-
struct StructExtractFun {
|
|
86226
|
-
static ScalarFunction GetFunction();
|
|
86227
|
-
static void RegisterFunction(BuiltinFunctions &set);
|
|
86228
|
-
};
|
|
86229
|
-
|
|
86230
86259
|
} // namespace duckdb
|
|
86231
86260
|
|
|
86232
86261
|
//===----------------------------------------------------------------------===//
|
|
@@ -91573,6 +91602,7 @@ void DateSubFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
91573
91602
|
|
|
91574
91603
|
|
|
91575
91604
|
|
|
91605
|
+
|
|
91576
91606
|
namespace duckdb {
|
|
91577
91607
|
|
|
91578
91608
|
struct DateTrunc {
|
|
@@ -91590,32 +91620,28 @@ struct DateTrunc {
|
|
|
91590
91620
|
struct MillenniumOperator {
|
|
91591
91621
|
template <class TA, class TR>
|
|
91592
91622
|
static inline TR Operation(TA input) {
|
|
91593
|
-
|
|
91594
|
-
return Timestamp::FromDatetime(Date::FromDate((Date::ExtractYear(date) / 1000) * 1000, 1, 1), dtime_t(0));
|
|
91623
|
+
return Date::FromDate((Date::ExtractYear(input) / 1000) * 1000, 1, 1);
|
|
91595
91624
|
}
|
|
91596
91625
|
};
|
|
91597
91626
|
|
|
91598
91627
|
struct CenturyOperator {
|
|
91599
91628
|
template <class TA, class TR>
|
|
91600
91629
|
static inline TR Operation(TA input) {
|
|
91601
|
-
|
|
91602
|
-
return Timestamp::FromDatetime(Date::FromDate((Date::ExtractYear(date) / 100) * 100, 1, 1), dtime_t(0));
|
|
91630
|
+
return Date::FromDate((Date::ExtractYear(input) / 100) * 100, 1, 1);
|
|
91603
91631
|
}
|
|
91604
91632
|
};
|
|
91605
91633
|
|
|
91606
91634
|
struct DecadeOperator {
|
|
91607
91635
|
template <class TA, class TR>
|
|
91608
91636
|
static inline TR Operation(TA input) {
|
|
91609
|
-
|
|
91610
|
-
return Timestamp::FromDatetime(Date::FromDate((Date::ExtractYear(date) / 10) * 10, 1, 1), dtime_t(0));
|
|
91637
|
+
return Date::FromDate((Date::ExtractYear(input) / 10) * 10, 1, 1);
|
|
91611
91638
|
}
|
|
91612
91639
|
};
|
|
91613
91640
|
|
|
91614
91641
|
struct YearOperator {
|
|
91615
91642
|
template <class TA, class TR>
|
|
91616
91643
|
static inline TR Operation(TA input) {
|
|
91617
|
-
|
|
91618
|
-
return Timestamp::FromDatetime(Date::FromDate(Date::ExtractYear(date), 1, 1), dtime_t(0));
|
|
91644
|
+
return Date::FromDate(Date::ExtractYear(input), 1, 1);
|
|
91619
91645
|
}
|
|
91620
91646
|
};
|
|
91621
91647
|
|
|
@@ -91623,27 +91649,23 @@ struct DateTrunc {
|
|
|
91623
91649
|
template <class TA, class TR>
|
|
91624
91650
|
static inline TR Operation(TA input) {
|
|
91625
91651
|
int32_t yyyy, mm, dd;
|
|
91626
|
-
Date::Convert(
|
|
91652
|
+
Date::Convert(input, yyyy, mm, dd);
|
|
91627
91653
|
mm = 1 + (((mm - 1) / 3) * 3);
|
|
91628
|
-
return
|
|
91654
|
+
return Date::FromDate(yyyy, mm, 1);
|
|
91629
91655
|
}
|
|
91630
91656
|
};
|
|
91631
91657
|
|
|
91632
91658
|
struct MonthOperator {
|
|
91633
91659
|
template <class TA, class TR>
|
|
91634
91660
|
static inline TR Operation(TA input) {
|
|
91635
|
-
|
|
91636
|
-
return Timestamp::FromDatetime(Date::FromDate(Date::ExtractYear(date), Date::ExtractMonth(date), 1),
|
|
91637
|
-
dtime_t(0));
|
|
91661
|
+
return Date::FromDate(Date::ExtractYear(input), Date::ExtractMonth(input), 1);
|
|
91638
91662
|
}
|
|
91639
91663
|
};
|
|
91640
91664
|
|
|
91641
91665
|
struct WeekOperator {
|
|
91642
91666
|
template <class TA, class TR>
|
|
91643
91667
|
static inline TR Operation(TA input) {
|
|
91644
|
-
|
|
91645
|
-
|
|
91646
|
-
return Timestamp::FromDatetime(Date::GetMondayOfCurrentWeek(date), dtime_t(0));
|
|
91668
|
+
return Date::GetMondayOfCurrentWeek(input);
|
|
91647
91669
|
}
|
|
91648
91670
|
};
|
|
91649
91671
|
|
|
@@ -91653,15 +91675,14 @@ struct DateTrunc {
|
|
|
91653
91675
|
date_t date = Date::GetMondayOfCurrentWeek(input);
|
|
91654
91676
|
date.days -= (Date::ExtractISOWeekNumber(date) - 1) * Interval::DAYS_PER_WEEK;
|
|
91655
91677
|
|
|
91656
|
-
return
|
|
91678
|
+
return date;
|
|
91657
91679
|
}
|
|
91658
91680
|
};
|
|
91659
91681
|
|
|
91660
91682
|
struct DayOperator {
|
|
91661
91683
|
template <class TA, class TR>
|
|
91662
91684
|
static inline TR Operation(TA input) {
|
|
91663
|
-
|
|
91664
|
-
return Timestamp::FromDatetime(date, dtime_t(0));
|
|
91685
|
+
return input;
|
|
91665
91686
|
}
|
|
91666
91687
|
};
|
|
91667
91688
|
|
|
@@ -91723,39 +91744,119 @@ struct DateTrunc {
|
|
|
91723
91744
|
};
|
|
91724
91745
|
|
|
91725
91746
|
// DATE specialisations
|
|
91747
|
+
template <>
|
|
91748
|
+
date_t DateTrunc::MillenniumOperator::Operation(timestamp_t input) {
|
|
91749
|
+
return MillenniumOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91750
|
+
}
|
|
91751
|
+
|
|
91726
91752
|
template <>
|
|
91727
91753
|
timestamp_t DateTrunc::MillenniumOperator::Operation(date_t input) {
|
|
91728
|
-
return MillenniumOperator::Operation<
|
|
91754
|
+
return Timestamp::FromDatetime(MillenniumOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91755
|
+
}
|
|
91756
|
+
|
|
91757
|
+
template <>
|
|
91758
|
+
timestamp_t DateTrunc::MillenniumOperator::Operation(timestamp_t input) {
|
|
91759
|
+
return MillenniumOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91760
|
+
}
|
|
91761
|
+
|
|
91762
|
+
template <>
|
|
91763
|
+
date_t DateTrunc::CenturyOperator::Operation(timestamp_t input) {
|
|
91764
|
+
return CenturyOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91729
91765
|
}
|
|
91730
91766
|
|
|
91731
91767
|
template <>
|
|
91732
91768
|
timestamp_t DateTrunc::CenturyOperator::Operation(date_t input) {
|
|
91733
|
-
return CenturyOperator::Operation<
|
|
91769
|
+
return Timestamp::FromDatetime(CenturyOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91770
|
+
}
|
|
91771
|
+
|
|
91772
|
+
template <>
|
|
91773
|
+
timestamp_t DateTrunc::CenturyOperator::Operation(timestamp_t input) {
|
|
91774
|
+
return CenturyOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91775
|
+
}
|
|
91776
|
+
|
|
91777
|
+
template <>
|
|
91778
|
+
date_t DateTrunc::DecadeOperator::Operation(timestamp_t input) {
|
|
91779
|
+
return DecadeOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91734
91780
|
}
|
|
91735
91781
|
|
|
91736
91782
|
template <>
|
|
91737
91783
|
timestamp_t DateTrunc::DecadeOperator::Operation(date_t input) {
|
|
91738
|
-
return DecadeOperator::Operation<
|
|
91784
|
+
return Timestamp::FromDatetime(DecadeOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91785
|
+
}
|
|
91786
|
+
|
|
91787
|
+
template <>
|
|
91788
|
+
timestamp_t DateTrunc::DecadeOperator::Operation(timestamp_t input) {
|
|
91789
|
+
return DecadeOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91790
|
+
}
|
|
91791
|
+
|
|
91792
|
+
template <>
|
|
91793
|
+
date_t DateTrunc::YearOperator::Operation(timestamp_t input) {
|
|
91794
|
+
return YearOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91739
91795
|
}
|
|
91740
91796
|
|
|
91741
91797
|
template <>
|
|
91742
91798
|
timestamp_t DateTrunc::YearOperator::Operation(date_t input) {
|
|
91743
|
-
return YearOperator::Operation<
|
|
91799
|
+
return Timestamp::FromDatetime(YearOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91800
|
+
}
|
|
91801
|
+
|
|
91802
|
+
template <>
|
|
91803
|
+
timestamp_t DateTrunc::YearOperator::Operation(timestamp_t input) {
|
|
91804
|
+
return YearOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91805
|
+
}
|
|
91806
|
+
|
|
91807
|
+
template <>
|
|
91808
|
+
date_t DateTrunc::QuarterOperator::Operation(timestamp_t input) {
|
|
91809
|
+
return QuarterOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91744
91810
|
}
|
|
91745
91811
|
|
|
91746
91812
|
template <>
|
|
91747
91813
|
timestamp_t DateTrunc::QuarterOperator::Operation(date_t input) {
|
|
91748
|
-
return QuarterOperator::Operation<
|
|
91814
|
+
return Timestamp::FromDatetime(QuarterOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91815
|
+
}
|
|
91816
|
+
|
|
91817
|
+
template <>
|
|
91818
|
+
timestamp_t DateTrunc::QuarterOperator::Operation(timestamp_t input) {
|
|
91819
|
+
return QuarterOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91820
|
+
}
|
|
91821
|
+
|
|
91822
|
+
template <>
|
|
91823
|
+
date_t DateTrunc::MonthOperator::Operation(timestamp_t input) {
|
|
91824
|
+
return MonthOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91749
91825
|
}
|
|
91750
91826
|
|
|
91751
91827
|
template <>
|
|
91752
91828
|
timestamp_t DateTrunc::MonthOperator::Operation(date_t input) {
|
|
91753
|
-
return MonthOperator::Operation<
|
|
91829
|
+
return Timestamp::FromDatetime(MonthOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91830
|
+
}
|
|
91831
|
+
|
|
91832
|
+
template <>
|
|
91833
|
+
timestamp_t DateTrunc::MonthOperator::Operation(timestamp_t input) {
|
|
91834
|
+
return MonthOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91835
|
+
}
|
|
91836
|
+
|
|
91837
|
+
template <>
|
|
91838
|
+
date_t DateTrunc::WeekOperator::Operation(timestamp_t input) {
|
|
91839
|
+
return WeekOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91754
91840
|
}
|
|
91755
91841
|
|
|
91756
91842
|
template <>
|
|
91757
91843
|
timestamp_t DateTrunc::WeekOperator::Operation(date_t input) {
|
|
91758
|
-
return WeekOperator::Operation<
|
|
91844
|
+
return Timestamp::FromDatetime(WeekOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91845
|
+
}
|
|
91846
|
+
|
|
91847
|
+
template <>
|
|
91848
|
+
timestamp_t DateTrunc::WeekOperator::Operation(timestamp_t input) {
|
|
91849
|
+
return WeekOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91850
|
+
}
|
|
91851
|
+
|
|
91852
|
+
template <>
|
|
91853
|
+
date_t DateTrunc::ISOYearOperator::Operation(timestamp_t input) {
|
|
91854
|
+
return ISOYearOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91855
|
+
}
|
|
91856
|
+
|
|
91857
|
+
template <>
|
|
91858
|
+
timestamp_t DateTrunc::ISOYearOperator::Operation(date_t input) {
|
|
91859
|
+
return Timestamp::FromDatetime(ISOYearOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91759
91860
|
}
|
|
91760
91861
|
|
|
91761
91862
|
template <>
|
|
@@ -91763,9 +91864,24 @@ timestamp_t DateTrunc::ISOYearOperator::Operation(timestamp_t input) {
|
|
|
91763
91864
|
return ISOYearOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91764
91865
|
}
|
|
91765
91866
|
|
|
91867
|
+
template <>
|
|
91868
|
+
date_t DateTrunc::DayOperator::Operation(timestamp_t input) {
|
|
91869
|
+
return DayOperator::Operation<date_t, date_t>(Timestamp::GetDate(input));
|
|
91870
|
+
}
|
|
91871
|
+
|
|
91766
91872
|
template <>
|
|
91767
91873
|
timestamp_t DateTrunc::DayOperator::Operation(date_t input) {
|
|
91768
|
-
return Timestamp::FromDatetime(input, dtime_t(0));
|
|
91874
|
+
return Timestamp::FromDatetime(DayOperator::Operation<date_t, date_t>(input), dtime_t(0));
|
|
91875
|
+
}
|
|
91876
|
+
|
|
91877
|
+
template <>
|
|
91878
|
+
timestamp_t DateTrunc::DayOperator::Operation(timestamp_t input) {
|
|
91879
|
+
return DayOperator::Operation<date_t, timestamp_t>(Timestamp::GetDate(input));
|
|
91880
|
+
}
|
|
91881
|
+
|
|
91882
|
+
template <>
|
|
91883
|
+
date_t DateTrunc::HourOperator::Operation(date_t input) {
|
|
91884
|
+
return DayOperator::Operation<date_t, date_t>(input);
|
|
91769
91885
|
}
|
|
91770
91886
|
|
|
91771
91887
|
template <>
|
|
@@ -91773,26 +91889,71 @@ timestamp_t DateTrunc::HourOperator::Operation(date_t input) {
|
|
|
91773
91889
|
return DayOperator::Operation<date_t, timestamp_t>(input);
|
|
91774
91890
|
}
|
|
91775
91891
|
|
|
91892
|
+
template <>
|
|
91893
|
+
date_t DateTrunc::HourOperator::Operation(timestamp_t input) {
|
|
91894
|
+
return Timestamp::GetDate(HourOperator::Operation<timestamp_t, timestamp_t>(input));
|
|
91895
|
+
}
|
|
91896
|
+
|
|
91897
|
+
template <>
|
|
91898
|
+
date_t DateTrunc::MinuteOperator::Operation(date_t input) {
|
|
91899
|
+
return DayOperator::Operation<date_t, date_t>(input);
|
|
91900
|
+
}
|
|
91901
|
+
|
|
91776
91902
|
template <>
|
|
91777
91903
|
timestamp_t DateTrunc::MinuteOperator::Operation(date_t input) {
|
|
91778
91904
|
return DayOperator::Operation<date_t, timestamp_t>(input);
|
|
91779
91905
|
}
|
|
91780
91906
|
|
|
91907
|
+
template <>
|
|
91908
|
+
date_t DateTrunc::MinuteOperator::Operation(timestamp_t input) {
|
|
91909
|
+
return Timestamp::GetDate(HourOperator::Operation<timestamp_t, timestamp_t>(input));
|
|
91910
|
+
}
|
|
91911
|
+
|
|
91912
|
+
template <>
|
|
91913
|
+
date_t DateTrunc::SecondOperator::Operation(date_t input) {
|
|
91914
|
+
return DayOperator::Operation<date_t, date_t>(input);
|
|
91915
|
+
}
|
|
91916
|
+
|
|
91781
91917
|
template <>
|
|
91782
91918
|
timestamp_t DateTrunc::SecondOperator::Operation(date_t input) {
|
|
91783
91919
|
return DayOperator::Operation<date_t, timestamp_t>(input);
|
|
91784
91920
|
}
|
|
91785
91921
|
|
|
91922
|
+
template <>
|
|
91923
|
+
date_t DateTrunc::SecondOperator::Operation(timestamp_t input) {
|
|
91924
|
+
return Timestamp::GetDate(DayOperator::Operation<timestamp_t, timestamp_t>(input));
|
|
91925
|
+
}
|
|
91926
|
+
|
|
91927
|
+
template <>
|
|
91928
|
+
date_t DateTrunc::MillisecondOperator::Operation(date_t input) {
|
|
91929
|
+
return DayOperator::Operation<date_t, date_t>(input);
|
|
91930
|
+
}
|
|
91931
|
+
|
|
91786
91932
|
template <>
|
|
91787
91933
|
timestamp_t DateTrunc::MillisecondOperator::Operation(date_t input) {
|
|
91788
91934
|
return DayOperator::Operation<date_t, timestamp_t>(input);
|
|
91789
91935
|
}
|
|
91790
91936
|
|
|
91937
|
+
template <>
|
|
91938
|
+
date_t DateTrunc::MillisecondOperator::Operation(timestamp_t input) {
|
|
91939
|
+
return Timestamp::GetDate(MillisecondOperator::Operation<timestamp_t, timestamp_t>(input));
|
|
91940
|
+
}
|
|
91941
|
+
|
|
91942
|
+
template <>
|
|
91943
|
+
date_t DateTrunc::MicrosecondOperator::Operation(date_t input) {
|
|
91944
|
+
return DayOperator::Operation<date_t, date_t>(input);
|
|
91945
|
+
}
|
|
91946
|
+
|
|
91791
91947
|
template <>
|
|
91792
91948
|
timestamp_t DateTrunc::MicrosecondOperator::Operation(date_t input) {
|
|
91793
91949
|
return DayOperator::Operation<date_t, timestamp_t>(input);
|
|
91794
91950
|
}
|
|
91795
91951
|
|
|
91952
|
+
template <>
|
|
91953
|
+
date_t DateTrunc::MicrosecondOperator::Operation(timestamp_t input) {
|
|
91954
|
+
return Timestamp::GetDate(MicrosecondOperator::Operation<timestamp_t, timestamp_t>(input));
|
|
91955
|
+
}
|
|
91956
|
+
|
|
91796
91957
|
// INTERVAL specialisations
|
|
91797
91958
|
template <>
|
|
91798
91959
|
interval_t DateTrunc::MillenniumOperator::Operation(interval_t input) {
|
|
@@ -92016,12 +92177,58 @@ static void DateTruncFunction(DataChunk &args, ExpressionState &state, Vector &r
|
|
|
92016
92177
|
}
|
|
92017
92178
|
}
|
|
92018
92179
|
|
|
92180
|
+
static unique_ptr<FunctionData> DateTruncBind(ClientContext &context, ScalarFunction &bound_function,
|
|
92181
|
+
vector<unique_ptr<Expression>> &arguments) {
|
|
92182
|
+
if (!arguments[0]->IsFoldable()) {
|
|
92183
|
+
return nullptr;
|
|
92184
|
+
}
|
|
92185
|
+
|
|
92186
|
+
// Rebind to return a date if we are truncating that far
|
|
92187
|
+
Value part_value = ExpressionExecutor::EvaluateScalar(*arguments[0]);
|
|
92188
|
+
if (part_value.IsNull()) {
|
|
92189
|
+
return nullptr;
|
|
92190
|
+
}
|
|
92191
|
+
const auto part_name = part_value.ToString();
|
|
92192
|
+
const auto part_code = GetDatePartSpecifier(part_name);
|
|
92193
|
+
switch (part_code) {
|
|
92194
|
+
case DatePartSpecifier::MILLENNIUM:
|
|
92195
|
+
case DatePartSpecifier::CENTURY:
|
|
92196
|
+
case DatePartSpecifier::DECADE:
|
|
92197
|
+
case DatePartSpecifier::YEAR:
|
|
92198
|
+
case DatePartSpecifier::QUARTER:
|
|
92199
|
+
case DatePartSpecifier::MONTH:
|
|
92200
|
+
case DatePartSpecifier::WEEK:
|
|
92201
|
+
case DatePartSpecifier::YEARWEEK:
|
|
92202
|
+
case DatePartSpecifier::ISOYEAR:
|
|
92203
|
+
case DatePartSpecifier::DAY:
|
|
92204
|
+
case DatePartSpecifier::DOW:
|
|
92205
|
+
case DatePartSpecifier::ISODOW:
|
|
92206
|
+
case DatePartSpecifier::DOY:
|
|
92207
|
+
switch (arguments[1]->return_type.id()) {
|
|
92208
|
+
case LogicalType::TIMESTAMP:
|
|
92209
|
+
bound_function.function = DateTruncFunction<timestamp_t, date_t>;
|
|
92210
|
+
break;
|
|
92211
|
+
case LogicalType::DATE:
|
|
92212
|
+
bound_function.function = DateTruncFunction<date_t, date_t>;
|
|
92213
|
+
break;
|
|
92214
|
+
default:
|
|
92215
|
+
break;
|
|
92216
|
+
}
|
|
92217
|
+
bound_function.return_type = LogicalType::DATE;
|
|
92218
|
+
break;
|
|
92219
|
+
default:
|
|
92220
|
+
break;
|
|
92221
|
+
}
|
|
92222
|
+
|
|
92223
|
+
return nullptr;
|
|
92224
|
+
}
|
|
92225
|
+
|
|
92019
92226
|
void DateTruncFun::RegisterFunction(BuiltinFunctions &set) {
|
|
92020
92227
|
ScalarFunctionSet date_trunc("date_trunc");
|
|
92021
92228
|
date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIMESTAMP}, LogicalType::TIMESTAMP,
|
|
92022
|
-
DateTruncFunction<timestamp_t, timestamp_t
|
|
92229
|
+
DateTruncFunction<timestamp_t, timestamp_t>, false, false, DateTruncBind));
|
|
92023
92230
|
date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::DATE}, LogicalType::TIMESTAMP,
|
|
92024
|
-
DateTruncFunction<date_t, timestamp_t
|
|
92231
|
+
DateTruncFunction<date_t, timestamp_t>, false, false, DateTruncBind));
|
|
92025
92232
|
date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::INTERVAL}, LogicalType::INTERVAL,
|
|
92026
92233
|
DateTruncFunction<interval_t, interval_t>));
|
|
92027
92234
|
set.AddFunction(date_trunc);
|
|
@@ -96612,8 +96819,110 @@ void CardinalityFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
96612
96819
|
|
|
96613
96820
|
|
|
96614
96821
|
|
|
96822
|
+
//===----------------------------------------------------------------------===//
|
|
96823
|
+
// DuckDB
|
|
96824
|
+
//
|
|
96825
|
+
// duckdb/parser/expression_map.hpp
|
|
96826
|
+
//
|
|
96827
|
+
//
|
|
96828
|
+
//===----------------------------------------------------------------------===//
|
|
96829
|
+
|
|
96830
|
+
|
|
96831
|
+
|
|
96832
|
+
|
|
96833
|
+
|
|
96834
|
+
|
|
96835
|
+
|
|
96836
|
+
namespace duckdb {
|
|
96837
|
+
|
|
96838
|
+
struct ValueHashFunction {
|
|
96839
|
+
uint64_t operator()(const Value &value) const {
|
|
96840
|
+
return (uint64_t)value.Hash();
|
|
96841
|
+
}
|
|
96842
|
+
};
|
|
96843
|
+
|
|
96844
|
+
struct ValueEquality {
|
|
96845
|
+
bool operator()(const Value &a, const Value &b) const {
|
|
96846
|
+
return Value::NotDistinctFrom(a, b);
|
|
96847
|
+
}
|
|
96848
|
+
};
|
|
96849
|
+
|
|
96850
|
+
template <typename T>
|
|
96851
|
+
using value_map_t = unordered_map<Value, T, ValueHashFunction, ValueEquality>;
|
|
96852
|
+
|
|
96853
|
+
using value_set_t = unordered_set<Value, ValueHashFunction, ValueEquality>;
|
|
96854
|
+
|
|
96855
|
+
} // namespace duckdb
|
|
96856
|
+
|
|
96857
|
+
|
|
96615
96858
|
namespace duckdb {
|
|
96616
96859
|
|
|
96860
|
+
// TODO: this doesn't recursively verify maps if maps are nested
|
|
96861
|
+
MapInvalidReason CheckMapValidity(Vector &map, idx_t count, const SelectionVector &sel) {
|
|
96862
|
+
D_ASSERT(map.GetType().id() == LogicalTypeId::MAP);
|
|
96863
|
+
VectorData map_vdata;
|
|
96864
|
+
map.Orrify(count, map_vdata);
|
|
96865
|
+
auto &map_validity = map_vdata.validity;
|
|
96866
|
+
|
|
96867
|
+
auto &key_vector = *(StructVector::GetEntries(map)[0]);
|
|
96868
|
+
VectorData key_vdata;
|
|
96869
|
+
key_vector.Orrify(count, key_vdata);
|
|
96870
|
+
auto key_data = (list_entry_t *)key_vdata.data;
|
|
96871
|
+
auto &key_validity = key_vdata.validity;
|
|
96872
|
+
|
|
96873
|
+
auto &key_entries = ListVector::GetEntry(key_vector);
|
|
96874
|
+
VectorData key_entry_vdata;
|
|
96875
|
+
key_entries.Orrify(count, key_entry_vdata);
|
|
96876
|
+
auto &entry_validity = key_entry_vdata.validity;
|
|
96877
|
+
|
|
96878
|
+
for (idx_t row = 0; row < count; row++) {
|
|
96879
|
+
auto mapped_row = sel.get_index(row);
|
|
96880
|
+
auto row_idx = map_vdata.sel->get_index(mapped_row);
|
|
96881
|
+
// map is allowed to be NULL
|
|
96882
|
+
if (!map_validity.RowIsValid(row_idx)) {
|
|
96883
|
+
continue;
|
|
96884
|
+
}
|
|
96885
|
+
row_idx = key_vdata.sel->get_index(row);
|
|
96886
|
+
if (!key_validity.RowIsValid(row_idx)) {
|
|
96887
|
+
return MapInvalidReason::NULL_KEY_LIST;
|
|
96888
|
+
}
|
|
96889
|
+
value_set_t unique_keys;
|
|
96890
|
+
for (idx_t i = 0; i < key_data[row_idx].length; i++) {
|
|
96891
|
+
auto index = key_data[row_idx].offset + i;
|
|
96892
|
+
index = key_entry_vdata.sel->get_index(index);
|
|
96893
|
+
if (!entry_validity.RowIsValid(index)) {
|
|
96894
|
+
return MapInvalidReason::NULL_KEY;
|
|
96895
|
+
}
|
|
96896
|
+
auto value = key_entries.GetValue(index);
|
|
96897
|
+
auto result = unique_keys.insert(value);
|
|
96898
|
+
if (!result.second) {
|
|
96899
|
+
return MapInvalidReason::DUPLICATE_KEY;
|
|
96900
|
+
}
|
|
96901
|
+
}
|
|
96902
|
+
}
|
|
96903
|
+
return MapInvalidReason::VALID;
|
|
96904
|
+
}
|
|
96905
|
+
|
|
96906
|
+
static void MapConversionVerify(Vector &vector, idx_t count) {
|
|
96907
|
+
auto valid_check = CheckMapValidity(vector, count);
|
|
96908
|
+
switch (valid_check) {
|
|
96909
|
+
case MapInvalidReason::VALID:
|
|
96910
|
+
break;
|
|
96911
|
+
case MapInvalidReason::DUPLICATE_KEY: {
|
|
96912
|
+
throw InvalidInputException("Map keys have to be unique");
|
|
96913
|
+
}
|
|
96914
|
+
case MapInvalidReason::NULL_KEY: {
|
|
96915
|
+
throw InvalidInputException("Map keys can not be NULL");
|
|
96916
|
+
}
|
|
96917
|
+
case MapInvalidReason::NULL_KEY_LIST: {
|
|
96918
|
+
throw InvalidInputException("The list of map keys is not allowed to be NULL");
|
|
96919
|
+
}
|
|
96920
|
+
default: {
|
|
96921
|
+
throw InternalException("MapInvalidReason not implemented");
|
|
96922
|
+
}
|
|
96923
|
+
}
|
|
96924
|
+
}
|
|
96925
|
+
|
|
96617
96926
|
static void MapFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
96618
96927
|
D_ASSERT(result.GetType().id() == LogicalTypeId::MAP);
|
|
96619
96928
|
|
|
@@ -96627,19 +96936,19 @@ static void MapFunction(DataChunk &args, ExpressionState &state, Vector &result)
|
|
|
96627
96936
|
|
|
96628
96937
|
auto &child_entries = StructVector::GetEntries(result);
|
|
96629
96938
|
D_ASSERT(child_entries.size() == 2);
|
|
96630
|
-
auto &key_vector = child_entries[0];
|
|
96631
|
-
auto &value_vector = child_entries[1];
|
|
96939
|
+
auto &key_vector = *child_entries[0];
|
|
96940
|
+
auto &value_vector = *child_entries[1];
|
|
96632
96941
|
if (args.data.empty()) {
|
|
96633
96942
|
// no arguments: construct an empty map
|
|
96634
|
-
ListVector::SetListSize(
|
|
96635
|
-
key_vector
|
|
96636
|
-
auto list_data = ConstantVector::GetData<list_entry_t>(
|
|
96943
|
+
ListVector::SetListSize(key_vector, 0);
|
|
96944
|
+
key_vector.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
96945
|
+
auto list_data = ConstantVector::GetData<list_entry_t>(key_vector);
|
|
96637
96946
|
list_data->offset = 0;
|
|
96638
96947
|
list_data->length = 0;
|
|
96639
96948
|
|
|
96640
|
-
ListVector::SetListSize(
|
|
96641
|
-
value_vector
|
|
96642
|
-
list_data = ConstantVector::GetData<list_entry_t>(
|
|
96949
|
+
ListVector::SetListSize(value_vector, 0);
|
|
96950
|
+
value_vector.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
96951
|
+
list_data = ConstantVector::GetData<list_entry_t>(value_vector);
|
|
96643
96952
|
list_data->offset = 0;
|
|
96644
96953
|
list_data->length = 0;
|
|
96645
96954
|
|
|
@@ -96650,8 +96959,10 @@ static void MapFunction(DataChunk &args, ExpressionState &state, Vector &result)
|
|
|
96650
96959
|
if (ListVector::GetListSize(args.data[0]) != ListVector::GetListSize(args.data[1])) {
|
|
96651
96960
|
throw Exception("Key list has a different size from Value list");
|
|
96652
96961
|
}
|
|
96653
|
-
|
|
96654
|
-
|
|
96962
|
+
|
|
96963
|
+
key_vector.Reference(args.data[0]);
|
|
96964
|
+
value_vector.Reference(args.data[1]);
|
|
96965
|
+
MapConversionVerify(result, args.size());
|
|
96655
96966
|
|
|
96656
96967
|
result.Verify(args.size());
|
|
96657
96968
|
}
|
|
@@ -105177,6 +105488,7 @@ void BuiltinFunctions::RegisterArrowFunctions() {
|
|
|
105177
105488
|
|
|
105178
105489
|
|
|
105179
105490
|
|
|
105491
|
+
|
|
105180
105492
|
namespace duckdb {
|
|
105181
105493
|
|
|
105182
105494
|
void ShiftRight(unsigned char *ar, int size, int shift) {
|
|
@@ -105379,6 +105691,26 @@ void ArrowToDuckDBBlob(Vector &vector, ArrowArray &array, ArrowScanLocalState &s
|
|
|
105379
105691
|
}
|
|
105380
105692
|
}
|
|
105381
105693
|
|
|
105694
|
+
void ArrowToDuckDBMapVerify(Vector &vector, idx_t count) {
|
|
105695
|
+
auto valid_check = CheckMapValidity(vector, count);
|
|
105696
|
+
switch (valid_check) {
|
|
105697
|
+
case MapInvalidReason::VALID:
|
|
105698
|
+
break;
|
|
105699
|
+
case MapInvalidReason::DUPLICATE_KEY: {
|
|
105700
|
+
throw InvalidInputException("Arrow map contains duplicate key, which isn't supported by DuckDB map type");
|
|
105701
|
+
}
|
|
105702
|
+
case MapInvalidReason::NULL_KEY: {
|
|
105703
|
+
throw InvalidInputException("Arrow map contains NULL as map key, which isn't supported by DuckDB map type");
|
|
105704
|
+
}
|
|
105705
|
+
case MapInvalidReason::NULL_KEY_LIST: {
|
|
105706
|
+
throw InvalidInputException("Arrow map contains NULL as key list, which isn't supported by DuckDB map type");
|
|
105707
|
+
}
|
|
105708
|
+
default: {
|
|
105709
|
+
throw InternalException("MapInvalidReason not implemented");
|
|
105710
|
+
}
|
|
105711
|
+
}
|
|
105712
|
+
}
|
|
105713
|
+
|
|
105382
105714
|
void ArrowToDuckDBMapList(Vector &vector, ArrowArray &array, ArrowScanLocalState &scan_state, idx_t size,
|
|
105383
105715
|
unordered_map<idx_t, unique_ptr<ArrowConvertData>> &arrow_convert_data, idx_t col_idx,
|
|
105384
105716
|
pair<idx_t, idx_t> &arrow_convert_idx, uint32_t *offsets, ValidityMask *parent_mask) {
|
|
@@ -105785,6 +106117,7 @@ void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowScanLocalState
|
|
|
105785
106117
|
ArrowToDuckDBMapList(*child_entries[type_idx], *struct_arrow.children[type_idx], scan_state, size,
|
|
105786
106118
|
arrow_convert_data, col_idx, arrow_convert_idx, offsets, &struct_validity_mask);
|
|
105787
106119
|
}
|
|
106120
|
+
ArrowToDuckDBMapVerify(vector, size);
|
|
105788
106121
|
break;
|
|
105789
106122
|
}
|
|
105790
106123
|
case LogicalTypeId::STRUCT: {
|