duckdb 0.3.5-dev1226.0 → 0.3.5-dev1237.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 +243 -153
- package/src/duckdb.hpp +15 -5
- package/src/parquet-amalgamation.cpp +31186 -31186
package/src/duckdb.cpp
CHANGED
|
@@ -84231,6 +84231,7 @@ void ModeFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
84231
84231
|
|
|
84232
84232
|
|
|
84233
84233
|
|
|
84234
|
+
|
|
84234
84235
|
namespace duckdb {
|
|
84235
84236
|
|
|
84236
84237
|
struct AbsOperator {
|
|
@@ -84241,21 +84242,60 @@ struct AbsOperator {
|
|
|
84241
84242
|
};
|
|
84242
84243
|
|
|
84243
84244
|
template <>
|
|
84244
|
-
inline hugeint_t AbsOperator::Operation(
|
|
84245
|
+
inline hugeint_t AbsOperator::Operation(hugeint_t input) {
|
|
84245
84246
|
const hugeint_t zero(0);
|
|
84246
|
-
return (input < zero) ?
|
|
84247
|
+
return (input < zero) ? -input : input;
|
|
84248
|
+
}
|
|
84249
|
+
|
|
84250
|
+
struct TryAbsOperator {
|
|
84251
|
+
template <class TA, class TR>
|
|
84252
|
+
static inline TR Operation(TA input) {
|
|
84253
|
+
return AbsOperator::Operation<TA, TR>(input);
|
|
84254
|
+
}
|
|
84255
|
+
};
|
|
84256
|
+
|
|
84257
|
+
template <>
|
|
84258
|
+
inline int8_t TryAbsOperator::Operation(int8_t input) {
|
|
84259
|
+
if (input == NumericLimits<int8_t>::Minimum()) {
|
|
84260
|
+
throw OutOfRangeException("Overflow on abs(%d)", input);
|
|
84261
|
+
}
|
|
84262
|
+
return input < 0 ? -input : input;
|
|
84263
|
+
}
|
|
84264
|
+
|
|
84265
|
+
template <>
|
|
84266
|
+
inline int16_t TryAbsOperator::Operation(int16_t input) {
|
|
84267
|
+
if (input == NumericLimits<int16_t>::Minimum()) {
|
|
84268
|
+
throw OutOfRangeException("Overflow on abs(%d)", input);
|
|
84269
|
+
}
|
|
84270
|
+
return input < 0 ? -input : input;
|
|
84271
|
+
}
|
|
84272
|
+
|
|
84273
|
+
template <>
|
|
84274
|
+
inline int32_t TryAbsOperator::Operation(int32_t input) {
|
|
84275
|
+
if (input == NumericLimits<int32_t>::Minimum()) {
|
|
84276
|
+
throw OutOfRangeException("Overflow on abs(%d)", input);
|
|
84277
|
+
}
|
|
84278
|
+
return input < 0 ? -input : input;
|
|
84279
|
+
}
|
|
84280
|
+
|
|
84281
|
+
template <>
|
|
84282
|
+
inline int64_t TryAbsOperator::Operation(int64_t input) {
|
|
84283
|
+
if (input == NumericLimits<int64_t>::Minimum()) {
|
|
84284
|
+
throw OutOfRangeException("Overflow on abs(%d)", input);
|
|
84285
|
+
}
|
|
84286
|
+
return input < 0 ? -input : input;
|
|
84247
84287
|
}
|
|
84248
84288
|
|
|
84249
84289
|
template <>
|
|
84250
|
-
inline dtime_t
|
|
84251
|
-
return dtime_t(
|
|
84290
|
+
inline dtime_t TryAbsOperator::Operation(dtime_t input) {
|
|
84291
|
+
return dtime_t(TryAbsOperator::Operation<int64_t, int64_t>(input.micros));
|
|
84252
84292
|
}
|
|
84253
84293
|
|
|
84254
84294
|
template <>
|
|
84255
|
-
inline interval_t
|
|
84256
|
-
return {
|
|
84257
|
-
|
|
84258
|
-
|
|
84295
|
+
inline interval_t TryAbsOperator::Operation(interval_t input) {
|
|
84296
|
+
return {TryAbsOperator::Operation<int32_t, int32_t>(input.months),
|
|
84297
|
+
TryAbsOperator::Operation<int32_t, int32_t>(input.days),
|
|
84298
|
+
TryAbsOperator::Operation<int64_t, int64_t>(input.micros)};
|
|
84259
84299
|
}
|
|
84260
84300
|
|
|
84261
84301
|
} // namespace duckdb
|
|
@@ -85153,7 +85193,7 @@ struct MadAccessor {
|
|
|
85153
85193
|
|
|
85154
85194
|
inline RESULT_TYPE operator()(const INPUT_TYPE &input) const {
|
|
85155
85195
|
const auto delta = input - median;
|
|
85156
|
-
return
|
|
85196
|
+
return TryAbsOperator::Operation<RESULT_TYPE, RESULT_TYPE>(delta);
|
|
85157
85197
|
}
|
|
85158
85198
|
};
|
|
85159
85199
|
|
|
@@ -85168,7 +85208,7 @@ struct MadAccessor<hugeint_t, double, double> {
|
|
|
85168
85208
|
}
|
|
85169
85209
|
inline RESULT_TYPE operator()(const INPUT_TYPE &input) const {
|
|
85170
85210
|
const auto delta = Hugeint::Cast<double>(input) - median;
|
|
85171
|
-
return
|
|
85211
|
+
return TryAbsOperator::Operation<double, double>(delta);
|
|
85172
85212
|
}
|
|
85173
85213
|
};
|
|
85174
85214
|
|
|
@@ -85184,7 +85224,7 @@ struct MadAccessor<date_t, interval_t, timestamp_t> {
|
|
|
85184
85224
|
inline RESULT_TYPE operator()(const INPUT_TYPE &input) const {
|
|
85185
85225
|
const auto dt = Cast::Operation<date_t, timestamp_t>(input);
|
|
85186
85226
|
const auto delta = dt - median;
|
|
85187
|
-
return Interval::FromMicro(
|
|
85227
|
+
return Interval::FromMicro(TryAbsOperator::Operation<int64_t, int64_t>(delta));
|
|
85188
85228
|
}
|
|
85189
85229
|
};
|
|
85190
85230
|
|
|
@@ -85199,7 +85239,7 @@ struct MadAccessor<timestamp_t, interval_t, timestamp_t> {
|
|
|
85199
85239
|
}
|
|
85200
85240
|
inline RESULT_TYPE operator()(const INPUT_TYPE &input) const {
|
|
85201
85241
|
const auto delta = input - median;
|
|
85202
|
-
return Interval::FromMicro(
|
|
85242
|
+
return Interval::FromMicro(TryAbsOperator::Operation<int64_t, int64_t>(delta));
|
|
85203
85243
|
}
|
|
85204
85244
|
};
|
|
85205
85245
|
|
|
@@ -85214,7 +85254,7 @@ struct MadAccessor<dtime_t, interval_t, dtime_t> {
|
|
|
85214
85254
|
}
|
|
85215
85255
|
inline RESULT_TYPE operator()(const INPUT_TYPE &input) const {
|
|
85216
85256
|
const auto delta = input - median;
|
|
85217
|
-
return Interval::FromMicro(
|
|
85257
|
+
return Interval::FromMicro(TryAbsOperator::Operation<int64_t, int64_t>(delta));
|
|
85218
85258
|
}
|
|
85219
85259
|
};
|
|
85220
85260
|
|
|
@@ -89690,10 +89730,8 @@ struct DatePart {
|
|
|
89690
89730
|
}
|
|
89691
89731
|
|
|
89692
89732
|
template <class T>
|
|
89693
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89694
|
-
|
|
89695
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89696
|
-
return PropagateDatePartStatistics<T, YearOperator>(child_stats);
|
|
89733
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89734
|
+
return PropagateDatePartStatistics<T, YearOperator>(input.child_stats);
|
|
89697
89735
|
}
|
|
89698
89736
|
};
|
|
89699
89737
|
|
|
@@ -89704,11 +89742,9 @@ struct DatePart {
|
|
|
89704
89742
|
}
|
|
89705
89743
|
|
|
89706
89744
|
template <class T>
|
|
89707
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89708
|
-
FunctionData *bind_data,
|
|
89709
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89745
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89710
89746
|
// min/max of month operator is [1, 12]
|
|
89711
|
-
return PropagateSimpleDatePartStatistics<1, 12>(child_stats);
|
|
89747
|
+
return PropagateSimpleDatePartStatistics<1, 12>(input.child_stats);
|
|
89712
89748
|
}
|
|
89713
89749
|
};
|
|
89714
89750
|
|
|
@@ -89719,11 +89755,9 @@ struct DatePart {
|
|
|
89719
89755
|
}
|
|
89720
89756
|
|
|
89721
89757
|
template <class T>
|
|
89722
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89723
|
-
FunctionData *bind_data,
|
|
89724
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89758
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89725
89759
|
// min/max of day operator is [1, 31]
|
|
89726
|
-
return PropagateSimpleDatePartStatistics<1, 31>(child_stats);
|
|
89760
|
+
return PropagateSimpleDatePartStatistics<1, 31>(input.child_stats);
|
|
89727
89761
|
}
|
|
89728
89762
|
};
|
|
89729
89763
|
|
|
@@ -89740,10 +89774,8 @@ struct DatePart {
|
|
|
89740
89774
|
}
|
|
89741
89775
|
|
|
89742
89776
|
template <class T>
|
|
89743
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89744
|
-
|
|
89745
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89746
|
-
return PropagateDatePartStatistics<T, DecadeOperator>(child_stats);
|
|
89777
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89778
|
+
return PropagateDatePartStatistics<T, DecadeOperator>(input.child_stats);
|
|
89747
89779
|
}
|
|
89748
89780
|
};
|
|
89749
89781
|
|
|
@@ -89770,10 +89802,8 @@ struct DatePart {
|
|
|
89770
89802
|
}
|
|
89771
89803
|
|
|
89772
89804
|
template <class T>
|
|
89773
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89774
|
-
|
|
89775
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89776
|
-
return PropagateDatePartStatistics<T, CenturyOperator>(child_stats);
|
|
89805
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89806
|
+
return PropagateDatePartStatistics<T, CenturyOperator>(input.child_stats);
|
|
89777
89807
|
}
|
|
89778
89808
|
};
|
|
89779
89809
|
|
|
@@ -89794,10 +89824,8 @@ struct DatePart {
|
|
|
89794
89824
|
}
|
|
89795
89825
|
|
|
89796
89826
|
template <class T>
|
|
89797
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89798
|
-
|
|
89799
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89800
|
-
return PropagateDatePartStatistics<T, MillenniumOperator>(child_stats);
|
|
89827
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89828
|
+
return PropagateDatePartStatistics<T, MillenniumOperator>(input.child_stats);
|
|
89801
89829
|
}
|
|
89802
89830
|
};
|
|
89803
89831
|
|
|
@@ -89813,11 +89841,9 @@ struct DatePart {
|
|
|
89813
89841
|
}
|
|
89814
89842
|
|
|
89815
89843
|
template <class T>
|
|
89816
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89817
|
-
FunctionData *bind_data,
|
|
89818
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89844
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89819
89845
|
// min/max of quarter operator is [1, 4]
|
|
89820
|
-
return PropagateSimpleDatePartStatistics<1, 4>(child_stats);
|
|
89846
|
+
return PropagateSimpleDatePartStatistics<1, 4>(input.child_stats);
|
|
89821
89847
|
}
|
|
89822
89848
|
};
|
|
89823
89849
|
|
|
@@ -89835,10 +89861,8 @@ struct DatePart {
|
|
|
89835
89861
|
}
|
|
89836
89862
|
|
|
89837
89863
|
template <class T>
|
|
89838
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89839
|
-
|
|
89840
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89841
|
-
return PropagateSimpleDatePartStatistics<0, 6>(child_stats);
|
|
89864
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89865
|
+
return PropagateSimpleDatePartStatistics<0, 6>(input.child_stats);
|
|
89842
89866
|
}
|
|
89843
89867
|
};
|
|
89844
89868
|
|
|
@@ -89850,10 +89874,8 @@ struct DatePart {
|
|
|
89850
89874
|
}
|
|
89851
89875
|
|
|
89852
89876
|
template <class T>
|
|
89853
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89854
|
-
|
|
89855
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89856
|
-
return PropagateSimpleDatePartStatistics<1, 7>(child_stats);
|
|
89877
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89878
|
+
return PropagateSimpleDatePartStatistics<1, 7>(input.child_stats);
|
|
89857
89879
|
}
|
|
89858
89880
|
};
|
|
89859
89881
|
|
|
@@ -89864,10 +89886,8 @@ struct DatePart {
|
|
|
89864
89886
|
}
|
|
89865
89887
|
|
|
89866
89888
|
template <class T>
|
|
89867
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89868
|
-
|
|
89869
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89870
|
-
return PropagateSimpleDatePartStatistics<1, 366>(child_stats);
|
|
89889
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89890
|
+
return PropagateSimpleDatePartStatistics<1, 366>(input.child_stats);
|
|
89871
89891
|
}
|
|
89872
89892
|
};
|
|
89873
89893
|
|
|
@@ -89878,10 +89898,8 @@ struct DatePart {
|
|
|
89878
89898
|
}
|
|
89879
89899
|
|
|
89880
89900
|
template <class T>
|
|
89881
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89882
|
-
|
|
89883
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89884
|
-
return PropagateSimpleDatePartStatistics<1, 54>(child_stats);
|
|
89901
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89902
|
+
return PropagateSimpleDatePartStatistics<1, 54>(input.child_stats);
|
|
89885
89903
|
}
|
|
89886
89904
|
};
|
|
89887
89905
|
|
|
@@ -89892,10 +89910,8 @@ struct DatePart {
|
|
|
89892
89910
|
}
|
|
89893
89911
|
|
|
89894
89912
|
template <class T>
|
|
89895
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89896
|
-
|
|
89897
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89898
|
-
return PropagateDatePartStatistics<T, ISOYearOperator>(child_stats);
|
|
89913
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89914
|
+
return PropagateDatePartStatistics<T, ISOYearOperator>(input.child_stats);
|
|
89899
89915
|
}
|
|
89900
89916
|
};
|
|
89901
89917
|
|
|
@@ -89913,10 +89929,8 @@ struct DatePart {
|
|
|
89913
89929
|
}
|
|
89914
89930
|
|
|
89915
89931
|
template <class T>
|
|
89916
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89917
|
-
|
|
89918
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89919
|
-
return PropagateDatePartStatistics<T, YearWeekOperator>(child_stats);
|
|
89932
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89933
|
+
return PropagateDatePartStatistics<T, YearWeekOperator>(input.child_stats);
|
|
89920
89934
|
}
|
|
89921
89935
|
};
|
|
89922
89936
|
|
|
@@ -89927,10 +89941,8 @@ struct DatePart {
|
|
|
89927
89941
|
}
|
|
89928
89942
|
|
|
89929
89943
|
template <class T>
|
|
89930
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89931
|
-
|
|
89932
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89933
|
-
return PropagateSimpleDatePartStatistics<0, 60000000>(child_stats);
|
|
89944
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89945
|
+
return PropagateSimpleDatePartStatistics<0, 60000000>(input.child_stats);
|
|
89934
89946
|
}
|
|
89935
89947
|
};
|
|
89936
89948
|
|
|
@@ -89941,10 +89953,8 @@ struct DatePart {
|
|
|
89941
89953
|
}
|
|
89942
89954
|
|
|
89943
89955
|
template <class T>
|
|
89944
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89945
|
-
|
|
89946
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89947
|
-
return PropagateSimpleDatePartStatistics<0, 60000>(child_stats);
|
|
89956
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89957
|
+
return PropagateSimpleDatePartStatistics<0, 60000>(input.child_stats);
|
|
89948
89958
|
}
|
|
89949
89959
|
};
|
|
89950
89960
|
|
|
@@ -89955,10 +89965,8 @@ struct DatePart {
|
|
|
89955
89965
|
}
|
|
89956
89966
|
|
|
89957
89967
|
template <class T>
|
|
89958
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89959
|
-
|
|
89960
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89961
|
-
return PropagateSimpleDatePartStatistics<0, 60>(child_stats);
|
|
89968
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89969
|
+
return PropagateSimpleDatePartStatistics<0, 60>(input.child_stats);
|
|
89962
89970
|
}
|
|
89963
89971
|
};
|
|
89964
89972
|
|
|
@@ -89969,10 +89977,8 @@ struct DatePart {
|
|
|
89969
89977
|
}
|
|
89970
89978
|
|
|
89971
89979
|
template <class T>
|
|
89972
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89973
|
-
|
|
89974
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89975
|
-
return PropagateSimpleDatePartStatistics<0, 60>(child_stats);
|
|
89980
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89981
|
+
return PropagateSimpleDatePartStatistics<0, 60>(input.child_stats);
|
|
89976
89982
|
}
|
|
89977
89983
|
};
|
|
89978
89984
|
|
|
@@ -89983,10 +89989,8 @@ struct DatePart {
|
|
|
89983
89989
|
}
|
|
89984
89990
|
|
|
89985
89991
|
template <class T>
|
|
89986
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
89987
|
-
|
|
89988
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
89989
|
-
return PropagateSimpleDatePartStatistics<0, 24>(child_stats);
|
|
89992
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
89993
|
+
return PropagateSimpleDatePartStatistics<0, 24>(input.child_stats);
|
|
89990
89994
|
}
|
|
89991
89995
|
};
|
|
89992
89996
|
|
|
@@ -89997,10 +90001,8 @@ struct DatePart {
|
|
|
89997
90001
|
}
|
|
89998
90002
|
|
|
89999
90003
|
template <class T>
|
|
90000
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
90001
|
-
|
|
90002
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
90003
|
-
return PropagateDatePartStatistics<T, EpochOperator>(child_stats);
|
|
90004
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
90005
|
+
return PropagateDatePartStatistics<T, EpochOperator>(input.child_stats);
|
|
90004
90006
|
}
|
|
90005
90007
|
};
|
|
90006
90008
|
|
|
@@ -90016,10 +90018,8 @@ struct DatePart {
|
|
|
90016
90018
|
}
|
|
90017
90019
|
|
|
90018
90020
|
template <class T>
|
|
90019
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
90020
|
-
|
|
90021
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
90022
|
-
return PropagateSimpleDatePartStatistics<0, 1>(child_stats);
|
|
90021
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
90022
|
+
return PropagateSimpleDatePartStatistics<0, 1>(input.child_stats);
|
|
90023
90023
|
}
|
|
90024
90024
|
};
|
|
90025
90025
|
|
|
@@ -90031,10 +90031,8 @@ struct DatePart {
|
|
|
90031
90031
|
}
|
|
90032
90032
|
|
|
90033
90033
|
template <class T>
|
|
90034
|
-
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context,
|
|
90035
|
-
|
|
90036
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
90037
|
-
return PropagateSimpleDatePartStatistics<0, 0>(child_stats);
|
|
90034
|
+
static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
90035
|
+
return PropagateSimpleDatePartStatistics<0, 0>(input.child_stats);
|
|
90038
90036
|
}
|
|
90039
90037
|
};
|
|
90040
90038
|
|
|
@@ -90488,12 +90486,10 @@ int64_t DatePart::EpochOperator::Operation(dtime_t input) {
|
|
|
90488
90486
|
}
|
|
90489
90487
|
|
|
90490
90488
|
template <>
|
|
90491
|
-
unique_ptr<BaseStatistics>
|
|
90492
|
-
|
|
90493
|
-
FunctionData *bind_data,
|
|
90494
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
90489
|
+
unique_ptr<BaseStatistics> DatePart::EpochOperator::PropagateStatistics<dtime_t>(ClientContext &context,
|
|
90490
|
+
FunctionStatisticsInput &input) {
|
|
90495
90491
|
// time seconds range over a single day
|
|
90496
|
-
return PropagateSimpleDatePartStatistics<0, 86400>(child_stats);
|
|
90492
|
+
return PropagateSimpleDatePartStatistics<0, 86400>(input.child_stats);
|
|
90497
90493
|
}
|
|
90498
90494
|
|
|
90499
90495
|
template <>
|
|
@@ -94247,9 +94243,9 @@ unique_ptr<FunctionData> StatsBind(ClientContext &context, ScalarFunction &bound
|
|
|
94247
94243
|
return make_unique<StatsBindData>();
|
|
94248
94244
|
}
|
|
94249
94245
|
|
|
94250
|
-
static unique_ptr<BaseStatistics> StatsPropagateStats(ClientContext &context,
|
|
94251
|
-
|
|
94252
|
-
|
|
94246
|
+
static unique_ptr<BaseStatistics> StatsPropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
94247
|
+
auto &child_stats = input.child_stats;
|
|
94248
|
+
auto &bind_data = input.bind_data;
|
|
94253
94249
|
if (child_stats[0]) {
|
|
94254
94250
|
auto &info = (StatsBindData &)*bind_data;
|
|
94255
94251
|
info.stats = child_stats[0]->ToString();
|
|
@@ -94889,9 +94885,8 @@ static unique_ptr<FunctionData> ListFlattenBind(ClientContext &context, ScalarFu
|
|
|
94889
94885
|
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
94890
94886
|
}
|
|
94891
94887
|
|
|
94892
|
-
static unique_ptr<BaseStatistics> ListFlattenStats(ClientContext &context,
|
|
94893
|
-
|
|
94894
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
94888
|
+
static unique_ptr<BaseStatistics> ListFlattenStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
94889
|
+
auto &child_stats = input.child_stats;
|
|
94895
94890
|
if (!child_stats[0]) {
|
|
94896
94891
|
return nullptr;
|
|
94897
94892
|
}
|
|
@@ -95495,9 +95490,8 @@ static unique_ptr<FunctionData> ListConcatBind(ClientContext &context, ScalarFun
|
|
|
95495
95490
|
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
95496
95491
|
}
|
|
95497
95492
|
|
|
95498
|
-
static unique_ptr<BaseStatistics> ListConcatStats(ClientContext &context,
|
|
95499
|
-
|
|
95500
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
95493
|
+
static unique_ptr<BaseStatistics> ListConcatStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
95494
|
+
auto &child_stats = input.child_stats;
|
|
95501
95495
|
D_ASSERT(child_stats.size() == 2);
|
|
95502
95496
|
if (!child_stats[0] || !child_stats[1]) {
|
|
95503
95497
|
return nullptr;
|
|
@@ -95735,9 +95729,8 @@ static unique_ptr<FunctionData> ListExtractBind(ClientContext &context, ScalarFu
|
|
|
95735
95729
|
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
95736
95730
|
}
|
|
95737
95731
|
|
|
95738
|
-
static unique_ptr<BaseStatistics> ListExtractStats(ClientContext &context,
|
|
95739
|
-
|
|
95740
|
-
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
95732
|
+
static unique_ptr<BaseStatistics> ListExtractStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
95733
|
+
auto &child_stats = input.child_stats;
|
|
95741
95734
|
if (!child_stats[0]) {
|
|
95742
95735
|
return nullptr;
|
|
95743
95736
|
}
|
|
@@ -96198,8 +96191,9 @@ static unique_ptr<FunctionData> ListValueBind(ClientContext &context, ScalarFunc
|
|
|
96198
96191
|
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
96199
96192
|
}
|
|
96200
96193
|
|
|
96201
|
-
unique_ptr<BaseStatistics> ListValueStats(ClientContext &context,
|
|
96202
|
-
|
|
96194
|
+
unique_ptr<BaseStatistics> ListValueStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
96195
|
+
auto &child_stats = input.child_stats;
|
|
96196
|
+
auto &expr = input.expr;
|
|
96203
96197
|
auto list_stats = make_unique<ListStatistics>(expr.return_type);
|
|
96204
96198
|
for (idx_t i = 0; i < child_stats.size(); i++) {
|
|
96205
96199
|
if (child_stats[i]) {
|
|
@@ -96252,17 +96246,20 @@ struct NumericRangeInfo {
|
|
|
96252
96246
|
if (start_value < end_value && increment_value < 0) {
|
|
96253
96247
|
return 0;
|
|
96254
96248
|
}
|
|
96255
|
-
|
|
96256
|
-
|
|
96257
|
-
|
|
96249
|
+
hugeint_t total_diff = AbsValue(hugeint_t(end_value) - hugeint_t(start_value));
|
|
96250
|
+
hugeint_t increment = AbsValue(hugeint_t(increment_value));
|
|
96251
|
+
hugeint_t total_values = total_diff / increment;
|
|
96258
96252
|
if (total_diff % increment == 0) {
|
|
96259
96253
|
if (inclusive_bound) {
|
|
96260
|
-
total_values
|
|
96254
|
+
total_values += 1;
|
|
96261
96255
|
}
|
|
96262
96256
|
} else {
|
|
96263
|
-
total_values
|
|
96257
|
+
total_values += 1;
|
|
96264
96258
|
}
|
|
96265
|
-
|
|
96259
|
+
if (total_values > NumericLimits<uint32_t>::Maximum()) {
|
|
96260
|
+
throw InvalidInputException("Lists larger than 2^32 elements are not supported");
|
|
96261
|
+
}
|
|
96262
|
+
return Hugeint::Cast<uint64_t>(total_values);
|
|
96266
96263
|
}
|
|
96267
96264
|
|
|
96268
96265
|
static void Increment(int64_t &input, int64_t increment) {
|
|
@@ -96308,12 +96305,18 @@ struct TimestampRangeInfo {
|
|
|
96308
96305
|
while (inclusive_bound ? start_value >= end_value : start_value > end_value) {
|
|
96309
96306
|
start_value = Interval::Add(start_value, increment_value);
|
|
96310
96307
|
total_values++;
|
|
96308
|
+
if (total_values > NumericLimits<uint32_t>::Maximum()) {
|
|
96309
|
+
throw InvalidInputException("Lists larger than 2^32 elements are not supported");
|
|
96310
|
+
}
|
|
96311
96311
|
}
|
|
96312
96312
|
} else {
|
|
96313
96313
|
// positive interval, start_value is going up
|
|
96314
96314
|
while (inclusive_bound ? start_value <= end_value : start_value < end_value) {
|
|
96315
96315
|
start_value = Interval::Add(start_value, increment_value);
|
|
96316
96316
|
total_values++;
|
|
96317
|
+
if (total_values > NumericLimits<uint32_t>::Maximum()) {
|
|
96318
|
+
throw InvalidInputException("Lists larger than 2^32 elements are not supported");
|
|
96319
|
+
}
|
|
96317
96320
|
}
|
|
96318
96321
|
}
|
|
96319
96322
|
return total_values;
|
|
@@ -96442,8 +96445,10 @@ static void ListRangeFunction(DataChunk &args, ExpressionState &state, Vector &r
|
|
|
96442
96445
|
|
|
96443
96446
|
typename OP::TYPE range_value = start_value;
|
|
96444
96447
|
for (idx_t range_idx = 0; range_idx < list_data[i].length; range_idx++) {
|
|
96448
|
+
if (range_idx > 0) {
|
|
96449
|
+
OP::Increment(range_value, increment);
|
|
96450
|
+
}
|
|
96445
96451
|
range_data[total_idx++] = range_value;
|
|
96446
|
-
OP::Increment(range_value, increment);
|
|
96447
96452
|
}
|
|
96448
96453
|
}
|
|
96449
96454
|
|
|
@@ -96903,6 +96908,7 @@ struct Atan2Fun {
|
|
|
96903
96908
|
|
|
96904
96909
|
|
|
96905
96910
|
|
|
96911
|
+
|
|
96906
96912
|
#include <cmath>
|
|
96907
96913
|
#include <errno.h>
|
|
96908
96914
|
|
|
@@ -96936,7 +96942,6 @@ static scalar_function_t GetScalarIntegerUnaryFunctionFixedReturn(const LogicalT
|
|
|
96936
96942
|
//===--------------------------------------------------------------------===//
|
|
96937
96943
|
// nextafter
|
|
96938
96944
|
//===--------------------------------------------------------------------===//
|
|
96939
|
-
|
|
96940
96945
|
struct NextAfterOperator {
|
|
96941
96946
|
template <class TA, class TB, class TR>
|
|
96942
96947
|
static inline TR Operation(TA base, TB exponent) {
|
|
@@ -96967,6 +96972,71 @@ void NextAfterFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
96967
96972
|
//===--------------------------------------------------------------------===//
|
|
96968
96973
|
// abs
|
|
96969
96974
|
//===--------------------------------------------------------------------===//
|
|
96975
|
+
static unique_ptr<BaseStatistics> PropagateAbsStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
96976
|
+
auto &child_stats = input.child_stats;
|
|
96977
|
+
auto &expr = input.expr;
|
|
96978
|
+
D_ASSERT(child_stats.size() == 1);
|
|
96979
|
+
// can only propagate stats if the children have stats
|
|
96980
|
+
if (!child_stats[0]) {
|
|
96981
|
+
return nullptr;
|
|
96982
|
+
}
|
|
96983
|
+
auto &lstats = (NumericStatistics &)*child_stats[0];
|
|
96984
|
+
Value new_min, new_max;
|
|
96985
|
+
bool potential_overflow = true;
|
|
96986
|
+
if (!lstats.min.IsNull() && !lstats.max.IsNull()) {
|
|
96987
|
+
switch (expr.return_type.InternalType()) {
|
|
96988
|
+
case PhysicalType::INT8:
|
|
96989
|
+
potential_overflow = lstats.min.GetValue<int8_t>() == NumericLimits<int8_t>::Minimum();
|
|
96990
|
+
break;
|
|
96991
|
+
case PhysicalType::INT16:
|
|
96992
|
+
potential_overflow = lstats.min.GetValue<int16_t>() == NumericLimits<int16_t>::Minimum();
|
|
96993
|
+
break;
|
|
96994
|
+
case PhysicalType::INT32:
|
|
96995
|
+
potential_overflow = lstats.min.GetValue<int32_t>() == NumericLimits<int32_t>::Minimum();
|
|
96996
|
+
break;
|
|
96997
|
+
case PhysicalType::INT64:
|
|
96998
|
+
potential_overflow = lstats.min.GetValue<int64_t>() == NumericLimits<int64_t>::Minimum();
|
|
96999
|
+
break;
|
|
97000
|
+
default:
|
|
97001
|
+
return nullptr;
|
|
97002
|
+
}
|
|
97003
|
+
}
|
|
97004
|
+
if (potential_overflow) {
|
|
97005
|
+
new_min = Value(expr.return_type);
|
|
97006
|
+
new_max = Value(expr.return_type);
|
|
97007
|
+
} else {
|
|
97008
|
+
// no potential overflow
|
|
97009
|
+
|
|
97010
|
+
// compute stats
|
|
97011
|
+
auto current_min = lstats.min.GetValue<int64_t>();
|
|
97012
|
+
auto current_max = lstats.max.GetValue<int64_t>();
|
|
97013
|
+
|
|
97014
|
+
int64_t min_val, max_val;
|
|
97015
|
+
|
|
97016
|
+
if (current_min < 0 && current_max < 0) {
|
|
97017
|
+
// if both min and max are below zero, then min=abs(cur_max) and max=abs(cur_min)
|
|
97018
|
+
min_val = AbsValue(current_max);
|
|
97019
|
+
max_val = AbsValue(current_min);
|
|
97020
|
+
} else if (current_min < 0) {
|
|
97021
|
+
D_ASSERT(current_max >= 0);
|
|
97022
|
+
// if min is below zero and max is above 0, then min=0 and max=max(cur_max, abs(cur_min))
|
|
97023
|
+
min_val = 0;
|
|
97024
|
+
max_val = MaxValue(AbsValue(current_min), current_max);
|
|
97025
|
+
} else {
|
|
97026
|
+
// if both current_min and current_max are > 0, then the abs is a no-op and can be removed entirely
|
|
97027
|
+
*input.expr_ptr = move(input.expr.children[0]);
|
|
97028
|
+
return move(child_stats[0]);
|
|
97029
|
+
}
|
|
97030
|
+
new_min = Value::Numeric(expr.return_type, min_val);
|
|
97031
|
+
new_max = Value::Numeric(expr.return_type, max_val);
|
|
97032
|
+
expr.function.function = ScalarFunction::GetScalarUnaryFunction<AbsOperator>(expr.return_type);
|
|
97033
|
+
}
|
|
97034
|
+
auto stats =
|
|
97035
|
+
make_unique<NumericStatistics>(expr.return_type, move(new_min), move(new_max), StatisticsType::LOCAL_STATS);
|
|
97036
|
+
stats->validity_stats = lstats.validity_stats->Copy();
|
|
97037
|
+
return move(stats);
|
|
97038
|
+
}
|
|
97039
|
+
|
|
96970
97040
|
template <class OP>
|
|
96971
97041
|
unique_ptr<FunctionData> DecimalUnaryOpBind(ClientContext &context, ScalarFunction &bound_function,
|
|
96972
97042
|
vector<unique_ptr<Expression>> &arguments) {
|
|
@@ -96993,10 +97063,28 @@ unique_ptr<FunctionData> DecimalUnaryOpBind(ClientContext &context, ScalarFuncti
|
|
|
96993
97063
|
void AbsFun::RegisterFunction(BuiltinFunctions &set) {
|
|
96994
97064
|
ScalarFunctionSet abs("abs");
|
|
96995
97065
|
for (auto &type : LogicalType::Numeric()) {
|
|
96996
|
-
|
|
97066
|
+
switch (type.id()) {
|
|
97067
|
+
case LogicalTypeId::DECIMAL:
|
|
96997
97068
|
abs.AddFunction(ScalarFunction({type}, type, nullptr, false, false, DecimalUnaryOpBind<AbsOperator>));
|
|
96998
|
-
|
|
97069
|
+
break;
|
|
97070
|
+
case LogicalTypeId::TINYINT:
|
|
97071
|
+
case LogicalTypeId::SMALLINT:
|
|
97072
|
+
case LogicalTypeId::INTEGER:
|
|
97073
|
+
case LogicalTypeId::BIGINT: {
|
|
97074
|
+
ScalarFunction func({type}, type, ScalarFunction::GetScalarUnaryFunction<TryAbsOperator>(type));
|
|
97075
|
+
func.statistics = PropagateAbsStats;
|
|
97076
|
+
abs.AddFunction(func);
|
|
97077
|
+
break;
|
|
97078
|
+
}
|
|
97079
|
+
case LogicalTypeId::UTINYINT:
|
|
97080
|
+
case LogicalTypeId::USMALLINT:
|
|
97081
|
+
case LogicalTypeId::UINTEGER:
|
|
97082
|
+
case LogicalTypeId::UBIGINT:
|
|
97083
|
+
abs.AddFunction(ScalarFunction({type}, type, ScalarFunction::NopFunction));
|
|
97084
|
+
break;
|
|
97085
|
+
default:
|
|
96999
97086
|
abs.AddFunction(ScalarFunction({type}, type, ScalarFunction::GetScalarUnaryFunction<AbsOperator>(type)));
|
|
97087
|
+
break;
|
|
97000
97088
|
}
|
|
97001
97089
|
}
|
|
97002
97090
|
set.AddFunction(abs);
|
|
@@ -98601,9 +98689,9 @@ struct SubtractPropagateStatistics {
|
|
|
98601
98689
|
};
|
|
98602
98690
|
|
|
98603
98691
|
template <class OP, class PROPAGATE, class BASEOP>
|
|
98604
|
-
static unique_ptr<BaseStatistics> PropagateNumericStats(ClientContext &context,
|
|
98605
|
-
|
|
98606
|
-
|
|
98692
|
+
static unique_ptr<BaseStatistics> PropagateNumericStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
98693
|
+
auto &child_stats = input.child_stats;
|
|
98694
|
+
auto &expr = input.expr;
|
|
98607
98695
|
D_ASSERT(child_stats.size() == 2);
|
|
98608
98696
|
// can only propagate stats if the children have stats
|
|
98609
98697
|
if (!child_stats[0] || !child_stats[1]) {
|
|
@@ -98914,9 +99002,9 @@ struct NegatePropagateStatistics {
|
|
|
98914
99002
|
}
|
|
98915
99003
|
};
|
|
98916
99004
|
|
|
98917
|
-
static unique_ptr<BaseStatistics> NegateBindStatistics(ClientContext &context,
|
|
98918
|
-
|
|
98919
|
-
|
|
99005
|
+
static unique_ptr<BaseStatistics> NegateBindStatistics(ClientContext &context, FunctionStatisticsInput &input) {
|
|
99006
|
+
auto &child_stats = input.child_stats;
|
|
99007
|
+
auto &expr = input.expr;
|
|
98920
99008
|
D_ASSERT(child_stats.size() == 1);
|
|
98921
99009
|
// can only propagate stats if the children have stats
|
|
98922
99010
|
if (!child_stats[0]) {
|
|
@@ -100445,9 +100533,9 @@ static void CaseConvertFunctionASCII(DataChunk &args, ExpressionState &state, Ve
|
|
|
100445
100533
|
}
|
|
100446
100534
|
|
|
100447
100535
|
template <bool IS_UPPER>
|
|
100448
|
-
static unique_ptr<BaseStatistics> CaseConvertPropagateStats(ClientContext &context,
|
|
100449
|
-
|
|
100450
|
-
|
|
100536
|
+
static unique_ptr<BaseStatistics> CaseConvertPropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
100537
|
+
auto &child_stats = input.child_stats;
|
|
100538
|
+
auto &expr = input.expr;
|
|
100451
100539
|
D_ASSERT(child_stats.size() == 1);
|
|
100452
100540
|
// can only propagate stats if the children have stats
|
|
100453
100541
|
if (!child_stats[0]) {
|
|
@@ -100969,9 +101057,9 @@ struct InstrAsciiOperator {
|
|
|
100969
101057
|
}
|
|
100970
101058
|
};
|
|
100971
101059
|
|
|
100972
|
-
static unique_ptr<BaseStatistics> InStrPropagateStats(ClientContext &context,
|
|
100973
|
-
|
|
100974
|
-
|
|
101060
|
+
static unique_ptr<BaseStatistics> InStrPropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
101061
|
+
auto &child_stats = input.child_stats;
|
|
101062
|
+
auto &expr = input.expr;
|
|
100975
101063
|
D_ASSERT(child_stats.size() == 2);
|
|
100976
101064
|
// can only propagate stats if the children have stats
|
|
100977
101065
|
if (!child_stats[0]) {
|
|
@@ -101177,9 +101265,9 @@ struct BitLenOperator {
|
|
|
101177
101265
|
}
|
|
101178
101266
|
};
|
|
101179
101267
|
|
|
101180
|
-
static unique_ptr<BaseStatistics> LengthPropagateStats(ClientContext &context,
|
|
101181
|
-
|
|
101182
|
-
|
|
101268
|
+
static unique_ptr<BaseStatistics> LengthPropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
101269
|
+
auto &child_stats = input.child_stats;
|
|
101270
|
+
auto &expr = input.expr;
|
|
101183
101271
|
D_ASSERT(child_stats.size() == 1);
|
|
101184
101272
|
// can only propagate stats if the children have stats
|
|
101185
101273
|
if (!child_stats[0]) {
|
|
@@ -101806,9 +101894,9 @@ static void LikeEscapeFunction(DataChunk &args, ExpressionState &state, Vector &
|
|
|
101806
101894
|
}
|
|
101807
101895
|
|
|
101808
101896
|
template <class ASCII_OP>
|
|
101809
|
-
static unique_ptr<BaseStatistics> ILikePropagateStats(ClientContext &context,
|
|
101810
|
-
|
|
101811
|
-
|
|
101897
|
+
static unique_ptr<BaseStatistics> ILikePropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
101898
|
+
auto &child_stats = input.child_stats;
|
|
101899
|
+
auto &expr = input.expr;
|
|
101812
101900
|
D_ASSERT(child_stats.size() >= 1);
|
|
101813
101901
|
// can only propagate stats if the children have stats
|
|
101814
101902
|
if (!child_stats[0]) {
|
|
@@ -103518,9 +103606,9 @@ static void SubstringFunctionASCII(DataChunk &args, ExpressionState &state, Vect
|
|
|
103518
103606
|
}
|
|
103519
103607
|
}
|
|
103520
103608
|
|
|
103521
|
-
static unique_ptr<BaseStatistics> SubstringPropagateStats(ClientContext &context,
|
|
103522
|
-
|
|
103523
|
-
|
|
103609
|
+
static unique_ptr<BaseStatistics> SubstringPropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
103610
|
+
auto &child_stats = input.child_stats;
|
|
103611
|
+
auto &expr = input.expr;
|
|
103524
103612
|
// can only propagate stats if the children have stats
|
|
103525
103613
|
if (!child_stats[0]) {
|
|
103526
103614
|
return nullptr;
|
|
@@ -103936,9 +104024,9 @@ static unique_ptr<FunctionData> StructExtractBind(ClientContext &context, Scalar
|
|
|
103936
104024
|
return make_unique<StructExtractBindData>(key, key_index, return_type);
|
|
103937
104025
|
}
|
|
103938
104026
|
|
|
103939
|
-
static unique_ptr<BaseStatistics> PropagateStructExtractStats(ClientContext &context,
|
|
103940
|
-
|
|
103941
|
-
|
|
104027
|
+
static unique_ptr<BaseStatistics> PropagateStructExtractStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
104028
|
+
auto &child_stats = input.child_stats;
|
|
104029
|
+
auto &bind_data = input.bind_data;
|
|
103942
104030
|
if (!child_stats[0]) {
|
|
103943
104031
|
return nullptr;
|
|
103944
104032
|
}
|
|
@@ -104022,8 +104110,9 @@ static unique_ptr<FunctionData> StructPackBind(ClientContext &context, ScalarFun
|
|
|
104022
104110
|
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
104023
104111
|
}
|
|
104024
104112
|
|
|
104025
|
-
unique_ptr<BaseStatistics> StructPackStats(ClientContext &context,
|
|
104026
|
-
|
|
104113
|
+
unique_ptr<BaseStatistics> StructPackStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
104114
|
+
auto &child_stats = input.child_stats;
|
|
104115
|
+
auto &expr = input.expr;
|
|
104027
104116
|
auto struct_stats = make_unique<StructStatistics>(expr.return_type);
|
|
104028
104117
|
D_ASSERT(child_stats.size() == struct_stats->child_stats.size());
|
|
104029
104118
|
for (idx_t i = 0; i < struct_stats->child_stats.size(); i++) {
|
|
@@ -139183,7 +139272,8 @@ unique_ptr<BaseStatistics> StatisticsPropagator::PropagateExpression(BoundFuncti
|
|
|
139183
139272
|
if (!func.function.statistics) {
|
|
139184
139273
|
return nullptr;
|
|
139185
139274
|
}
|
|
139186
|
-
|
|
139275
|
+
FunctionStatisticsInput input(func, func.bind_info.get(), stats, expr_ptr);
|
|
139276
|
+
return func.function.statistics(context, input);
|
|
139187
139277
|
}
|
|
139188
139278
|
|
|
139189
139279
|
} // namespace duckdb
|