duckdb 0.3.5-dev1206.0 → 0.3.5-dev1232.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/src/duckdb.cpp CHANGED
@@ -47235,17 +47235,6 @@ const LogicalType &VectorCache::GetType() const {
47235
47235
 
47236
47236
  namespace duckdb {
47237
47237
 
47238
- // We disable Wexit-time-destructors here
47239
- // Otherwise we get a warning about the two selection vectors (ZERO/INCREMENTAL_SELECTION_VECTOR)
47240
- // While the SelectionVector does have a non-trivial destructor
47241
- // This only does a memory de-allocation if the selection vectors own their data (i.e. selection_data is not null)
47242
- // In the case of the FlatVector/ConstantVector, they point towards static regions of memory
47243
- // Hence in this case these cause no problems, as the destructors are non-trivial but effectively nops
47244
- #ifdef __clang__
47245
- #pragma clang diagnostic push
47246
- #pragma clang diagnostic ignored "-Wexit-time-destructors"
47247
- #endif
47248
-
47249
47238
  const SelectionVector *ConstantVector::ZeroSelectionVector() {
47250
47239
  static const SelectionVector ZERO_SELECTION_VECTOR = SelectionVector((sel_t *)ConstantVector::ZERO_VECTOR);
47251
47240
  return &ZERO_SELECTION_VECTOR;
@@ -47258,10 +47247,6 @@ const SelectionVector *FlatVector::IncrementalSelectionVector() {
47258
47247
 
47259
47248
  const sel_t ConstantVector::ZERO_VECTOR[STANDARD_VECTOR_SIZE] = {0};
47260
47249
 
47261
- #ifdef __clang__
47262
- #pragma clang diagnostic pop
47263
- #endif
47264
-
47265
47250
  } // namespace duckdb
47266
47251
 
47267
47252
 
@@ -84246,6 +84231,7 @@ void ModeFun::RegisterFunction(BuiltinFunctions &set) {
84246
84231
 
84247
84232
 
84248
84233
 
84234
+
84249
84235
  namespace duckdb {
84250
84236
 
84251
84237
  struct AbsOperator {
@@ -84256,21 +84242,60 @@ struct AbsOperator {
84256
84242
  };
84257
84243
 
84258
84244
  template <>
84259
- inline hugeint_t AbsOperator::Operation(const hugeint_t &input) {
84245
+ inline hugeint_t AbsOperator::Operation(hugeint_t input) {
84260
84246
  const hugeint_t zero(0);
84261
- return (input < zero) ? (zero - input) : input;
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;
84262
84279
  }
84263
84280
 
84264
84281
  template <>
84265
- inline dtime_t AbsOperator::Operation(const dtime_t &input) {
84266
- return dtime_t(AbsOperator::Operation<int64_t, int64_t>(input.micros));
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;
84287
+ }
84288
+
84289
+ template <>
84290
+ inline dtime_t TryAbsOperator::Operation(dtime_t input) {
84291
+ return dtime_t(TryAbsOperator::Operation<int64_t, int64_t>(input.micros));
84267
84292
  }
84268
84293
 
84269
84294
  template <>
84270
- inline interval_t AbsOperator::Operation(const interval_t &input) {
84271
- return {AbsOperator::Operation<int32_t, int32_t>(input.months),
84272
- AbsOperator::Operation<int32_t, int32_t>(input.days),
84273
- AbsOperator::Operation<int64_t, int64_t>(input.micros)};
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)};
84274
84299
  }
84275
84300
 
84276
84301
  } // namespace duckdb
@@ -85168,7 +85193,7 @@ struct MadAccessor {
85168
85193
 
85169
85194
  inline RESULT_TYPE operator()(const INPUT_TYPE &input) const {
85170
85195
  const auto delta = input - median;
85171
- return AbsOperator::Operation<RESULT_TYPE, RESULT_TYPE>(delta);
85196
+ return TryAbsOperator::Operation<RESULT_TYPE, RESULT_TYPE>(delta);
85172
85197
  }
85173
85198
  };
85174
85199
 
@@ -85183,7 +85208,7 @@ struct MadAccessor<hugeint_t, double, double> {
85183
85208
  }
85184
85209
  inline RESULT_TYPE operator()(const INPUT_TYPE &input) const {
85185
85210
  const auto delta = Hugeint::Cast<double>(input) - median;
85186
- return AbsOperator::Operation<double, double>(delta);
85211
+ return TryAbsOperator::Operation<double, double>(delta);
85187
85212
  }
85188
85213
  };
85189
85214
 
@@ -85199,7 +85224,7 @@ struct MadAccessor<date_t, interval_t, timestamp_t> {
85199
85224
  inline RESULT_TYPE operator()(const INPUT_TYPE &input) const {
85200
85225
  const auto dt = Cast::Operation<date_t, timestamp_t>(input);
85201
85226
  const auto delta = dt - median;
85202
- return Interval::FromMicro(AbsOperator::Operation<int64_t, int64_t>(delta));
85227
+ return Interval::FromMicro(TryAbsOperator::Operation<int64_t, int64_t>(delta));
85203
85228
  }
85204
85229
  };
85205
85230
 
@@ -85214,7 +85239,7 @@ struct MadAccessor<timestamp_t, interval_t, timestamp_t> {
85214
85239
  }
85215
85240
  inline RESULT_TYPE operator()(const INPUT_TYPE &input) const {
85216
85241
  const auto delta = input - median;
85217
- return Interval::FromMicro(AbsOperator::Operation<int64_t, int64_t>(delta));
85242
+ return Interval::FromMicro(TryAbsOperator::Operation<int64_t, int64_t>(delta));
85218
85243
  }
85219
85244
  };
85220
85245
 
@@ -85229,7 +85254,7 @@ struct MadAccessor<dtime_t, interval_t, dtime_t> {
85229
85254
  }
85230
85255
  inline RESULT_TYPE operator()(const INPUT_TYPE &input) const {
85231
85256
  const auto delta = input - median;
85232
- return Interval::FromMicro(AbsOperator::Operation<int64_t, int64_t>(delta));
85257
+ return Interval::FromMicro(TryAbsOperator::Operation<int64_t, int64_t>(delta));
85233
85258
  }
85234
85259
  };
85235
85260
 
@@ -89705,10 +89730,8 @@ struct DatePart {
89705
89730
  }
89706
89731
 
89707
89732
  template <class T>
89708
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89709
- FunctionData *bind_data,
89710
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89711
- return PropagateDatePartStatistics<T, YearOperator>(child_stats);
89733
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89734
+ return PropagateDatePartStatistics<T, YearOperator>(input.child_stats);
89712
89735
  }
89713
89736
  };
89714
89737
 
@@ -89719,11 +89742,9 @@ struct DatePart {
89719
89742
  }
89720
89743
 
89721
89744
  template <class T>
89722
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89723
- FunctionData *bind_data,
89724
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89745
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89725
89746
  // min/max of month operator is [1, 12]
89726
- return PropagateSimpleDatePartStatistics<1, 12>(child_stats);
89747
+ return PropagateSimpleDatePartStatistics<1, 12>(input.child_stats);
89727
89748
  }
89728
89749
  };
89729
89750
 
@@ -89734,11 +89755,9 @@ struct DatePart {
89734
89755
  }
89735
89756
 
89736
89757
  template <class T>
89737
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89738
- FunctionData *bind_data,
89739
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89758
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89740
89759
  // min/max of day operator is [1, 31]
89741
- return PropagateSimpleDatePartStatistics<1, 31>(child_stats);
89760
+ return PropagateSimpleDatePartStatistics<1, 31>(input.child_stats);
89742
89761
  }
89743
89762
  };
89744
89763
 
@@ -89755,10 +89774,8 @@ struct DatePart {
89755
89774
  }
89756
89775
 
89757
89776
  template <class T>
89758
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89759
- FunctionData *bind_data,
89760
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89761
- return PropagateDatePartStatistics<T, DecadeOperator>(child_stats);
89777
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89778
+ return PropagateDatePartStatistics<T, DecadeOperator>(input.child_stats);
89762
89779
  }
89763
89780
  };
89764
89781
 
@@ -89785,10 +89802,8 @@ struct DatePart {
89785
89802
  }
89786
89803
 
89787
89804
  template <class T>
89788
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89789
- FunctionData *bind_data,
89790
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89791
- return PropagateDatePartStatistics<T, CenturyOperator>(child_stats);
89805
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89806
+ return PropagateDatePartStatistics<T, CenturyOperator>(input.child_stats);
89792
89807
  }
89793
89808
  };
89794
89809
 
@@ -89809,10 +89824,8 @@ struct DatePart {
89809
89824
  }
89810
89825
 
89811
89826
  template <class T>
89812
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89813
- FunctionData *bind_data,
89814
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89815
- return PropagateDatePartStatistics<T, MillenniumOperator>(child_stats);
89827
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89828
+ return PropagateDatePartStatistics<T, MillenniumOperator>(input.child_stats);
89816
89829
  }
89817
89830
  };
89818
89831
 
@@ -89828,11 +89841,9 @@ struct DatePart {
89828
89841
  }
89829
89842
 
89830
89843
  template <class T>
89831
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89832
- FunctionData *bind_data,
89833
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89844
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89834
89845
  // min/max of quarter operator is [1, 4]
89835
- return PropagateSimpleDatePartStatistics<1, 4>(child_stats);
89846
+ return PropagateSimpleDatePartStatistics<1, 4>(input.child_stats);
89836
89847
  }
89837
89848
  };
89838
89849
 
@@ -89850,10 +89861,8 @@ struct DatePart {
89850
89861
  }
89851
89862
 
89852
89863
  template <class T>
89853
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89854
- FunctionData *bind_data,
89855
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89856
- return PropagateSimpleDatePartStatistics<0, 6>(child_stats);
89864
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89865
+ return PropagateSimpleDatePartStatistics<0, 6>(input.child_stats);
89857
89866
  }
89858
89867
  };
89859
89868
 
@@ -89865,10 +89874,8 @@ struct DatePart {
89865
89874
  }
89866
89875
 
89867
89876
  template <class T>
89868
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89869
- FunctionData *bind_data,
89870
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89871
- return PropagateSimpleDatePartStatistics<1, 7>(child_stats);
89877
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89878
+ return PropagateSimpleDatePartStatistics<1, 7>(input.child_stats);
89872
89879
  }
89873
89880
  };
89874
89881
 
@@ -89879,10 +89886,8 @@ struct DatePart {
89879
89886
  }
89880
89887
 
89881
89888
  template <class T>
89882
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89883
- FunctionData *bind_data,
89884
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89885
- return PropagateSimpleDatePartStatistics<1, 366>(child_stats);
89889
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89890
+ return PropagateSimpleDatePartStatistics<1, 366>(input.child_stats);
89886
89891
  }
89887
89892
  };
89888
89893
 
@@ -89893,10 +89898,8 @@ struct DatePart {
89893
89898
  }
89894
89899
 
89895
89900
  template <class T>
89896
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89897
- FunctionData *bind_data,
89898
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89899
- return PropagateSimpleDatePartStatistics<1, 54>(child_stats);
89901
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89902
+ return PropagateSimpleDatePartStatistics<1, 54>(input.child_stats);
89900
89903
  }
89901
89904
  };
89902
89905
 
@@ -89907,10 +89910,8 @@ struct DatePart {
89907
89910
  }
89908
89911
 
89909
89912
  template <class T>
89910
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89911
- FunctionData *bind_data,
89912
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89913
- return PropagateDatePartStatistics<T, ISOYearOperator>(child_stats);
89913
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89914
+ return PropagateDatePartStatistics<T, ISOYearOperator>(input.child_stats);
89914
89915
  }
89915
89916
  };
89916
89917
 
@@ -89928,10 +89929,8 @@ struct DatePart {
89928
89929
  }
89929
89930
 
89930
89931
  template <class T>
89931
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89932
- FunctionData *bind_data,
89933
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89934
- return PropagateDatePartStatistics<T, YearWeekOperator>(child_stats);
89932
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89933
+ return PropagateDatePartStatistics<T, YearWeekOperator>(input.child_stats);
89935
89934
  }
89936
89935
  };
89937
89936
 
@@ -89942,10 +89941,8 @@ struct DatePart {
89942
89941
  }
89943
89942
 
89944
89943
  template <class T>
89945
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89946
- FunctionData *bind_data,
89947
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89948
- return PropagateSimpleDatePartStatistics<0, 60000000>(child_stats);
89944
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89945
+ return PropagateSimpleDatePartStatistics<0, 60000000>(input.child_stats);
89949
89946
  }
89950
89947
  };
89951
89948
 
@@ -89956,10 +89953,8 @@ struct DatePart {
89956
89953
  }
89957
89954
 
89958
89955
  template <class T>
89959
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89960
- FunctionData *bind_data,
89961
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89962
- return PropagateSimpleDatePartStatistics<0, 60000>(child_stats);
89956
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89957
+ return PropagateSimpleDatePartStatistics<0, 60000>(input.child_stats);
89963
89958
  }
89964
89959
  };
89965
89960
 
@@ -89970,10 +89965,8 @@ struct DatePart {
89970
89965
  }
89971
89966
 
89972
89967
  template <class T>
89973
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89974
- FunctionData *bind_data,
89975
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89976
- return PropagateSimpleDatePartStatistics<0, 60>(child_stats);
89968
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89969
+ return PropagateSimpleDatePartStatistics<0, 60>(input.child_stats);
89977
89970
  }
89978
89971
  };
89979
89972
 
@@ -89984,10 +89977,8 @@ struct DatePart {
89984
89977
  }
89985
89978
 
89986
89979
  template <class T>
89987
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
89988
- FunctionData *bind_data,
89989
- vector<unique_ptr<BaseStatistics>> &child_stats) {
89990
- return PropagateSimpleDatePartStatistics<0, 60>(child_stats);
89980
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89981
+ return PropagateSimpleDatePartStatistics<0, 60>(input.child_stats);
89991
89982
  }
89992
89983
  };
89993
89984
 
@@ -89998,10 +89989,8 @@ struct DatePart {
89998
89989
  }
89999
89990
 
90000
89991
  template <class T>
90001
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
90002
- FunctionData *bind_data,
90003
- vector<unique_ptr<BaseStatistics>> &child_stats) {
90004
- return PropagateSimpleDatePartStatistics<0, 24>(child_stats);
89992
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
89993
+ return PropagateSimpleDatePartStatistics<0, 24>(input.child_stats);
90005
89994
  }
90006
89995
  };
90007
89996
 
@@ -90012,10 +90001,8 @@ struct DatePart {
90012
90001
  }
90013
90002
 
90014
90003
  template <class T>
90015
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
90016
- FunctionData *bind_data,
90017
- vector<unique_ptr<BaseStatistics>> &child_stats) {
90018
- return PropagateDatePartStatistics<T, EpochOperator>(child_stats);
90004
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
90005
+ return PropagateDatePartStatistics<T, EpochOperator>(input.child_stats);
90019
90006
  }
90020
90007
  };
90021
90008
 
@@ -90031,10 +90018,8 @@ struct DatePart {
90031
90018
  }
90032
90019
 
90033
90020
  template <class T>
90034
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
90035
- FunctionData *bind_data,
90036
- vector<unique_ptr<BaseStatistics>> &child_stats) {
90037
- return PropagateSimpleDatePartStatistics<0, 1>(child_stats);
90021
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
90022
+ return PropagateSimpleDatePartStatistics<0, 1>(input.child_stats);
90038
90023
  }
90039
90024
  };
90040
90025
 
@@ -90046,10 +90031,8 @@ struct DatePart {
90046
90031
  }
90047
90032
 
90048
90033
  template <class T>
90049
- static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
90050
- FunctionData *bind_data,
90051
- vector<unique_ptr<BaseStatistics>> &child_stats) {
90052
- return PropagateSimpleDatePartStatistics<0, 0>(child_stats);
90034
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, FunctionStatisticsInput &input) {
90035
+ return PropagateSimpleDatePartStatistics<0, 0>(input.child_stats);
90053
90036
  }
90054
90037
  };
90055
90038
 
@@ -90503,12 +90486,10 @@ int64_t DatePart::EpochOperator::Operation(dtime_t input) {
90503
90486
  }
90504
90487
 
90505
90488
  template <>
90506
- unique_ptr<BaseStatistics>
90507
- DatePart::EpochOperator::PropagateStatistics<dtime_t>(ClientContext &context, BoundFunctionExpression &expr,
90508
- FunctionData *bind_data,
90509
- vector<unique_ptr<BaseStatistics>> &child_stats) {
90489
+ unique_ptr<BaseStatistics> DatePart::EpochOperator::PropagateStatistics<dtime_t>(ClientContext &context,
90490
+ FunctionStatisticsInput &input) {
90510
90491
  // time seconds range over a single day
90511
- return PropagateSimpleDatePartStatistics<0, 86400>(child_stats);
90492
+ return PropagateSimpleDatePartStatistics<0, 86400>(input.child_stats);
90512
90493
  }
90513
90494
 
90514
90495
  template <>
@@ -94262,9 +94243,9 @@ unique_ptr<FunctionData> StatsBind(ClientContext &context, ScalarFunction &bound
94262
94243
  return make_unique<StatsBindData>();
94263
94244
  }
94264
94245
 
94265
- static unique_ptr<BaseStatistics> StatsPropagateStats(ClientContext &context, BoundFunctionExpression &expr,
94266
- FunctionData *bind_data,
94267
- vector<unique_ptr<BaseStatistics>> &child_stats) {
94246
+ static unique_ptr<BaseStatistics> StatsPropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
94247
+ auto &child_stats = input.child_stats;
94248
+ auto &bind_data = input.bind_data;
94268
94249
  if (child_stats[0]) {
94269
94250
  auto &info = (StatsBindData &)*bind_data;
94270
94251
  info.stats = child_stats[0]->ToString();
@@ -94904,9 +94885,8 @@ static unique_ptr<FunctionData> ListFlattenBind(ClientContext &context, ScalarFu
94904
94885
  return make_unique<VariableReturnBindData>(bound_function.return_type);
94905
94886
  }
94906
94887
 
94907
- static unique_ptr<BaseStatistics> ListFlattenStats(ClientContext &context, BoundFunctionExpression &expr,
94908
- FunctionData *bind_data,
94909
- vector<unique_ptr<BaseStatistics>> &child_stats) {
94888
+ static unique_ptr<BaseStatistics> ListFlattenStats(ClientContext &context, FunctionStatisticsInput &input) {
94889
+ auto &child_stats = input.child_stats;
94910
94890
  if (!child_stats[0]) {
94911
94891
  return nullptr;
94912
94892
  }
@@ -95510,9 +95490,8 @@ static unique_ptr<FunctionData> ListConcatBind(ClientContext &context, ScalarFun
95510
95490
  return make_unique<VariableReturnBindData>(bound_function.return_type);
95511
95491
  }
95512
95492
 
95513
- static unique_ptr<BaseStatistics> ListConcatStats(ClientContext &context, BoundFunctionExpression &expr,
95514
- FunctionData *bind_data,
95515
- vector<unique_ptr<BaseStatistics>> &child_stats) {
95493
+ static unique_ptr<BaseStatistics> ListConcatStats(ClientContext &context, FunctionStatisticsInput &input) {
95494
+ auto &child_stats = input.child_stats;
95516
95495
  D_ASSERT(child_stats.size() == 2);
95517
95496
  if (!child_stats[0] || !child_stats[1]) {
95518
95497
  return nullptr;
@@ -95750,9 +95729,8 @@ static unique_ptr<FunctionData> ListExtractBind(ClientContext &context, ScalarFu
95750
95729
  return make_unique<VariableReturnBindData>(bound_function.return_type);
95751
95730
  }
95752
95731
 
95753
- static unique_ptr<BaseStatistics> ListExtractStats(ClientContext &context, BoundFunctionExpression &expr,
95754
- FunctionData *bind_data,
95755
- vector<unique_ptr<BaseStatistics>> &child_stats) {
95732
+ static unique_ptr<BaseStatistics> ListExtractStats(ClientContext &context, FunctionStatisticsInput &input) {
95733
+ auto &child_stats = input.child_stats;
95756
95734
  if (!child_stats[0]) {
95757
95735
  return nullptr;
95758
95736
  }
@@ -96213,8 +96191,9 @@ static unique_ptr<FunctionData> ListValueBind(ClientContext &context, ScalarFunc
96213
96191
  return make_unique<VariableReturnBindData>(bound_function.return_type);
96214
96192
  }
96215
96193
 
96216
- unique_ptr<BaseStatistics> ListValueStats(ClientContext &context, BoundFunctionExpression &expr,
96217
- FunctionData *bind_data, vector<unique_ptr<BaseStatistics>> &child_stats) {
96194
+ unique_ptr<BaseStatistics> ListValueStats(ClientContext &context, FunctionStatisticsInput &input) {
96195
+ auto &child_stats = input.child_stats;
96196
+ auto &expr = input.expr;
96218
96197
  auto list_stats = make_unique<ListStatistics>(expr.return_type);
96219
96198
  for (idx_t i = 0; i < child_stats.size(); i++) {
96220
96199
  if (child_stats[i]) {
@@ -96267,17 +96246,20 @@ struct NumericRangeInfo {
96267
96246
  if (start_value < end_value && increment_value < 0) {
96268
96247
  return 0;
96269
96248
  }
96270
- int64_t total_diff = AbsValue(end_value - start_value);
96271
- int64_t increment = AbsValue(increment_value);
96272
- int64_t total_values = total_diff / increment;
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;
96273
96252
  if (total_diff % increment == 0) {
96274
96253
  if (inclusive_bound) {
96275
- total_values++;
96254
+ total_values += 1;
96276
96255
  }
96277
96256
  } else {
96278
- total_values++;
96257
+ total_values += 1;
96279
96258
  }
96280
- return total_values;
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);
96281
96263
  }
96282
96264
 
96283
96265
  static void Increment(int64_t &input, int64_t increment) {
@@ -96323,12 +96305,18 @@ struct TimestampRangeInfo {
96323
96305
  while (inclusive_bound ? start_value >= end_value : start_value > end_value) {
96324
96306
  start_value = Interval::Add(start_value, increment_value);
96325
96307
  total_values++;
96308
+ if (total_values > NumericLimits<uint32_t>::Maximum()) {
96309
+ throw InvalidInputException("Lists larger than 2^32 elements are not supported");
96310
+ }
96326
96311
  }
96327
96312
  } else {
96328
96313
  // positive interval, start_value is going up
96329
96314
  while (inclusive_bound ? start_value <= end_value : start_value < end_value) {
96330
96315
  start_value = Interval::Add(start_value, increment_value);
96331
96316
  total_values++;
96317
+ if (total_values > NumericLimits<uint32_t>::Maximum()) {
96318
+ throw InvalidInputException("Lists larger than 2^32 elements are not supported");
96319
+ }
96332
96320
  }
96333
96321
  }
96334
96322
  return total_values;
@@ -96457,8 +96445,10 @@ static void ListRangeFunction(DataChunk &args, ExpressionState &state, Vector &r
96457
96445
 
96458
96446
  typename OP::TYPE range_value = start_value;
96459
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
+ }
96460
96451
  range_data[total_idx++] = range_value;
96461
- OP::Increment(range_value, increment);
96462
96452
  }
96463
96453
  }
96464
96454
 
@@ -96918,6 +96908,7 @@ struct Atan2Fun {
96918
96908
 
96919
96909
 
96920
96910
 
96911
+
96921
96912
  #include <cmath>
96922
96913
  #include <errno.h>
96923
96914
 
@@ -96951,7 +96942,6 @@ static scalar_function_t GetScalarIntegerUnaryFunctionFixedReturn(const LogicalT
96951
96942
  //===--------------------------------------------------------------------===//
96952
96943
  // nextafter
96953
96944
  //===--------------------------------------------------------------------===//
96954
-
96955
96945
  struct NextAfterOperator {
96956
96946
  template <class TA, class TB, class TR>
96957
96947
  static inline TR Operation(TA base, TB exponent) {
@@ -96982,6 +96972,71 @@ void NextAfterFun::RegisterFunction(BuiltinFunctions &set) {
96982
96972
  //===--------------------------------------------------------------------===//
96983
96973
  // abs
96984
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
+
96985
97040
  template <class OP>
96986
97041
  unique_ptr<FunctionData> DecimalUnaryOpBind(ClientContext &context, ScalarFunction &bound_function,
96987
97042
  vector<unique_ptr<Expression>> &arguments) {
@@ -97008,10 +97063,28 @@ unique_ptr<FunctionData> DecimalUnaryOpBind(ClientContext &context, ScalarFuncti
97008
97063
  void AbsFun::RegisterFunction(BuiltinFunctions &set) {
97009
97064
  ScalarFunctionSet abs("abs");
97010
97065
  for (auto &type : LogicalType::Numeric()) {
97011
- if (type.id() == LogicalTypeId::DECIMAL) {
97066
+ switch (type.id()) {
97067
+ case LogicalTypeId::DECIMAL:
97012
97068
  abs.AddFunction(ScalarFunction({type}, type, nullptr, false, false, DecimalUnaryOpBind<AbsOperator>));
97013
- } else {
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:
97014
97086
  abs.AddFunction(ScalarFunction({type}, type, ScalarFunction::GetScalarUnaryFunction<AbsOperator>(type)));
97087
+ break;
97015
97088
  }
97016
97089
  }
97017
97090
  set.AddFunction(abs);
@@ -98616,9 +98689,9 @@ struct SubtractPropagateStatistics {
98616
98689
  };
98617
98690
 
98618
98691
  template <class OP, class PROPAGATE, class BASEOP>
98619
- static unique_ptr<BaseStatistics> PropagateNumericStats(ClientContext &context, BoundFunctionExpression &expr,
98620
- FunctionData *bind_data,
98621
- vector<unique_ptr<BaseStatistics>> &child_stats) {
98692
+ static unique_ptr<BaseStatistics> PropagateNumericStats(ClientContext &context, FunctionStatisticsInput &input) {
98693
+ auto &child_stats = input.child_stats;
98694
+ auto &expr = input.expr;
98622
98695
  D_ASSERT(child_stats.size() == 2);
98623
98696
  // can only propagate stats if the children have stats
98624
98697
  if (!child_stats[0] || !child_stats[1]) {
@@ -98929,9 +99002,9 @@ struct NegatePropagateStatistics {
98929
99002
  }
98930
99003
  };
98931
99004
 
98932
- static unique_ptr<BaseStatistics> NegateBindStatistics(ClientContext &context, BoundFunctionExpression &expr,
98933
- FunctionData *bind_data,
98934
- vector<unique_ptr<BaseStatistics>> &child_stats) {
99005
+ static unique_ptr<BaseStatistics> NegateBindStatistics(ClientContext &context, FunctionStatisticsInput &input) {
99006
+ auto &child_stats = input.child_stats;
99007
+ auto &expr = input.expr;
98935
99008
  D_ASSERT(child_stats.size() == 1);
98936
99009
  // can only propagate stats if the children have stats
98937
99010
  if (!child_stats[0]) {
@@ -100460,9 +100533,9 @@ static void CaseConvertFunctionASCII(DataChunk &args, ExpressionState &state, Ve
100460
100533
  }
100461
100534
 
100462
100535
  template <bool IS_UPPER>
100463
- static unique_ptr<BaseStatistics> CaseConvertPropagateStats(ClientContext &context, BoundFunctionExpression &expr,
100464
- FunctionData *bind_data,
100465
- vector<unique_ptr<BaseStatistics>> &child_stats) {
100536
+ static unique_ptr<BaseStatistics> CaseConvertPropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
100537
+ auto &child_stats = input.child_stats;
100538
+ auto &expr = input.expr;
100466
100539
  D_ASSERT(child_stats.size() == 1);
100467
100540
  // can only propagate stats if the children have stats
100468
100541
  if (!child_stats[0]) {
@@ -100984,9 +101057,9 @@ struct InstrAsciiOperator {
100984
101057
  }
100985
101058
  };
100986
101059
 
100987
- static unique_ptr<BaseStatistics> InStrPropagateStats(ClientContext &context, BoundFunctionExpression &expr,
100988
- FunctionData *bind_data,
100989
- vector<unique_ptr<BaseStatistics>> &child_stats) {
101060
+ static unique_ptr<BaseStatistics> InStrPropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
101061
+ auto &child_stats = input.child_stats;
101062
+ auto &expr = input.expr;
100990
101063
  D_ASSERT(child_stats.size() == 2);
100991
101064
  // can only propagate stats if the children have stats
100992
101065
  if (!child_stats[0]) {
@@ -101192,9 +101265,9 @@ struct BitLenOperator {
101192
101265
  }
101193
101266
  };
101194
101267
 
101195
- static unique_ptr<BaseStatistics> LengthPropagateStats(ClientContext &context, BoundFunctionExpression &expr,
101196
- FunctionData *bind_data,
101197
- vector<unique_ptr<BaseStatistics>> &child_stats) {
101268
+ static unique_ptr<BaseStatistics> LengthPropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
101269
+ auto &child_stats = input.child_stats;
101270
+ auto &expr = input.expr;
101198
101271
  D_ASSERT(child_stats.size() == 1);
101199
101272
  // can only propagate stats if the children have stats
101200
101273
  if (!child_stats[0]) {
@@ -101821,9 +101894,9 @@ static void LikeEscapeFunction(DataChunk &args, ExpressionState &state, Vector &
101821
101894
  }
101822
101895
 
101823
101896
  template <class ASCII_OP>
101824
- static unique_ptr<BaseStatistics> ILikePropagateStats(ClientContext &context, BoundFunctionExpression &expr,
101825
- FunctionData *bind_data,
101826
- vector<unique_ptr<BaseStatistics>> &child_stats) {
101897
+ static unique_ptr<BaseStatistics> ILikePropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
101898
+ auto &child_stats = input.child_stats;
101899
+ auto &expr = input.expr;
101827
101900
  D_ASSERT(child_stats.size() >= 1);
101828
101901
  // can only propagate stats if the children have stats
101829
101902
  if (!child_stats[0]) {
@@ -103533,9 +103606,9 @@ static void SubstringFunctionASCII(DataChunk &args, ExpressionState &state, Vect
103533
103606
  }
103534
103607
  }
103535
103608
 
103536
- static unique_ptr<BaseStatistics> SubstringPropagateStats(ClientContext &context, BoundFunctionExpression &expr,
103537
- FunctionData *bind_data,
103538
- vector<unique_ptr<BaseStatistics>> &child_stats) {
103609
+ static unique_ptr<BaseStatistics> SubstringPropagateStats(ClientContext &context, FunctionStatisticsInput &input) {
103610
+ auto &child_stats = input.child_stats;
103611
+ auto &expr = input.expr;
103539
103612
  // can only propagate stats if the children have stats
103540
103613
  if (!child_stats[0]) {
103541
103614
  return nullptr;
@@ -103951,9 +104024,9 @@ static unique_ptr<FunctionData> StructExtractBind(ClientContext &context, Scalar
103951
104024
  return make_unique<StructExtractBindData>(key, key_index, return_type);
103952
104025
  }
103953
104026
 
103954
- static unique_ptr<BaseStatistics> PropagateStructExtractStats(ClientContext &context, BoundFunctionExpression &expr,
103955
- FunctionData *bind_data,
103956
- vector<unique_ptr<BaseStatistics>> &child_stats) {
104027
+ static unique_ptr<BaseStatistics> PropagateStructExtractStats(ClientContext &context, FunctionStatisticsInput &input) {
104028
+ auto &child_stats = input.child_stats;
104029
+ auto &bind_data = input.bind_data;
103957
104030
  if (!child_stats[0]) {
103958
104031
  return nullptr;
103959
104032
  }
@@ -104037,8 +104110,9 @@ static unique_ptr<FunctionData> StructPackBind(ClientContext &context, ScalarFun
104037
104110
  return make_unique<VariableReturnBindData>(bound_function.return_type);
104038
104111
  }
104039
104112
 
104040
- unique_ptr<BaseStatistics> StructPackStats(ClientContext &context, BoundFunctionExpression &expr,
104041
- FunctionData *bind_data, vector<unique_ptr<BaseStatistics>> &child_stats) {
104113
+ unique_ptr<BaseStatistics> StructPackStats(ClientContext &context, FunctionStatisticsInput &input) {
104114
+ auto &child_stats = input.child_stats;
104115
+ auto &expr = input.expr;
104042
104116
  auto struct_stats = make_unique<StructStatistics>(expr.return_type);
104043
104117
  D_ASSERT(child_stats.size() == struct_stats->child_stats.size());
104044
104118
  for (idx_t i = 0; i < struct_stats->child_stats.size(); i++) {
@@ -117562,11 +117636,6 @@ inline const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *asn1) {
117562
117636
  #include <brotli/encode.h>
117563
117637
  #endif
117564
117638
 
117565
- #ifdef __clang__
117566
- #pragma clang diagnostic push
117567
- #pragma clang diagnostic ignored "-Wexit-time-destructors"
117568
- #endif
117569
-
117570
117639
  /*
117571
117640
  * Declaration
117572
117641
  */
@@ -125478,12 +125547,9 @@ inline SSL_CTX *Client::ssl_context() const {
125478
125547
 
125479
125548
  } // namespace CPPHTTPLIB_NAMESPACE
125480
125549
 
125481
- #ifdef __clang__
125482
- #pragma clang diagnostic pop
125483
- #endif
125484
-
125485
125550
  #endif // CPPHTTPLIB_HTTPLIB_H
125486
125551
 
125552
+
125487
125553
  // LICENSE_CHANGE_END
125488
125554
 
125489
125555
  #endif
@@ -139206,7 +139272,8 @@ unique_ptr<BaseStatistics> StatisticsPropagator::PropagateExpression(BoundFuncti
139206
139272
  if (!func.function.statistics) {
139207
139273
  return nullptr;
139208
139274
  }
139209
- return func.function.statistics(context, func, func.bind_info.get(), stats);
139275
+ FunctionStatisticsInput input(func, func.bind_info.get(), stats, expr_ptr);
139276
+ return func.function.statistics(context, input);
139210
139277
  }
139211
139278
 
139212
139279
  } // namespace duckdb
@@ -243057,6 +243124,8 @@ size_t Utf8Proc::RenderWidth(const char *s, size_t len, size_t pos) {
243057
243124
  #include <stdlib.h>
243058
243125
  #include <string>
243059
243126
 
243127
+ #define fprintf(...)
243128
+
243060
243129
 
243061
243130
 
243062
243131
 
@@ -273874,6 +273943,7 @@ typedef int16_t flex_int16_t;
273874
273943
  typedef uint16_t flex_uint16_t;
273875
273944
  typedef int32_t flex_int32_t;
273876
273945
  typedef uint32_t flex_uint32_t;
273946
+ typedef uint64_t flex_uint64_t;
273877
273947
  #else
273878
273948
  typedef signed char flex_int8_t;
273879
273949
  typedef short int flex_int16_t;
@@ -274038,7 +274108,7 @@ struct yy_buffer_state
274038
274108
  /* Number of characters read into yy_ch_buf, not including EOB
274039
274109
  * characters.
274040
274110
  */
274041
- int yy_n_chars;
274111
+ yy_size_t yy_n_chars;
274042
274112
 
274043
274113
  /* Whether we "own" the buffer - i.e., we know we created it,
274044
274114
  * and can realloc() it to grow it, and should free() it to
@@ -274115,7 +274185,7 @@ static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner
274115
274185
 
274116
274186
  YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
274117
274187
  YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
274118
- YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
274188
+ YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len , yyscan_t yyscanner );
274119
274189
 
274120
274190
  void *yyalloc ( yy_size_t , yyscan_t yyscanner );
274121
274191
  void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
@@ -274162,7 +274232,7 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
274162
274232
  */
274163
274233
  #define YY_DO_BEFORE_ACTION \
274164
274234
  yyg->yytext_ptr = yy_bp; \
274165
- yyleng = (int) (yy_cp - yy_bp); \
274235
+ yyleng = (yy_size_t) (yy_cp - yy_bp); \
274166
274236
  yyg->yy_hold_char = *yy_cp; \
274167
274237
  *yy_cp = '\0'; \
274168
274238
  yyg->yy_c_buf_p = yy_cp;
@@ -274700,7 +274770,7 @@ static void check_escape_warning(core_yyscan_t yyscanner);
274700
274770
  extern int core_yyget_column(yyscan_t yyscanner);
274701
274771
  extern void core_yyset_column(int column_no, yyscan_t yyscanner);
274702
274772
 
274703
- #line 1150 "third_party/libpg_query/src_backend_parser_scan.cpp"
274773
+ #line 1151 "third_party/libpg_query/src_backend_parser_scan.cpp"
274704
274774
  #define YY_NO_INPUT 1
274705
274775
  /*
274706
274776
  * OK, here is a short description of lex/flex rules behavior.
@@ -274854,7 +274924,7 @@ extern void core_yyset_column(int column_no, yyscan_t yyscanner);
274854
274924
  * Note that xcstart must appear before operator, as explained above!
274855
274925
  * Also whitespace (comment) must appear before operator.
274856
274926
  */
274857
- #line 1304 "third_party/libpg_query/src_backend_parser_scan.cpp"
274927
+ #line 1305 "third_party/libpg_query/src_backend_parser_scan.cpp"
274858
274928
 
274859
274929
  #define INITIAL 0
274860
274930
  #define xb 1
@@ -274887,8 +274957,8 @@ struct yyguts_t
274887
274957
  size_t yy_buffer_stack_max; /**< capacity of stack. */
274888
274958
  YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
274889
274959
  char yy_hold_char;
274890
- int yy_n_chars;
274891
- int yyleng_r;
274960
+ yy_size_t yy_n_chars;
274961
+ yy_size_t yyleng_r;
274892
274962
  char *yy_c_buf_p;
274893
274963
  int yy_init;
274894
274964
  int yy_start;
@@ -274945,7 +275015,7 @@ FILE *yyget_out ( yyscan_t yyscanner );
274945
275015
 
274946
275016
  void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
274947
275017
 
274948
- int yyget_leng ( yyscan_t yyscanner );
275018
+ yy_size_t yyget_leng ( yyscan_t yyscanner );
274949
275019
 
274950
275020
  char *yyget_text ( yyscan_t yyscanner );
274951
275021
 
@@ -275024,7 +275094,7 @@ static int input ( yyscan_t yyscanner );
275024
275094
  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
275025
275095
  { \
275026
275096
  int c = '*'; \
275027
- int n; \
275097
+ yy_size_t n; \
275028
275098
  for ( n = 0; n < max_size && \
275029
275099
  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
275030
275100
  buf[n] = (char) c; \
@@ -275136,7 +275206,7 @@ YY_DECL
275136
275206
  #line 402 "third_party/libpg_query/scan.l"
275137
275207
 
275138
275208
 
275139
- #line 1593 "third_party/libpg_query/src_backend_parser_scan.cpp"
275209
+ #line 1594 "third_party/libpg_query/src_backend_parser_scan.cpp"
275140
275210
 
275141
275211
  while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
275142
275212
  {
@@ -276195,7 +276265,7 @@ YY_RULE_SETUP
276195
276265
  #line 1081 "third_party/libpg_query/scan.l"
276196
276266
  YY_FATAL_ERROR( "flex scanner jammed" );
276197
276267
  YY_BREAK
276198
- #line 2652 "third_party/libpg_query/src_backend_parser_scan.cpp"
276268
+ #line 2653 "third_party/libpg_query/src_backend_parser_scan.cpp"
276199
276269
 
276200
276270
  case YY_END_OF_BUFFER:
276201
276271
  {
@@ -276382,7 +276452,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
276382
276452
 
276383
276453
  else
276384
276454
  {
276385
- int num_to_read =
276455
+ yy_size_t num_to_read =
276386
276456
  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
276387
276457
 
276388
276458
  while ( num_to_read <= 0 )
@@ -276396,7 +276466,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
276396
276466
 
276397
276467
  if ( b->yy_is_our_buffer )
276398
276468
  {
276399
- int new_size = b->yy_buf_size * 2;
276469
+ yy_size_t new_size = b->yy_buf_size * 2;
276400
276470
 
276401
276471
  if ( new_size <= 0 )
276402
276472
  b->yy_buf_size += b->yy_buf_size / 8;
@@ -276454,7 +276524,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
276454
276524
 
276455
276525
  if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
276456
276526
  /* Extend the array by 50%, plus the number we really need. */
276457
- int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
276527
+ yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
276458
276528
  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
276459
276529
  (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
276460
276530
  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
@@ -276561,7 +276631,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
276561
276631
 
276562
276632
  else
276563
276633
  { /* need more input */
276564
- int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
276634
+ yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
276565
276635
  ++yyg->yy_c_buf_p;
276566
276636
 
276567
276637
  switch ( yy_get_next_buffer( yyscanner ) )
@@ -276939,12 +277009,12 @@ YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
276939
277009
  * @param yyscanner The scanner object.
276940
277010
  * @return the newly allocated buffer state object.
276941
277011
  */
276942
- YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
277012
+ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
276943
277013
  {
276944
277014
  YY_BUFFER_STATE b;
276945
277015
  char *buf;
276946
277016
  yy_size_t n;
276947
- int i;
277017
+ yy_size_t i;
276948
277018
 
276949
277019
  /* Get memory for full buffer, including space for trailing EOB's. */
276950
277020
  n = (yy_size_t) (_yybytes_len + 2);
@@ -276977,7 +277047,7 @@ static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
276977
277047
  {
276978
277048
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
276979
277049
  (void)yyg;
276980
- fprintf( stderr, "%s\n", msg );
277050
+ //( stderr, "%s\n", msg );
276981
277051
  throw std::runtime_error(msg); // YY_EXIT_FAILURE );
276982
277052
  }
276983
277053
 
@@ -276988,7 +277058,7 @@ static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
276988
277058
  do \
276989
277059
  { \
276990
277060
  /* Undo effects of setting up yytext. */ \
276991
- int yyless_macro_arg = (n); \
277061
+ yy_size_t yyless_macro_arg = (n); \
276992
277062
  YY_LESS_LINENO(yyless_macro_arg);\
276993
277063
  yytext[yyleng] = yyg->yy_hold_char; \
276994
277064
  yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
@@ -277056,7 +277126,7 @@ FILE *yyget_out (yyscan_t yyscanner)
277056
277126
  /** Get the length of the current token.
277057
277127
  * @param yyscanner The scanner object.
277058
277128
  */
277059
- int yyget_leng (yyscan_t yyscanner)
277129
+ yy_size_t yyget_leng (yyscan_t yyscanner)
277060
277130
  {
277061
277131
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
277062
277132
  return yyleng;