duckdb 0.3.3-dev200.0 → 0.3.3-dev288.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
@@ -2636,33 +2636,6 @@ protected:
2636
2636
 
2637
2637
  } // namespace duckdb
2638
2638
 
2639
- //===----------------------------------------------------------------------===//
2640
- // DuckDB
2641
- //
2642
- // duckdb/parser/keyword_helper.hpp
2643
- //
2644
- //
2645
- //===----------------------------------------------------------------------===//
2646
-
2647
-
2648
-
2649
-
2650
-
2651
- namespace duckdb {
2652
-
2653
- class KeywordHelper {
2654
- public:
2655
- //! Returns true if the given text matches a keyword of the parser
2656
- static bool IsKeyword(const string &text);
2657
-
2658
- //! Returns true if the given string needs to be quoted when written as an identifier
2659
- static bool RequiresQuotes(const string &text);
2660
-
2661
- //! Writes a string that is optionally quoted + escaped so it can be used as an identifier
2662
- static string WriteOptionallyQuoted(const string &text);
2663
- };
2664
-
2665
- } // namespace duckdb
2666
2639
 
2667
2640
 
2668
2641
 
@@ -3102,14 +3075,7 @@ string TableCatalogEntry::ToSQL() {
3102
3075
  }
3103
3076
  auto &column = columns[i];
3104
3077
  ss << KeywordHelper::WriteOptionallyQuoted(column.name) << " ";
3105
- switch (column.type.id()) {
3106
- case LogicalTypeId::ENUM:
3107
- ss << KeywordHelper::WriteOptionallyQuoted(column.type.ToString());
3108
- break;
3109
- default:
3110
- ss << column.type.ToString();
3111
- break;
3112
- }
3078
+ ss << column.type.ToString();
3113
3079
  bool not_null = not_null_columns.find(column.oid) != not_null_columns.end();
3114
3080
  bool is_single_key_pk = pk_columns.find(column.oid) != pk_columns.end();
3115
3081
  bool is_multi_key_pk = multi_key_pks.find(column.name) != multi_key_pks.end();
@@ -5729,8 +5695,6 @@ string ExpressionTypeToString(ExpressionType type) {
5729
5695
 
5730
5696
  string ExpressionTypeToOperator(ExpressionType type) {
5731
5697
  switch (type) {
5732
- case ExpressionType::OPERATOR_NOT:
5733
- return "!";
5734
5698
  case ExpressionType::COMPARE_EQUAL:
5735
5699
  return "=";
5736
5700
  case ExpressionType::COMPARE_NOTEQUAL:
@@ -5743,6 +5707,10 @@ string ExpressionTypeToOperator(ExpressionType type) {
5743
5707
  return "<=";
5744
5708
  case ExpressionType::COMPARE_GREATERTHANOREQUALTO:
5745
5709
  return ">=";
5710
+ case ExpressionType::COMPARE_DISTINCT_FROM:
5711
+ return "IS DISTINCT FROM";
5712
+ case ExpressionType::COMPARE_NOT_DISTINCT_FROM:
5713
+ return "IS NOT DISTINCT FROM";
5746
5714
  case ExpressionType::CONJUNCTION_AND:
5747
5715
  return "AND";
5748
5716
  case ExpressionType::CONJUNCTION_OR:
@@ -18908,6 +18876,2429 @@ struct IntervalToStringCast {
18908
18876
 
18909
18877
 
18910
18878
 
18879
+ // LICENSE_CHANGE_BEGIN
18880
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4
18881
+ // See the end of this file for a list
18882
+
18883
+ // duckdb_fast_float by Daniel Lemire
18884
+ // duckdb_fast_float by João Paulo Magalhaes
18885
+
18886
+
18887
+ // with contributions from Eugene Golushkov
18888
+ // with contributions from Maksim Kita
18889
+ // with contributions from Marcin Wojdyr
18890
+ // with contributions from Neal Richardson
18891
+ // with contributions from Tim Paine
18892
+ // with contributions from Fabio Pellacini
18893
+
18894
+
18895
+ // Permission is hereby granted, free of charge, to any
18896
+ // person obtaining a copy of this software and associated
18897
+ // documentation files (the "Software"), to deal in the
18898
+ // Software without restriction, including without
18899
+ // limitation the rights to use, copy, modify, merge,
18900
+ // publish, distribute, sublicense, and/or sell copies of
18901
+ // the Software, and to permit persons to whom the Software
18902
+ // is furnished to do so, subject to the following
18903
+ // conditions:
18904
+ //
18905
+ // The above copyright notice and this permission notice
18906
+ // shall be included in all copies or substantial portions
18907
+ // of the Software.
18908
+ //
18909
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18910
+ // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
18911
+ // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
18912
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
18913
+ // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18914
+ // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18915
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
18916
+ // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18917
+ // DEALINGS IN THE SOFTWARE.
18918
+
18919
+
18920
+ #ifndef FASTFLOAT_FAST_FLOAT_H
18921
+ #define FASTFLOAT_FAST_FLOAT_H
18922
+
18923
+ #include <system_error>
18924
+
18925
+ namespace duckdb_fast_float {
18926
+ enum chars_format {
18927
+ scientific = 1<<0,
18928
+ fixed = 1<<2,
18929
+ hex = 1<<3,
18930
+ general = fixed | scientific
18931
+ };
18932
+
18933
+
18934
+ struct from_chars_result {
18935
+ const char *ptr;
18936
+ std::errc ec;
18937
+ };
18938
+
18939
+ /**
18940
+ * This function parses the character sequence [first,last) for a number. It parses floating-point numbers expecting
18941
+ * a locale-indepent format equivalent to what is used by std::strtod in the default ("C") locale.
18942
+ * The resulting floating-point value is the closest floating-point values (using either float or double),
18943
+ * using the "round to even" convention for values that would otherwise fall right in-between two values.
18944
+ * That is, we provide exact parsing according to the IEEE standard.
18945
+ *
18946
+ * Given a successful parse, the pointer (`ptr`) in the returned value is set to point right after the
18947
+ * parsed number, and the `value` referenced is set to the parsed value. In case of error, the returned
18948
+ * `ec` contains a representative error, otherwise the default (`std::errc()`) value is stored.
18949
+ *
18950
+ * The implementation does not throw and does not allocate memory (e.g., with `new` or `malloc`).
18951
+ *
18952
+ * Like the C++17 standard, the `duckdb_fast_float::from_chars` functions take an optional last argument of
18953
+ * the type `duckdb_fast_float::chars_format`. It is a bitset value: we check whether
18954
+ * `fmt & duckdb_fast_float::chars_format::fixed` and `fmt & duckdb_fast_float::chars_format::scientific` are set
18955
+ * to determine whether we allowe the fixed point and scientific notation respectively.
18956
+ * The default is `duckdb_fast_float::chars_format::general` which allows both `fixed` and `scientific`.
18957
+ */
18958
+ template<typename T>
18959
+ from_chars_result from_chars(const char *first, const char *last,
18960
+ T &value, chars_format fmt = chars_format::general) noexcept;
18961
+
18962
+ }
18963
+ #endif // FASTFLOAT_FAST_FLOAT_H
18964
+
18965
+ #ifndef FASTFLOAT_FLOAT_COMMON_H
18966
+ #define FASTFLOAT_FLOAT_COMMON_H
18967
+
18968
+ #include <cfloat>
18969
+ #include <cstdint>
18970
+ #include <cassert>
18971
+
18972
+ #if (defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) \
18973
+ || defined(__amd64) || defined(__aarch64__) || defined(_M_ARM64) \
18974
+ || defined(__MINGW64__) \
18975
+ || defined(__s390x__) \
18976
+ || (defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || defined(__PPC64LE__)) \
18977
+ || defined(__EMSCRIPTEN__))
18978
+ #define FASTFLOAT_64BIT
18979
+ #elif (defined(__i386) || defined(__i386__) || defined(_M_IX86) \
18980
+ || defined(__arm__) || defined(_M_ARM) \
18981
+ || defined(__MINGW32__))
18982
+ #define FASTFLOAT_32BIT
18983
+ #else
18984
+ // Need to check incrementally, since SIZE_MAX is a size_t, avoid overflow.
18985
+ // We can never tell the register width, but the SIZE_MAX is a good approximation.
18986
+ // UINTPTR_MAX and INTPTR_MAX are optional, so avoid them for max portability.
18987
+ #if SIZE_MAX == 0xffff
18988
+ #error Unknown platform (16-bit, unsupported)
18989
+ #elif SIZE_MAX == 0xffffffff
18990
+ #define FASTFLOAT_32BIT
18991
+ #elif SIZE_MAX == 0xffffffffffffffff
18992
+ #define FASTFLOAT_64BIT
18993
+ #else
18994
+ #error Unknown platform (not 32-bit, not 64-bit?)
18995
+ #endif
18996
+ #endif
18997
+
18998
+ #if ((defined(_WIN32) || defined(_WIN64)) && !defined(__clang__))
18999
+ #include <intrin.h>
19000
+ #endif
19001
+
19002
+ #if defined(_MSC_VER) && !defined(__clang__)
19003
+ #define FASTFLOAT_VISUAL_STUDIO 1
19004
+ #endif
19005
+
19006
+ #ifdef _WIN32
19007
+ #define FASTFLOAT_IS_BIG_ENDIAN 0
19008
+ #else
19009
+ #if defined(__APPLE__) || defined(__FreeBSD__)
19010
+ #include <machine/endian.h>
19011
+ #elif defined(sun) || defined(__sun)
19012
+ #include <sys/byteorder.h>
19013
+ #else
19014
+ #include <endian.h>
19015
+ #endif
19016
+ #
19017
+ #ifndef __BYTE_ORDER__
19018
+ // safe choice
19019
+ #define FASTFLOAT_IS_BIG_ENDIAN 0
19020
+ #endif
19021
+ #
19022
+ #ifndef __ORDER_LITTLE_ENDIAN__
19023
+ // safe choice
19024
+ #define FASTFLOAT_IS_BIG_ENDIAN 0
19025
+ #endif
19026
+ #
19027
+ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
19028
+ #define FASTFLOAT_IS_BIG_ENDIAN 0
19029
+ #else
19030
+ #define FASTFLOAT_IS_BIG_ENDIAN 1
19031
+ #endif
19032
+ #endif
19033
+
19034
+ #ifdef FASTFLOAT_VISUAL_STUDIO
19035
+ #define fastfloat_really_inline __forceinline
19036
+ #else
19037
+ #define fastfloat_really_inline inline __attribute__((always_inline))
19038
+ #endif
19039
+
19040
+ namespace duckdb_fast_float {
19041
+
19042
+ // Compares two ASCII strings in a case insensitive manner.
19043
+ inline bool fastfloat_strncasecmp(const char *input1, const char *input2,
19044
+ size_t length) {
19045
+ char running_diff{0};
19046
+ for (size_t i = 0; i < length; i++) {
19047
+ running_diff |= (input1[i] ^ input2[i]);
19048
+ }
19049
+ return (running_diff == 0) || (running_diff == 32);
19050
+ }
19051
+
19052
+ #ifndef FLT_EVAL_METHOD
19053
+ #error "FLT_EVAL_METHOD should be defined, please include cfloat."
19054
+ #endif
19055
+
19056
+ namespace {
19057
+ constexpr uint32_t max_digits = 768;
19058
+ constexpr uint32_t max_digit_without_overflow = 19;
19059
+ constexpr int32_t decimal_point_range = 2047;
19060
+ } // namespace
19061
+
19062
+ struct value128 {
19063
+ uint64_t low;
19064
+ uint64_t high;
19065
+ value128(uint64_t _low, uint64_t _high) : low(_low), high(_high) {}
19066
+ value128() : low(0), high(0) {}
19067
+ };
19068
+
19069
+ /* result might be undefined when input_num is zero */
19070
+ fastfloat_really_inline int leading_zeroes(uint64_t input_num) {
19071
+ assert(input_num > 0);
19072
+ #ifdef FASTFLOAT_VISUAL_STUDIO
19073
+ #if defined(_M_X64) || defined(_M_ARM64)
19074
+ unsigned long leading_zero = 0;
19075
+ // Search the mask data from most significant bit (MSB)
19076
+ // to least significant bit (LSB) for a set bit (1).
19077
+ _BitScanReverse64(&leading_zero, input_num);
19078
+ return (int)(63 - leading_zero);
19079
+ #else
19080
+ int last_bit = 0;
19081
+ if(input_num & uint64_t(0xffffffff00000000)) input_num >>= 32, last_bit |= 32;
19082
+ if(input_num & uint64_t( 0xffff0000)) input_num >>= 16, last_bit |= 16;
19083
+ if(input_num & uint64_t( 0xff00)) input_num >>= 8, last_bit |= 8;
19084
+ if(input_num & uint64_t( 0xf0)) input_num >>= 4, last_bit |= 4;
19085
+ if(input_num & uint64_t( 0xc)) input_num >>= 2, last_bit |= 2;
19086
+ if(input_num & uint64_t( 0x2)) input_num >>= 1, last_bit |= 1;
19087
+ return 63 - last_bit;
19088
+ #endif
19089
+ #else
19090
+ return __builtin_clzll(input_num);
19091
+ #endif
19092
+ }
19093
+
19094
+ #ifdef FASTFLOAT_32BIT
19095
+
19096
+ // slow emulation routine for 32-bit
19097
+ fastfloat_really_inline uint64_t emulu(uint32_t x, uint32_t y) {
19098
+ return x * (uint64_t)y;
19099
+ }
19100
+
19101
+ // slow emulation routine for 32-bit
19102
+ #if !defined(__MINGW64__)
19103
+ fastfloat_really_inline uint64_t _umul128(uint64_t ab, uint64_t cd,
19104
+ uint64_t *hi) {
19105
+ uint64_t ad = emulu((uint32_t)(ab >> 32), (uint32_t)cd);
19106
+ uint64_t bd = emulu((uint32_t)ab, (uint32_t)cd);
19107
+ uint64_t adbc = ad + emulu((uint32_t)ab, (uint32_t)(cd >> 32));
19108
+ uint64_t adbc_carry = !!(adbc < ad);
19109
+ uint64_t lo = bd + (adbc << 32);
19110
+ *hi = emulu((uint32_t)(ab >> 32), (uint32_t)(cd >> 32)) + (adbc >> 32) +
19111
+ (adbc_carry << 32) + !!(lo < bd);
19112
+ return lo;
19113
+ }
19114
+ #endif // !__MINGW64__
19115
+
19116
+ #endif // FASTFLOAT_32BIT
19117
+
19118
+
19119
+ // compute 64-bit a*b
19120
+ fastfloat_really_inline value128 full_multiplication(uint64_t a,
19121
+ uint64_t b) {
19122
+ value128 answer;
19123
+ #ifdef _M_ARM64
19124
+ // ARM64 has native support for 64-bit multiplications, no need to emulate
19125
+ answer.high = __umulh(a, b);
19126
+ answer.low = a * b;
19127
+ #elif defined(FASTFLOAT_32BIT) || (defined(_WIN64) && !defined(__clang__))
19128
+ answer.low = _umul128(a, b, &answer.high); // _umul128 not available on ARM64
19129
+ #elif defined(FASTFLOAT_64BIT)
19130
+ __uint128_t r = ((__uint128_t)a) * b;
19131
+ answer.low = uint64_t(r);
19132
+ answer.high = uint64_t(r >> 64);
19133
+ #else
19134
+ #error Not implemented
19135
+ #endif
19136
+ return answer;
19137
+ }
19138
+
19139
+
19140
+ struct adjusted_mantissa {
19141
+ uint64_t mantissa{0};
19142
+ int power2{0}; // a negative value indicates an invalid result
19143
+ adjusted_mantissa() = default;
19144
+ bool operator==(const adjusted_mantissa &o) const {
19145
+ return mantissa == o.mantissa && power2 == o.power2;
19146
+ }
19147
+ bool operator!=(const adjusted_mantissa &o) const {
19148
+ return mantissa != o.mantissa || power2 != o.power2;
19149
+ }
19150
+ };
19151
+
19152
+ struct decimal {
19153
+ uint32_t num_digits{0};
19154
+ int32_t decimal_point{0};
19155
+ bool negative{false};
19156
+ bool truncated{false};
19157
+ uint8_t digits[max_digits];
19158
+ decimal() = default;
19159
+ // Copies are not allowed since this is a fat object.
19160
+ decimal(const decimal &) = delete;
19161
+ // Copies are not allowed since this is a fat object.
19162
+ decimal &operator=(const decimal &) = delete;
19163
+ // Moves are allowed:
19164
+ decimal(decimal &&) = default;
19165
+ decimal &operator=(decimal &&other) = default;
19166
+ };
19167
+
19168
+ constexpr static double powers_of_ten_double[] = {
19169
+ 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11,
19170
+ 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22};
19171
+ constexpr static float powers_of_ten_float[] = {1e0, 1e1, 1e2, 1e3, 1e4, 1e5,
19172
+ 1e6, 1e7, 1e8, 1e9, 1e10};
19173
+
19174
+ template <typename T> struct binary_format {
19175
+ static inline constexpr int mantissa_explicit_bits();
19176
+ static inline constexpr int minimum_exponent();
19177
+ static inline constexpr int infinite_power();
19178
+ static inline constexpr int sign_index();
19179
+ static inline constexpr int min_exponent_fast_path();
19180
+ static inline constexpr int max_exponent_fast_path();
19181
+ static inline constexpr int max_exponent_round_to_even();
19182
+ static inline constexpr int min_exponent_round_to_even();
19183
+ static inline constexpr uint64_t max_mantissa_fast_path();
19184
+ static inline constexpr int largest_power_of_ten();
19185
+ static inline constexpr int smallest_power_of_ten();
19186
+ static inline constexpr T exact_power_of_ten(int64_t power);
19187
+ };
19188
+
19189
+ template <> inline constexpr int binary_format<double>::mantissa_explicit_bits() {
19190
+ return 52;
19191
+ }
19192
+ template <> inline constexpr int binary_format<float>::mantissa_explicit_bits() {
19193
+ return 23;
19194
+ }
19195
+
19196
+ template <> inline constexpr int binary_format<double>::max_exponent_round_to_even() {
19197
+ return 23;
19198
+ }
19199
+
19200
+ template <> inline constexpr int binary_format<float>::max_exponent_round_to_even() {
19201
+ return 10;
19202
+ }
19203
+
19204
+ template <> inline constexpr int binary_format<double>::min_exponent_round_to_even() {
19205
+ return -4;
19206
+ }
19207
+
19208
+ template <> inline constexpr int binary_format<float>::min_exponent_round_to_even() {
19209
+ return -17;
19210
+ }
19211
+
19212
+ template <> inline constexpr int binary_format<double>::minimum_exponent() {
19213
+ return -1023;
19214
+ }
19215
+ template <> inline constexpr int binary_format<float>::minimum_exponent() {
19216
+ return -127;
19217
+ }
19218
+
19219
+ template <> inline constexpr int binary_format<double>::infinite_power() {
19220
+ return 0x7FF;
19221
+ }
19222
+ template <> inline constexpr int binary_format<float>::infinite_power() {
19223
+ return 0xFF;
19224
+ }
19225
+
19226
+ template <> inline constexpr int binary_format<double>::sign_index() { return 63; }
19227
+ template <> inline constexpr int binary_format<float>::sign_index() { return 31; }
19228
+
19229
+ template <> inline constexpr int binary_format<double>::min_exponent_fast_path() {
19230
+ #if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
19231
+ return 0;
19232
+ #else
19233
+ return -22;
19234
+ #endif
19235
+ }
19236
+ template <> inline constexpr int binary_format<float>::min_exponent_fast_path() {
19237
+ #if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
19238
+ return 0;
19239
+ #else
19240
+ return -10;
19241
+ #endif
19242
+ }
19243
+
19244
+ template <> inline constexpr int binary_format<double>::max_exponent_fast_path() {
19245
+ return 22;
19246
+ }
19247
+ template <> inline constexpr int binary_format<float>::max_exponent_fast_path() {
19248
+ return 10;
19249
+ }
19250
+
19251
+ template <> inline constexpr uint64_t binary_format<double>::max_mantissa_fast_path() {
19252
+ return uint64_t(2) << mantissa_explicit_bits();
19253
+ }
19254
+ template <> inline constexpr uint64_t binary_format<float>::max_mantissa_fast_path() {
19255
+ return uint64_t(2) << mantissa_explicit_bits();
19256
+ }
19257
+
19258
+ template <>
19259
+ inline constexpr double binary_format<double>::exact_power_of_ten(int64_t power) {
19260
+ return powers_of_ten_double[power];
19261
+ }
19262
+ template <>
19263
+ inline constexpr float binary_format<float>::exact_power_of_ten(int64_t power) {
19264
+
19265
+ return powers_of_ten_float[power];
19266
+ }
19267
+
19268
+
19269
+ template <>
19270
+ inline constexpr int binary_format<double>::largest_power_of_ten() {
19271
+ return 308;
19272
+ }
19273
+ template <>
19274
+ inline constexpr int binary_format<float>::largest_power_of_ten() {
19275
+ return 38;
19276
+ }
19277
+
19278
+ template <>
19279
+ inline constexpr int binary_format<double>::smallest_power_of_ten() {
19280
+ return -342;
19281
+ }
19282
+ template <>
19283
+ inline constexpr int binary_format<float>::smallest_power_of_ten() {
19284
+ return -65;
19285
+ }
19286
+
19287
+ } // namespace duckdb_fast_float
19288
+
19289
+ // for convenience:
19290
+ template<class OStream>
19291
+ inline OStream& operator<<(OStream &out, const duckdb_fast_float::decimal &d) {
19292
+ out << "0.";
19293
+ for (size_t i = 0; i < d.num_digits; i++) {
19294
+ out << int32_t(d.digits[i]);
19295
+ }
19296
+ out << " * 10 ** " << d.decimal_point;
19297
+ return out;
19298
+ }
19299
+
19300
+ #endif
19301
+
19302
+
19303
+ #ifndef FASTFLOAT_ASCII_NUMBER_H
19304
+ #define FASTFLOAT_ASCII_NUMBER_H
19305
+
19306
+ #include <cstdio>
19307
+ #include <cctype>
19308
+ #include <cstdint>
19309
+ #include <cstring>
19310
+
19311
+
19312
+ namespace duckdb_fast_float {
19313
+
19314
+ // Next function can be micro-optimized, but compilers are entirely
19315
+ // able to optimize it well.
19316
+ fastfloat_really_inline bool is_integer(char c) noexcept { return c >= '0' && c <= '9'; }
19317
+
19318
+ fastfloat_really_inline uint64_t byteswap(uint64_t val) {
19319
+ return (val & 0xFF00000000000000) >> 56
19320
+ | (val & 0x00FF000000000000) >> 40
19321
+ | (val & 0x0000FF0000000000) >> 24
19322
+ | (val & 0x000000FF00000000) >> 8
19323
+ | (val & 0x00000000FF000000) << 8
19324
+ | (val & 0x0000000000FF0000) << 24
19325
+ | (val & 0x000000000000FF00) << 40
19326
+ | (val & 0x00000000000000FF) << 56;
19327
+ }
19328
+
19329
+ fastfloat_really_inline uint64_t read_u64(const char *chars) {
19330
+ uint64_t val;
19331
+ ::memcpy(&val, chars, sizeof(uint64_t));
19332
+ #if FASTFLOAT_IS_BIG_ENDIAN == 1
19333
+ // Need to read as-if the number was in little-endian order.
19334
+ val = byteswap(val);
19335
+ #endif
19336
+ return val;
19337
+ }
19338
+
19339
+ fastfloat_really_inline void write_u64(uint8_t *chars, uint64_t val) {
19340
+ #if FASTFLOAT_IS_BIG_ENDIAN == 1
19341
+ // Need to read as-if the number was in little-endian order.
19342
+ val = byteswap(val);
19343
+ #endif
19344
+ ::memcpy(chars, &val, sizeof(uint64_t));
19345
+ }
19346
+
19347
+ // credit @aqrit
19348
+ fastfloat_really_inline uint32_t parse_eight_digits_unrolled(uint64_t val) {
19349
+ const uint64_t mask = 0x000000FF000000FF;
19350
+ const uint64_t mul1 = 0x000F424000000064; // 100 + (1000000ULL << 32)
19351
+ const uint64_t mul2 = 0x0000271000000001; // 1 + (10000ULL << 32)
19352
+ val -= 0x3030303030303030;
19353
+ val = (val * 10) + (val >> 8); // val = (val * 2561) >> 8;
19354
+ val = (((val & mask) * mul1) + (((val >> 16) & mask) * mul2)) >> 32;
19355
+ return uint32_t(val);
19356
+ }
19357
+
19358
+ fastfloat_really_inline uint32_t parse_eight_digits_unrolled(const char *chars) noexcept {
19359
+ return parse_eight_digits_unrolled(read_u64(chars));
19360
+ }
19361
+
19362
+ // credit @aqrit
19363
+ fastfloat_really_inline bool is_made_of_eight_digits_fast(uint64_t val) noexcept {
19364
+ return !((((val + 0x4646464646464646) | (val - 0x3030303030303030)) &
19365
+ 0x8080808080808080));
19366
+ }
19367
+
19368
+ fastfloat_really_inline bool is_made_of_eight_digits_fast(const char *chars) noexcept {
19369
+ return is_made_of_eight_digits_fast(read_u64(chars));
19370
+ }
19371
+
19372
+ struct parsed_number_string {
19373
+ int64_t exponent;
19374
+ uint64_t mantissa;
19375
+ const char *lastmatch;
19376
+ bool negative;
19377
+ bool valid;
19378
+ bool too_many_digits;
19379
+ };
19380
+
19381
+
19382
+ // Assuming that you use no more than 19 digits, this will
19383
+ // parse an ASCII string.
19384
+ fastfloat_really_inline
19385
+ parsed_number_string parse_number_string(const char *p, const char *pend, chars_format fmt) noexcept {
19386
+ parsed_number_string answer;
19387
+ answer.valid = false;
19388
+ answer.too_many_digits = false;
19389
+ answer.negative = (*p == '-');
19390
+ if (*p == '-') { // C++17 20.19.3.(7.1) explicitly forbids '+' sign here
19391
+ ++p;
19392
+ if (p == pend) {
19393
+ return answer;
19394
+ }
19395
+ if (!is_integer(*p) && (*p != '.')) { // a sign must be followed by an integer or the dot
19396
+ return answer;
19397
+ }
19398
+ }
19399
+ const char *const start_digits = p;
19400
+
19401
+ uint64_t i = 0; // an unsigned int avoids signed overflows (which are bad)
19402
+
19403
+ while ((p != pend) && is_integer(*p)) {
19404
+ // a multiplication by 10 is cheaper than an arbitrary integer
19405
+ // multiplication
19406
+ i = 10 * i +
19407
+ uint64_t(*p - '0'); // might overflow, we will handle the overflow later
19408
+ ++p;
19409
+ }
19410
+ const char *const end_of_integer_part = p;
19411
+ int64_t digit_count = int64_t(end_of_integer_part - start_digits);
19412
+ int64_t exponent = 0;
19413
+ if ((p != pend) && (*p == '.')) {
19414
+ ++p;
19415
+ // Fast approach only tested under little endian systems
19416
+ if ((p + 8 <= pend) && is_made_of_eight_digits_fast(p)) {
19417
+ i = i * 100000000 + parse_eight_digits_unrolled(p); // in rare cases, this will overflow, but that's ok
19418
+ p += 8;
19419
+ if ((p + 8 <= pend) && is_made_of_eight_digits_fast(p)) {
19420
+ i = i * 100000000 + parse_eight_digits_unrolled(p); // in rare cases, this will overflow, but that's ok
19421
+ p += 8;
19422
+ }
19423
+ }
19424
+ while ((p != pend) && is_integer(*p)) {
19425
+ uint8_t digit = uint8_t(*p - '0');
19426
+ ++p;
19427
+ i = i * 10 + digit; // in rare cases, this will overflow, but that's ok
19428
+ }
19429
+ exponent = end_of_integer_part + 1 - p;
19430
+ digit_count -= exponent;
19431
+ }
19432
+ // we must have encountered at least one integer!
19433
+ if (digit_count == 0) {
19434
+ return answer;
19435
+ }
19436
+ int64_t exp_number = 0; // explicit exponential part
19437
+ if ((fmt & chars_format::scientific) && (p != pend) && (('e' == *p) || ('E' == *p))) {
19438
+ const char * location_of_e = p;
19439
+ ++p;
19440
+ bool neg_exp = false;
19441
+ if ((p != pend) && ('-' == *p)) {
19442
+ neg_exp = true;
19443
+ ++p;
19444
+ } else if ((p != pend) && ('+' == *p)) { // '+' on exponent is allowed by C++17 20.19.3.(7.1)
19445
+ ++p;
19446
+ }
19447
+ if ((p == pend) || !is_integer(*p)) {
19448
+ if(!(fmt & chars_format::fixed)) {
19449
+ // We are in error.
19450
+ return answer;
19451
+ }
19452
+ // Otherwise, we will be ignoring the 'e'.
19453
+ p = location_of_e;
19454
+ } else {
19455
+ while ((p != pend) && is_integer(*p)) {
19456
+ uint8_t digit = uint8_t(*p - '0');
19457
+ if (exp_number < 0x10000) {
19458
+ exp_number = 10 * exp_number + digit;
19459
+ }
19460
+ ++p;
19461
+ }
19462
+ if(neg_exp) { exp_number = - exp_number; }
19463
+ exponent += exp_number;
19464
+ }
19465
+ } else {
19466
+ // If it scientific and not fixed, we have to bail out.
19467
+ if((fmt & chars_format::scientific) && !(fmt & chars_format::fixed)) { return answer; }
19468
+ }
19469
+ answer.lastmatch = p;
19470
+ answer.valid = true;
19471
+
19472
+ // If we frequently had to deal with long strings of digits,
19473
+ // we could extend our code by using a 128-bit integer instead
19474
+ // of a 64-bit integer. However, this is uncommon.
19475
+ //
19476
+ // We can deal with up to 19 digits.
19477
+ if (digit_count > 19) { // this is uncommon
19478
+ // It is possible that the integer had an overflow.
19479
+ // We have to handle the case where we have 0.0000somenumber.
19480
+ // We need to be mindful of the case where we only have zeroes...
19481
+ // E.g., 0.000000000...000.
19482
+ const char *start = start_digits;
19483
+ while ((start != pend) && (*start == '0' || *start == '.')) {
19484
+ if(*start == '0') { digit_count --; }
19485
+ start++;
19486
+ }
19487
+ if (digit_count > 19) {
19488
+ answer.too_many_digits = true;
19489
+ // Let us start again, this time, avoiding overflows.
19490
+ i = 0;
19491
+ p = start_digits;
19492
+ const uint64_t minimal_nineteen_digit_integer{1000000000000000000};
19493
+ while((i < minimal_nineteen_digit_integer) && (p != pend) && is_integer(*p)) {
19494
+ i = i * 10 + uint64_t(*p - '0');
19495
+ ++p;
19496
+ }
19497
+ if (i >= minimal_nineteen_digit_integer) { // We have a big integers
19498
+ exponent = end_of_integer_part - p + exp_number;
19499
+ } else { // We have a value with a fractional component.
19500
+ p++; // skip the '.'
19501
+ const char *first_after_period = p;
19502
+ while((i < minimal_nineteen_digit_integer) && (p != pend) && is_integer(*p)) {
19503
+ i = i * 10 + uint64_t(*p - '0');
19504
+ ++p;
19505
+ }
19506
+ exponent = first_after_period - p + exp_number;
19507
+ }
19508
+ // We have now corrected both exponent and i, to a truncated value
19509
+ }
19510
+ }
19511
+ answer.exponent = exponent;
19512
+ answer.mantissa = i;
19513
+ return answer;
19514
+ }
19515
+
19516
+
19517
+ // This should always succeed since it follows a call to parse_number_string
19518
+ // This function could be optimized. In particular, we could stop after 19 digits
19519
+ // and try to bail out. Furthermore, we should be able to recover the computed
19520
+ // exponent from the pass in parse_number_string.
19521
+ fastfloat_really_inline decimal parse_decimal(const char *p, const char *pend) noexcept {
19522
+ decimal answer;
19523
+ answer.num_digits = 0;
19524
+ answer.decimal_point = 0;
19525
+ answer.truncated = false;
19526
+ answer.negative = (*p == '-');
19527
+ if (*p == '-') { // C++17 20.19.3.(7.1) explicitly forbids '+' sign here
19528
+ ++p;
19529
+ }
19530
+ // skip leading zeroes
19531
+ while ((p != pend) && (*p == '0')) {
19532
+ ++p;
19533
+ }
19534
+ while ((p != pend) && is_integer(*p)) {
19535
+ if (answer.num_digits < max_digits) {
19536
+ answer.digits[answer.num_digits] = uint8_t(*p - '0');
19537
+ }
19538
+ answer.num_digits++;
19539
+ ++p;
19540
+ }
19541
+ if ((p != pend) && (*p == '.')) {
19542
+ ++p;
19543
+ const char *first_after_period = p;
19544
+ // if we have not yet encountered a zero, we have to skip it as well
19545
+ if(answer.num_digits == 0) {
19546
+ // skip zeros
19547
+ while ((p != pend) && (*p == '0')) {
19548
+ ++p;
19549
+ }
19550
+ }
19551
+ // We expect that this loop will often take the bulk of the running time
19552
+ // because when a value has lots of digits, these digits often
19553
+ while ((p + 8 <= pend) && (answer.num_digits + 8 < max_digits)) {
19554
+ uint64_t val = read_u64(p);
19555
+ if(! is_made_of_eight_digits_fast(val)) { break; }
19556
+ // We have eight digits, process them in one go!
19557
+ val -= 0x3030303030303030;
19558
+ write_u64(answer.digits + answer.num_digits, val);
19559
+ answer.num_digits += 8;
19560
+ p += 8;
19561
+ }
19562
+ while ((p != pend) && is_integer(*p)) {
19563
+ if (answer.num_digits < max_digits) {
19564
+ answer.digits[answer.num_digits] = uint8_t(*p - '0');
19565
+ }
19566
+ answer.num_digits++;
19567
+ ++p;
19568
+ }
19569
+ answer.decimal_point = int32_t(first_after_period - p);
19570
+ }
19571
+ // We want num_digits to be the number of significant digits, excluding
19572
+ // leading *and* trailing zeros! Otherwise the truncated flag later is
19573
+ // going to be misleading.
19574
+ if(answer.num_digits > 0) {
19575
+ // We potentially need the answer.num_digits > 0 guard because we
19576
+ // prune leading zeros. So with answer.num_digits > 0, we know that
19577
+ // we have at least one non-zero digit.
19578
+ const char *preverse = p - 1;
19579
+ int32_t trailing_zeros = 0;
19580
+ while ((*preverse == '0') || (*preverse == '.')) {
19581
+ if(*preverse == '0') { trailing_zeros++; };
19582
+ --preverse;
19583
+ }
19584
+ answer.decimal_point += int32_t(answer.num_digits);
19585
+ answer.num_digits -= uint32_t(trailing_zeros);
19586
+ }
19587
+ if(answer.num_digits > max_digits) {
19588
+ answer.truncated = true;
19589
+ answer.num_digits = max_digits;
19590
+ }
19591
+ if ((p != pend) && (('e' == *p) || ('E' == *p))) {
19592
+ ++p;
19593
+ bool neg_exp = false;
19594
+ if ((p != pend) && ('-' == *p)) {
19595
+ neg_exp = true;
19596
+ ++p;
19597
+ } else if ((p != pend) && ('+' == *p)) { // '+' on exponent is allowed by C++17 20.19.3.(7.1)
19598
+ ++p;
19599
+ }
19600
+ int32_t exp_number = 0; // exponential part
19601
+ while ((p != pend) && is_integer(*p)) {
19602
+ uint8_t digit = uint8_t(*p - '0');
19603
+ if (exp_number < 0x10000) {
19604
+ exp_number = 10 * exp_number + digit;
19605
+ }
19606
+ ++p;
19607
+ }
19608
+ answer.decimal_point += (neg_exp ? -exp_number : exp_number);
19609
+ }
19610
+ // In very rare cases, we may have fewer than 19 digits, we want to be able to reliably
19611
+ // assume that all digits up to max_digit_without_overflow have been initialized.
19612
+ for(uint32_t i = answer.num_digits; i < max_digit_without_overflow; i++) { answer.digits[i] = 0; }
19613
+
19614
+ return answer;
19615
+ }
19616
+ } // namespace duckdb_fast_float
19617
+
19618
+ #endif
19619
+
19620
+
19621
+ #ifndef FASTFLOAT_FAST_TABLE_H
19622
+ #define FASTFLOAT_FAST_TABLE_H
19623
+ #include <cstdint>
19624
+
19625
+ namespace duckdb_fast_float {
19626
+
19627
+ /**
19628
+ * When mapping numbers from decimal to binary,
19629
+ * we go from w * 10^q to m * 2^p but we have
19630
+ * 10^q = 5^q * 2^q, so effectively
19631
+ * we are trying to match
19632
+ * w * 2^q * 5^q to m * 2^p. Thus the powers of two
19633
+ * are not a concern since they can be represented
19634
+ * exactly using the binary notation, only the powers of five
19635
+ * affect the binary significand.
19636
+ */
19637
+
19638
+ /**
19639
+ * The smallest non-zero float (binary64) is 2^−1074.
19640
+ * We take as input numbers of the form w x 10^q where w < 2^64.
19641
+ * We have that w * 10^-343 < 2^(64-344) 5^-343 < 2^-1076.
19642
+ * However, we have that
19643
+ * (2^64-1) * 10^-342 = (2^64-1) * 2^-342 * 5^-342 > 2^−1074.
19644
+ * Thus it is possible for a number of the form w * 10^-342 where
19645
+ * w is a 64-bit value to be a non-zero floating-point number.
19646
+ *********
19647
+ * Any number of form w * 10^309 where w>= 1 is going to be
19648
+ * infinite in binary64 so we never need to worry about powers
19649
+ * of 5 greater than 308.
19650
+ */
19651
+ template <class unused = void>
19652
+ struct powers_template {
19653
+
19654
+ constexpr static int smallest_power_of_five = binary_format<double>::smallest_power_of_ten();
19655
+ constexpr static int largest_power_of_five = binary_format<double>::largest_power_of_ten();
19656
+ constexpr static int number_of_entries = 2 * (largest_power_of_five - smallest_power_of_five + 1);
19657
+ // Powers of five from 5^-342 all the way to 5^308 rounded toward one.
19658
+ static const uint64_t power_of_five_128[number_of_entries];
19659
+ };
19660
+
19661
+ template <class unused>
19662
+ const uint64_t powers_template<unused>::power_of_five_128[number_of_entries] = {
19663
+ 0xeef453d6923bd65a,0x113faa2906a13b3f,
19664
+ 0x9558b4661b6565f8,0x4ac7ca59a424c507,
19665
+ 0xbaaee17fa23ebf76,0x5d79bcf00d2df649,
19666
+ 0xe95a99df8ace6f53,0xf4d82c2c107973dc,
19667
+ 0x91d8a02bb6c10594,0x79071b9b8a4be869,
19668
+ 0xb64ec836a47146f9,0x9748e2826cdee284,
19669
+ 0xe3e27a444d8d98b7,0xfd1b1b2308169b25,
19670
+ 0x8e6d8c6ab0787f72,0xfe30f0f5e50e20f7,
19671
+ 0xb208ef855c969f4f,0xbdbd2d335e51a935,
19672
+ 0xde8b2b66b3bc4723,0xad2c788035e61382,
19673
+ 0x8b16fb203055ac76,0x4c3bcb5021afcc31,
19674
+ 0xaddcb9e83c6b1793,0xdf4abe242a1bbf3d,
19675
+ 0xd953e8624b85dd78,0xd71d6dad34a2af0d,
19676
+ 0x87d4713d6f33aa6b,0x8672648c40e5ad68,
19677
+ 0xa9c98d8ccb009506,0x680efdaf511f18c2,
19678
+ 0xd43bf0effdc0ba48,0x212bd1b2566def2,
19679
+ 0x84a57695fe98746d,0x14bb630f7604b57,
19680
+ 0xa5ced43b7e3e9188,0x419ea3bd35385e2d,
19681
+ 0xcf42894a5dce35ea,0x52064cac828675b9,
19682
+ 0x818995ce7aa0e1b2,0x7343efebd1940993,
19683
+ 0xa1ebfb4219491a1f,0x1014ebe6c5f90bf8,
19684
+ 0xca66fa129f9b60a6,0xd41a26e077774ef6,
19685
+ 0xfd00b897478238d0,0x8920b098955522b4,
19686
+ 0x9e20735e8cb16382,0x55b46e5f5d5535b0,
19687
+ 0xc5a890362fddbc62,0xeb2189f734aa831d,
19688
+ 0xf712b443bbd52b7b,0xa5e9ec7501d523e4,
19689
+ 0x9a6bb0aa55653b2d,0x47b233c92125366e,
19690
+ 0xc1069cd4eabe89f8,0x999ec0bb696e840a,
19691
+ 0xf148440a256e2c76,0xc00670ea43ca250d,
19692
+ 0x96cd2a865764dbca,0x380406926a5e5728,
19693
+ 0xbc807527ed3e12bc,0xc605083704f5ecf2,
19694
+ 0xeba09271e88d976b,0xf7864a44c633682e,
19695
+ 0x93445b8731587ea3,0x7ab3ee6afbe0211d,
19696
+ 0xb8157268fdae9e4c,0x5960ea05bad82964,
19697
+ 0xe61acf033d1a45df,0x6fb92487298e33bd,
19698
+ 0x8fd0c16206306bab,0xa5d3b6d479f8e056,
19699
+ 0xb3c4f1ba87bc8696,0x8f48a4899877186c,
19700
+ 0xe0b62e2929aba83c,0x331acdabfe94de87,
19701
+ 0x8c71dcd9ba0b4925,0x9ff0c08b7f1d0b14,
19702
+ 0xaf8e5410288e1b6f,0x7ecf0ae5ee44dd9,
19703
+ 0xdb71e91432b1a24a,0xc9e82cd9f69d6150,
19704
+ 0x892731ac9faf056e,0xbe311c083a225cd2,
19705
+ 0xab70fe17c79ac6ca,0x6dbd630a48aaf406,
19706
+ 0xd64d3d9db981787d,0x92cbbccdad5b108,
19707
+ 0x85f0468293f0eb4e,0x25bbf56008c58ea5,
19708
+ 0xa76c582338ed2621,0xaf2af2b80af6f24e,
19709
+ 0xd1476e2c07286faa,0x1af5af660db4aee1,
19710
+ 0x82cca4db847945ca,0x50d98d9fc890ed4d,
19711
+ 0xa37fce126597973c,0xe50ff107bab528a0,
19712
+ 0xcc5fc196fefd7d0c,0x1e53ed49a96272c8,
19713
+ 0xff77b1fcbebcdc4f,0x25e8e89c13bb0f7a,
19714
+ 0x9faacf3df73609b1,0x77b191618c54e9ac,
19715
+ 0xc795830d75038c1d,0xd59df5b9ef6a2417,
19716
+ 0xf97ae3d0d2446f25,0x4b0573286b44ad1d,
19717
+ 0x9becce62836ac577,0x4ee367f9430aec32,
19718
+ 0xc2e801fb244576d5,0x229c41f793cda73f,
19719
+ 0xf3a20279ed56d48a,0x6b43527578c1110f,
19720
+ 0x9845418c345644d6,0x830a13896b78aaa9,
19721
+ 0xbe5691ef416bd60c,0x23cc986bc656d553,
19722
+ 0xedec366b11c6cb8f,0x2cbfbe86b7ec8aa8,
19723
+ 0x94b3a202eb1c3f39,0x7bf7d71432f3d6a9,
19724
+ 0xb9e08a83a5e34f07,0xdaf5ccd93fb0cc53,
19725
+ 0xe858ad248f5c22c9,0xd1b3400f8f9cff68,
19726
+ 0x91376c36d99995be,0x23100809b9c21fa1,
19727
+ 0xb58547448ffffb2d,0xabd40a0c2832a78a,
19728
+ 0xe2e69915b3fff9f9,0x16c90c8f323f516c,
19729
+ 0x8dd01fad907ffc3b,0xae3da7d97f6792e3,
19730
+ 0xb1442798f49ffb4a,0x99cd11cfdf41779c,
19731
+ 0xdd95317f31c7fa1d,0x40405643d711d583,
19732
+ 0x8a7d3eef7f1cfc52,0x482835ea666b2572,
19733
+ 0xad1c8eab5ee43b66,0xda3243650005eecf,
19734
+ 0xd863b256369d4a40,0x90bed43e40076a82,
19735
+ 0x873e4f75e2224e68,0x5a7744a6e804a291,
19736
+ 0xa90de3535aaae202,0x711515d0a205cb36,
19737
+ 0xd3515c2831559a83,0xd5a5b44ca873e03,
19738
+ 0x8412d9991ed58091,0xe858790afe9486c2,
19739
+ 0xa5178fff668ae0b6,0x626e974dbe39a872,
19740
+ 0xce5d73ff402d98e3,0xfb0a3d212dc8128f,
19741
+ 0x80fa687f881c7f8e,0x7ce66634bc9d0b99,
19742
+ 0xa139029f6a239f72,0x1c1fffc1ebc44e80,
19743
+ 0xc987434744ac874e,0xa327ffb266b56220,
19744
+ 0xfbe9141915d7a922,0x4bf1ff9f0062baa8,
19745
+ 0x9d71ac8fada6c9b5,0x6f773fc3603db4a9,
19746
+ 0xc4ce17b399107c22,0xcb550fb4384d21d3,
19747
+ 0xf6019da07f549b2b,0x7e2a53a146606a48,
19748
+ 0x99c102844f94e0fb,0x2eda7444cbfc426d,
19749
+ 0xc0314325637a1939,0xfa911155fefb5308,
19750
+ 0xf03d93eebc589f88,0x793555ab7eba27ca,
19751
+ 0x96267c7535b763b5,0x4bc1558b2f3458de,
19752
+ 0xbbb01b9283253ca2,0x9eb1aaedfb016f16,
19753
+ 0xea9c227723ee8bcb,0x465e15a979c1cadc,
19754
+ 0x92a1958a7675175f,0xbfacd89ec191ec9,
19755
+ 0xb749faed14125d36,0xcef980ec671f667b,
19756
+ 0xe51c79a85916f484,0x82b7e12780e7401a,
19757
+ 0x8f31cc0937ae58d2,0xd1b2ecb8b0908810,
19758
+ 0xb2fe3f0b8599ef07,0x861fa7e6dcb4aa15,
19759
+ 0xdfbdcece67006ac9,0x67a791e093e1d49a,
19760
+ 0x8bd6a141006042bd,0xe0c8bb2c5c6d24e0,
19761
+ 0xaecc49914078536d,0x58fae9f773886e18,
19762
+ 0xda7f5bf590966848,0xaf39a475506a899e,
19763
+ 0x888f99797a5e012d,0x6d8406c952429603,
19764
+ 0xaab37fd7d8f58178,0xc8e5087ba6d33b83,
19765
+ 0xd5605fcdcf32e1d6,0xfb1e4a9a90880a64,
19766
+ 0x855c3be0a17fcd26,0x5cf2eea09a55067f,
19767
+ 0xa6b34ad8c9dfc06f,0xf42faa48c0ea481e,
19768
+ 0xd0601d8efc57b08b,0xf13b94daf124da26,
19769
+ 0x823c12795db6ce57,0x76c53d08d6b70858,
19770
+ 0xa2cb1717b52481ed,0x54768c4b0c64ca6e,
19771
+ 0xcb7ddcdda26da268,0xa9942f5dcf7dfd09,
19772
+ 0xfe5d54150b090b02,0xd3f93b35435d7c4c,
19773
+ 0x9efa548d26e5a6e1,0xc47bc5014a1a6daf,
19774
+ 0xc6b8e9b0709f109a,0x359ab6419ca1091b,
19775
+ 0xf867241c8cc6d4c0,0xc30163d203c94b62,
19776
+ 0x9b407691d7fc44f8,0x79e0de63425dcf1d,
19777
+ 0xc21094364dfb5636,0x985915fc12f542e4,
19778
+ 0xf294b943e17a2bc4,0x3e6f5b7b17b2939d,
19779
+ 0x979cf3ca6cec5b5a,0xa705992ceecf9c42,
19780
+ 0xbd8430bd08277231,0x50c6ff782a838353,
19781
+ 0xece53cec4a314ebd,0xa4f8bf5635246428,
19782
+ 0x940f4613ae5ed136,0x871b7795e136be99,
19783
+ 0xb913179899f68584,0x28e2557b59846e3f,
19784
+ 0xe757dd7ec07426e5,0x331aeada2fe589cf,
19785
+ 0x9096ea6f3848984f,0x3ff0d2c85def7621,
19786
+ 0xb4bca50b065abe63,0xfed077a756b53a9,
19787
+ 0xe1ebce4dc7f16dfb,0xd3e8495912c62894,
19788
+ 0x8d3360f09cf6e4bd,0x64712dd7abbbd95c,
19789
+ 0xb080392cc4349dec,0xbd8d794d96aacfb3,
19790
+ 0xdca04777f541c567,0xecf0d7a0fc5583a0,
19791
+ 0x89e42caaf9491b60,0xf41686c49db57244,
19792
+ 0xac5d37d5b79b6239,0x311c2875c522ced5,
19793
+ 0xd77485cb25823ac7,0x7d633293366b828b,
19794
+ 0x86a8d39ef77164bc,0xae5dff9c02033197,
19795
+ 0xa8530886b54dbdeb,0xd9f57f830283fdfc,
19796
+ 0xd267caa862a12d66,0xd072df63c324fd7b,
19797
+ 0x8380dea93da4bc60,0x4247cb9e59f71e6d,
19798
+ 0xa46116538d0deb78,0x52d9be85f074e608,
19799
+ 0xcd795be870516656,0x67902e276c921f8b,
19800
+ 0x806bd9714632dff6,0xba1cd8a3db53b6,
19801
+ 0xa086cfcd97bf97f3,0x80e8a40eccd228a4,
19802
+ 0xc8a883c0fdaf7df0,0x6122cd128006b2cd,
19803
+ 0xfad2a4b13d1b5d6c,0x796b805720085f81,
19804
+ 0x9cc3a6eec6311a63,0xcbe3303674053bb0,
19805
+ 0xc3f490aa77bd60fc,0xbedbfc4411068a9c,
19806
+ 0xf4f1b4d515acb93b,0xee92fb5515482d44,
19807
+ 0x991711052d8bf3c5,0x751bdd152d4d1c4a,
19808
+ 0xbf5cd54678eef0b6,0xd262d45a78a0635d,
19809
+ 0xef340a98172aace4,0x86fb897116c87c34,
19810
+ 0x9580869f0e7aac0e,0xd45d35e6ae3d4da0,
19811
+ 0xbae0a846d2195712,0x8974836059cca109,
19812
+ 0xe998d258869facd7,0x2bd1a438703fc94b,
19813
+ 0x91ff83775423cc06,0x7b6306a34627ddcf,
19814
+ 0xb67f6455292cbf08,0x1a3bc84c17b1d542,
19815
+ 0xe41f3d6a7377eeca,0x20caba5f1d9e4a93,
19816
+ 0x8e938662882af53e,0x547eb47b7282ee9c,
19817
+ 0xb23867fb2a35b28d,0xe99e619a4f23aa43,
19818
+ 0xdec681f9f4c31f31,0x6405fa00e2ec94d4,
19819
+ 0x8b3c113c38f9f37e,0xde83bc408dd3dd04,
19820
+ 0xae0b158b4738705e,0x9624ab50b148d445,
19821
+ 0xd98ddaee19068c76,0x3badd624dd9b0957,
19822
+ 0x87f8a8d4cfa417c9,0xe54ca5d70a80e5d6,
19823
+ 0xa9f6d30a038d1dbc,0x5e9fcf4ccd211f4c,
19824
+ 0xd47487cc8470652b,0x7647c3200069671f,
19825
+ 0x84c8d4dfd2c63f3b,0x29ecd9f40041e073,
19826
+ 0xa5fb0a17c777cf09,0xf468107100525890,
19827
+ 0xcf79cc9db955c2cc,0x7182148d4066eeb4,
19828
+ 0x81ac1fe293d599bf,0xc6f14cd848405530,
19829
+ 0xa21727db38cb002f,0xb8ada00e5a506a7c,
19830
+ 0xca9cf1d206fdc03b,0xa6d90811f0e4851c,
19831
+ 0xfd442e4688bd304a,0x908f4a166d1da663,
19832
+ 0x9e4a9cec15763e2e,0x9a598e4e043287fe,
19833
+ 0xc5dd44271ad3cdba,0x40eff1e1853f29fd,
19834
+ 0xf7549530e188c128,0xd12bee59e68ef47c,
19835
+ 0x9a94dd3e8cf578b9,0x82bb74f8301958ce,
19836
+ 0xc13a148e3032d6e7,0xe36a52363c1faf01,
19837
+ 0xf18899b1bc3f8ca1,0xdc44e6c3cb279ac1,
19838
+ 0x96f5600f15a7b7e5,0x29ab103a5ef8c0b9,
19839
+ 0xbcb2b812db11a5de,0x7415d448f6b6f0e7,
19840
+ 0xebdf661791d60f56,0x111b495b3464ad21,
19841
+ 0x936b9fcebb25c995,0xcab10dd900beec34,
19842
+ 0xb84687c269ef3bfb,0x3d5d514f40eea742,
19843
+ 0xe65829b3046b0afa,0xcb4a5a3112a5112,
19844
+ 0x8ff71a0fe2c2e6dc,0x47f0e785eaba72ab,
19845
+ 0xb3f4e093db73a093,0x59ed216765690f56,
19846
+ 0xe0f218b8d25088b8,0x306869c13ec3532c,
19847
+ 0x8c974f7383725573,0x1e414218c73a13fb,
19848
+ 0xafbd2350644eeacf,0xe5d1929ef90898fa,
19849
+ 0xdbac6c247d62a583,0xdf45f746b74abf39,
19850
+ 0x894bc396ce5da772,0x6b8bba8c328eb783,
19851
+ 0xab9eb47c81f5114f,0x66ea92f3f326564,
19852
+ 0xd686619ba27255a2,0xc80a537b0efefebd,
19853
+ 0x8613fd0145877585,0xbd06742ce95f5f36,
19854
+ 0xa798fc4196e952e7,0x2c48113823b73704,
19855
+ 0xd17f3b51fca3a7a0,0xf75a15862ca504c5,
19856
+ 0x82ef85133de648c4,0x9a984d73dbe722fb,
19857
+ 0xa3ab66580d5fdaf5,0xc13e60d0d2e0ebba,
19858
+ 0xcc963fee10b7d1b3,0x318df905079926a8,
19859
+ 0xffbbcfe994e5c61f,0xfdf17746497f7052,
19860
+ 0x9fd561f1fd0f9bd3,0xfeb6ea8bedefa633,
19861
+ 0xc7caba6e7c5382c8,0xfe64a52ee96b8fc0,
19862
+ 0xf9bd690a1b68637b,0x3dfdce7aa3c673b0,
19863
+ 0x9c1661a651213e2d,0x6bea10ca65c084e,
19864
+ 0xc31bfa0fe5698db8,0x486e494fcff30a62,
19865
+ 0xf3e2f893dec3f126,0x5a89dba3c3efccfa,
19866
+ 0x986ddb5c6b3a76b7,0xf89629465a75e01c,
19867
+ 0xbe89523386091465,0xf6bbb397f1135823,
19868
+ 0xee2ba6c0678b597f,0x746aa07ded582e2c,
19869
+ 0x94db483840b717ef,0xa8c2a44eb4571cdc,
19870
+ 0xba121a4650e4ddeb,0x92f34d62616ce413,
19871
+ 0xe896a0d7e51e1566,0x77b020baf9c81d17,
19872
+ 0x915e2486ef32cd60,0xace1474dc1d122e,
19873
+ 0xb5b5ada8aaff80b8,0xd819992132456ba,
19874
+ 0xe3231912d5bf60e6,0x10e1fff697ed6c69,
19875
+ 0x8df5efabc5979c8f,0xca8d3ffa1ef463c1,
19876
+ 0xb1736b96b6fd83b3,0xbd308ff8a6b17cb2,
19877
+ 0xddd0467c64bce4a0,0xac7cb3f6d05ddbde,
19878
+ 0x8aa22c0dbef60ee4,0x6bcdf07a423aa96b,
19879
+ 0xad4ab7112eb3929d,0x86c16c98d2c953c6,
19880
+ 0xd89d64d57a607744,0xe871c7bf077ba8b7,
19881
+ 0x87625f056c7c4a8b,0x11471cd764ad4972,
19882
+ 0xa93af6c6c79b5d2d,0xd598e40d3dd89bcf,
19883
+ 0xd389b47879823479,0x4aff1d108d4ec2c3,
19884
+ 0x843610cb4bf160cb,0xcedf722a585139ba,
19885
+ 0xa54394fe1eedb8fe,0xc2974eb4ee658828,
19886
+ 0xce947a3da6a9273e,0x733d226229feea32,
19887
+ 0x811ccc668829b887,0x806357d5a3f525f,
19888
+ 0xa163ff802a3426a8,0xca07c2dcb0cf26f7,
19889
+ 0xc9bcff6034c13052,0xfc89b393dd02f0b5,
19890
+ 0xfc2c3f3841f17c67,0xbbac2078d443ace2,
19891
+ 0x9d9ba7832936edc0,0xd54b944b84aa4c0d,
19892
+ 0xc5029163f384a931,0xa9e795e65d4df11,
19893
+ 0xf64335bcf065d37d,0x4d4617b5ff4a16d5,
19894
+ 0x99ea0196163fa42e,0x504bced1bf8e4e45,
19895
+ 0xc06481fb9bcf8d39,0xe45ec2862f71e1d6,
19896
+ 0xf07da27a82c37088,0x5d767327bb4e5a4c,
19897
+ 0x964e858c91ba2655,0x3a6a07f8d510f86f,
19898
+ 0xbbe226efb628afea,0x890489f70a55368b,
19899
+ 0xeadab0aba3b2dbe5,0x2b45ac74ccea842e,
19900
+ 0x92c8ae6b464fc96f,0x3b0b8bc90012929d,
19901
+ 0xb77ada0617e3bbcb,0x9ce6ebb40173744,
19902
+ 0xe55990879ddcaabd,0xcc420a6a101d0515,
19903
+ 0x8f57fa54c2a9eab6,0x9fa946824a12232d,
19904
+ 0xb32df8e9f3546564,0x47939822dc96abf9,
19905
+ 0xdff9772470297ebd,0x59787e2b93bc56f7,
19906
+ 0x8bfbea76c619ef36,0x57eb4edb3c55b65a,
19907
+ 0xaefae51477a06b03,0xede622920b6b23f1,
19908
+ 0xdab99e59958885c4,0xe95fab368e45eced,
19909
+ 0x88b402f7fd75539b,0x11dbcb0218ebb414,
19910
+ 0xaae103b5fcd2a881,0xd652bdc29f26a119,
19911
+ 0xd59944a37c0752a2,0x4be76d3346f0495f,
19912
+ 0x857fcae62d8493a5,0x6f70a4400c562ddb,
19913
+ 0xa6dfbd9fb8e5b88e,0xcb4ccd500f6bb952,
19914
+ 0xd097ad07a71f26b2,0x7e2000a41346a7a7,
19915
+ 0x825ecc24c873782f,0x8ed400668c0c28c8,
19916
+ 0xa2f67f2dfa90563b,0x728900802f0f32fa,
19917
+ 0xcbb41ef979346bca,0x4f2b40a03ad2ffb9,
19918
+ 0xfea126b7d78186bc,0xe2f610c84987bfa8,
19919
+ 0x9f24b832e6b0f436,0xdd9ca7d2df4d7c9,
19920
+ 0xc6ede63fa05d3143,0x91503d1c79720dbb,
19921
+ 0xf8a95fcf88747d94,0x75a44c6397ce912a,
19922
+ 0x9b69dbe1b548ce7c,0xc986afbe3ee11aba,
19923
+ 0xc24452da229b021b,0xfbe85badce996168,
19924
+ 0xf2d56790ab41c2a2,0xfae27299423fb9c3,
19925
+ 0x97c560ba6b0919a5,0xdccd879fc967d41a,
19926
+ 0xbdb6b8e905cb600f,0x5400e987bbc1c920,
19927
+ 0xed246723473e3813,0x290123e9aab23b68,
19928
+ 0x9436c0760c86e30b,0xf9a0b6720aaf6521,
19929
+ 0xb94470938fa89bce,0xf808e40e8d5b3e69,
19930
+ 0xe7958cb87392c2c2,0xb60b1d1230b20e04,
19931
+ 0x90bd77f3483bb9b9,0xb1c6f22b5e6f48c2,
19932
+ 0xb4ecd5f01a4aa828,0x1e38aeb6360b1af3,
19933
+ 0xe2280b6c20dd5232,0x25c6da63c38de1b0,
19934
+ 0x8d590723948a535f,0x579c487e5a38ad0e,
19935
+ 0xb0af48ec79ace837,0x2d835a9df0c6d851,
19936
+ 0xdcdb1b2798182244,0xf8e431456cf88e65,
19937
+ 0x8a08f0f8bf0f156b,0x1b8e9ecb641b58ff,
19938
+ 0xac8b2d36eed2dac5,0xe272467e3d222f3f,
19939
+ 0xd7adf884aa879177,0x5b0ed81dcc6abb0f,
19940
+ 0x86ccbb52ea94baea,0x98e947129fc2b4e9,
19941
+ 0xa87fea27a539e9a5,0x3f2398d747b36224,
19942
+ 0xd29fe4b18e88640e,0x8eec7f0d19a03aad,
19943
+ 0x83a3eeeef9153e89,0x1953cf68300424ac,
19944
+ 0xa48ceaaab75a8e2b,0x5fa8c3423c052dd7,
19945
+ 0xcdb02555653131b6,0x3792f412cb06794d,
19946
+ 0x808e17555f3ebf11,0xe2bbd88bbee40bd0,
19947
+ 0xa0b19d2ab70e6ed6,0x5b6aceaeae9d0ec4,
19948
+ 0xc8de047564d20a8b,0xf245825a5a445275,
19949
+ 0xfb158592be068d2e,0xeed6e2f0f0d56712,
19950
+ 0x9ced737bb6c4183d,0x55464dd69685606b,
19951
+ 0xc428d05aa4751e4c,0xaa97e14c3c26b886,
19952
+ 0xf53304714d9265df,0xd53dd99f4b3066a8,
19953
+ 0x993fe2c6d07b7fab,0xe546a8038efe4029,
19954
+ 0xbf8fdb78849a5f96,0xde98520472bdd033,
19955
+ 0xef73d256a5c0f77c,0x963e66858f6d4440,
19956
+ 0x95a8637627989aad,0xdde7001379a44aa8,
19957
+ 0xbb127c53b17ec159,0x5560c018580d5d52,
19958
+ 0xe9d71b689dde71af,0xaab8f01e6e10b4a6,
19959
+ 0x9226712162ab070d,0xcab3961304ca70e8,
19960
+ 0xb6b00d69bb55c8d1,0x3d607b97c5fd0d22,
19961
+ 0xe45c10c42a2b3b05,0x8cb89a7db77c506a,
19962
+ 0x8eb98a7a9a5b04e3,0x77f3608e92adb242,
19963
+ 0xb267ed1940f1c61c,0x55f038b237591ed3,
19964
+ 0xdf01e85f912e37a3,0x6b6c46dec52f6688,
19965
+ 0x8b61313bbabce2c6,0x2323ac4b3b3da015,
19966
+ 0xae397d8aa96c1b77,0xabec975e0a0d081a,
19967
+ 0xd9c7dced53c72255,0x96e7bd358c904a21,
19968
+ 0x881cea14545c7575,0x7e50d64177da2e54,
19969
+ 0xaa242499697392d2,0xdde50bd1d5d0b9e9,
19970
+ 0xd4ad2dbfc3d07787,0x955e4ec64b44e864,
19971
+ 0x84ec3c97da624ab4,0xbd5af13bef0b113e,
19972
+ 0xa6274bbdd0fadd61,0xecb1ad8aeacdd58e,
19973
+ 0xcfb11ead453994ba,0x67de18eda5814af2,
19974
+ 0x81ceb32c4b43fcf4,0x80eacf948770ced7,
19975
+ 0xa2425ff75e14fc31,0xa1258379a94d028d,
19976
+ 0xcad2f7f5359a3b3e,0x96ee45813a04330,
19977
+ 0xfd87b5f28300ca0d,0x8bca9d6e188853fc,
19978
+ 0x9e74d1b791e07e48,0x775ea264cf55347e,
19979
+ 0xc612062576589dda,0x95364afe032a819e,
19980
+ 0xf79687aed3eec551,0x3a83ddbd83f52205,
19981
+ 0x9abe14cd44753b52,0xc4926a9672793543,
19982
+ 0xc16d9a0095928a27,0x75b7053c0f178294,
19983
+ 0xf1c90080baf72cb1,0x5324c68b12dd6339,
19984
+ 0x971da05074da7bee,0xd3f6fc16ebca5e04,
19985
+ 0xbce5086492111aea,0x88f4bb1ca6bcf585,
19986
+ 0xec1e4a7db69561a5,0x2b31e9e3d06c32e6,
19987
+ 0x9392ee8e921d5d07,0x3aff322e62439fd0,
19988
+ 0xb877aa3236a4b449,0x9befeb9fad487c3,
19989
+ 0xe69594bec44de15b,0x4c2ebe687989a9b4,
19990
+ 0x901d7cf73ab0acd9,0xf9d37014bf60a11,
19991
+ 0xb424dc35095cd80f,0x538484c19ef38c95,
19992
+ 0xe12e13424bb40e13,0x2865a5f206b06fba,
19993
+ 0x8cbccc096f5088cb,0xf93f87b7442e45d4,
19994
+ 0xafebff0bcb24aafe,0xf78f69a51539d749,
19995
+ 0xdbe6fecebdedd5be,0xb573440e5a884d1c,
19996
+ 0x89705f4136b4a597,0x31680a88f8953031,
19997
+ 0xabcc77118461cefc,0xfdc20d2b36ba7c3e,
19998
+ 0xd6bf94d5e57a42bc,0x3d32907604691b4d,
19999
+ 0x8637bd05af6c69b5,0xa63f9a49c2c1b110,
20000
+ 0xa7c5ac471b478423,0xfcf80dc33721d54,
20001
+ 0xd1b71758e219652b,0xd3c36113404ea4a9,
20002
+ 0x83126e978d4fdf3b,0x645a1cac083126ea,
20003
+ 0xa3d70a3d70a3d70a,0x3d70a3d70a3d70a4,
20004
+ 0xcccccccccccccccc,0xcccccccccccccccd,
20005
+ 0x8000000000000000,0x0,
20006
+ 0xa000000000000000,0x0,
20007
+ 0xc800000000000000,0x0,
20008
+ 0xfa00000000000000,0x0,
20009
+ 0x9c40000000000000,0x0,
20010
+ 0xc350000000000000,0x0,
20011
+ 0xf424000000000000,0x0,
20012
+ 0x9896800000000000,0x0,
20013
+ 0xbebc200000000000,0x0,
20014
+ 0xee6b280000000000,0x0,
20015
+ 0x9502f90000000000,0x0,
20016
+ 0xba43b74000000000,0x0,
20017
+ 0xe8d4a51000000000,0x0,
20018
+ 0x9184e72a00000000,0x0,
20019
+ 0xb5e620f480000000,0x0,
20020
+ 0xe35fa931a0000000,0x0,
20021
+ 0x8e1bc9bf04000000,0x0,
20022
+ 0xb1a2bc2ec5000000,0x0,
20023
+ 0xde0b6b3a76400000,0x0,
20024
+ 0x8ac7230489e80000,0x0,
20025
+ 0xad78ebc5ac620000,0x0,
20026
+ 0xd8d726b7177a8000,0x0,
20027
+ 0x878678326eac9000,0x0,
20028
+ 0xa968163f0a57b400,0x0,
20029
+ 0xd3c21bcecceda100,0x0,
20030
+ 0x84595161401484a0,0x0,
20031
+ 0xa56fa5b99019a5c8,0x0,
20032
+ 0xcecb8f27f4200f3a,0x0,
20033
+ 0x813f3978f8940984,0x4000000000000000,
20034
+ 0xa18f07d736b90be5,0x5000000000000000,
20035
+ 0xc9f2c9cd04674ede,0xa400000000000000,
20036
+ 0xfc6f7c4045812296,0x4d00000000000000,
20037
+ 0x9dc5ada82b70b59d,0xf020000000000000,
20038
+ 0xc5371912364ce305,0x6c28000000000000,
20039
+ 0xf684df56c3e01bc6,0xc732000000000000,
20040
+ 0x9a130b963a6c115c,0x3c7f400000000000,
20041
+ 0xc097ce7bc90715b3,0x4b9f100000000000,
20042
+ 0xf0bdc21abb48db20,0x1e86d40000000000,
20043
+ 0x96769950b50d88f4,0x1314448000000000,
20044
+ 0xbc143fa4e250eb31,0x17d955a000000000,
20045
+ 0xeb194f8e1ae525fd,0x5dcfab0800000000,
20046
+ 0x92efd1b8d0cf37be,0x5aa1cae500000000,
20047
+ 0xb7abc627050305ad,0xf14a3d9e40000000,
20048
+ 0xe596b7b0c643c719,0x6d9ccd05d0000000,
20049
+ 0x8f7e32ce7bea5c6f,0xe4820023a2000000,
20050
+ 0xb35dbf821ae4f38b,0xdda2802c8a800000,
20051
+ 0xe0352f62a19e306e,0xd50b2037ad200000,
20052
+ 0x8c213d9da502de45,0x4526f422cc340000,
20053
+ 0xaf298d050e4395d6,0x9670b12b7f410000,
20054
+ 0xdaf3f04651d47b4c,0x3c0cdd765f114000,
20055
+ 0x88d8762bf324cd0f,0xa5880a69fb6ac800,
20056
+ 0xab0e93b6efee0053,0x8eea0d047a457a00,
20057
+ 0xd5d238a4abe98068,0x72a4904598d6d880,
20058
+ 0x85a36366eb71f041,0x47a6da2b7f864750,
20059
+ 0xa70c3c40a64e6c51,0x999090b65f67d924,
20060
+ 0xd0cf4b50cfe20765,0xfff4b4e3f741cf6d,
20061
+ 0x82818f1281ed449f,0xbff8f10e7a8921a4,
20062
+ 0xa321f2d7226895c7,0xaff72d52192b6a0d,
20063
+ 0xcbea6f8ceb02bb39,0x9bf4f8a69f764490,
20064
+ 0xfee50b7025c36a08,0x2f236d04753d5b4,
20065
+ 0x9f4f2726179a2245,0x1d762422c946590,
20066
+ 0xc722f0ef9d80aad6,0x424d3ad2b7b97ef5,
20067
+ 0xf8ebad2b84e0d58b,0xd2e0898765a7deb2,
20068
+ 0x9b934c3b330c8577,0x63cc55f49f88eb2f,
20069
+ 0xc2781f49ffcfa6d5,0x3cbf6b71c76b25fb,
20070
+ 0xf316271c7fc3908a,0x8bef464e3945ef7a,
20071
+ 0x97edd871cfda3a56,0x97758bf0e3cbb5ac,
20072
+ 0xbde94e8e43d0c8ec,0x3d52eeed1cbea317,
20073
+ 0xed63a231d4c4fb27,0x4ca7aaa863ee4bdd,
20074
+ 0x945e455f24fb1cf8,0x8fe8caa93e74ef6a,
20075
+ 0xb975d6b6ee39e436,0xb3e2fd538e122b44,
20076
+ 0xe7d34c64a9c85d44,0x60dbbca87196b616,
20077
+ 0x90e40fbeea1d3a4a,0xbc8955e946fe31cd,
20078
+ 0xb51d13aea4a488dd,0x6babab6398bdbe41,
20079
+ 0xe264589a4dcdab14,0xc696963c7eed2dd1,
20080
+ 0x8d7eb76070a08aec,0xfc1e1de5cf543ca2,
20081
+ 0xb0de65388cc8ada8,0x3b25a55f43294bcb,
20082
+ 0xdd15fe86affad912,0x49ef0eb713f39ebe,
20083
+ 0x8a2dbf142dfcc7ab,0x6e3569326c784337,
20084
+ 0xacb92ed9397bf996,0x49c2c37f07965404,
20085
+ 0xd7e77a8f87daf7fb,0xdc33745ec97be906,
20086
+ 0x86f0ac99b4e8dafd,0x69a028bb3ded71a3,
20087
+ 0xa8acd7c0222311bc,0xc40832ea0d68ce0c,
20088
+ 0xd2d80db02aabd62b,0xf50a3fa490c30190,
20089
+ 0x83c7088e1aab65db,0x792667c6da79e0fa,
20090
+ 0xa4b8cab1a1563f52,0x577001b891185938,
20091
+ 0xcde6fd5e09abcf26,0xed4c0226b55e6f86,
20092
+ 0x80b05e5ac60b6178,0x544f8158315b05b4,
20093
+ 0xa0dc75f1778e39d6,0x696361ae3db1c721,
20094
+ 0xc913936dd571c84c,0x3bc3a19cd1e38e9,
20095
+ 0xfb5878494ace3a5f,0x4ab48a04065c723,
20096
+ 0x9d174b2dcec0e47b,0x62eb0d64283f9c76,
20097
+ 0xc45d1df942711d9a,0x3ba5d0bd324f8394,
20098
+ 0xf5746577930d6500,0xca8f44ec7ee36479,
20099
+ 0x9968bf6abbe85f20,0x7e998b13cf4e1ecb,
20100
+ 0xbfc2ef456ae276e8,0x9e3fedd8c321a67e,
20101
+ 0xefb3ab16c59b14a2,0xc5cfe94ef3ea101e,
20102
+ 0x95d04aee3b80ece5,0xbba1f1d158724a12,
20103
+ 0xbb445da9ca61281f,0x2a8a6e45ae8edc97,
20104
+ 0xea1575143cf97226,0xf52d09d71a3293bd,
20105
+ 0x924d692ca61be758,0x593c2626705f9c56,
20106
+ 0xb6e0c377cfa2e12e,0x6f8b2fb00c77836c,
20107
+ 0xe498f455c38b997a,0xb6dfb9c0f956447,
20108
+ 0x8edf98b59a373fec,0x4724bd4189bd5eac,
20109
+ 0xb2977ee300c50fe7,0x58edec91ec2cb657,
20110
+ 0xdf3d5e9bc0f653e1,0x2f2967b66737e3ed,
20111
+ 0x8b865b215899f46c,0xbd79e0d20082ee74,
20112
+ 0xae67f1e9aec07187,0xecd8590680a3aa11,
20113
+ 0xda01ee641a708de9,0xe80e6f4820cc9495,
20114
+ 0x884134fe908658b2,0x3109058d147fdcdd,
20115
+ 0xaa51823e34a7eede,0xbd4b46f0599fd415,
20116
+ 0xd4e5e2cdc1d1ea96,0x6c9e18ac7007c91a,
20117
+ 0x850fadc09923329e,0x3e2cf6bc604ddb0,
20118
+ 0xa6539930bf6bff45,0x84db8346b786151c,
20119
+ 0xcfe87f7cef46ff16,0xe612641865679a63,
20120
+ 0x81f14fae158c5f6e,0x4fcb7e8f3f60c07e,
20121
+ 0xa26da3999aef7749,0xe3be5e330f38f09d,
20122
+ 0xcb090c8001ab551c,0x5cadf5bfd3072cc5,
20123
+ 0xfdcb4fa002162a63,0x73d9732fc7c8f7f6,
20124
+ 0x9e9f11c4014dda7e,0x2867e7fddcdd9afa,
20125
+ 0xc646d63501a1511d,0xb281e1fd541501b8,
20126
+ 0xf7d88bc24209a565,0x1f225a7ca91a4226,
20127
+ 0x9ae757596946075f,0x3375788de9b06958,
20128
+ 0xc1a12d2fc3978937,0x52d6b1641c83ae,
20129
+ 0xf209787bb47d6b84,0xc0678c5dbd23a49a,
20130
+ 0x9745eb4d50ce6332,0xf840b7ba963646e0,
20131
+ 0xbd176620a501fbff,0xb650e5a93bc3d898,
20132
+ 0xec5d3fa8ce427aff,0xa3e51f138ab4cebe,
20133
+ 0x93ba47c980e98cdf,0xc66f336c36b10137,
20134
+ 0xb8a8d9bbe123f017,0xb80b0047445d4184,
20135
+ 0xe6d3102ad96cec1d,0xa60dc059157491e5,
20136
+ 0x9043ea1ac7e41392,0x87c89837ad68db2f,
20137
+ 0xb454e4a179dd1877,0x29babe4598c311fb,
20138
+ 0xe16a1dc9d8545e94,0xf4296dd6fef3d67a,
20139
+ 0x8ce2529e2734bb1d,0x1899e4a65f58660c,
20140
+ 0xb01ae745b101e9e4,0x5ec05dcff72e7f8f,
20141
+ 0xdc21a1171d42645d,0x76707543f4fa1f73,
20142
+ 0x899504ae72497eba,0x6a06494a791c53a8,
20143
+ 0xabfa45da0edbde69,0x487db9d17636892,
20144
+ 0xd6f8d7509292d603,0x45a9d2845d3c42b6,
20145
+ 0x865b86925b9bc5c2,0xb8a2392ba45a9b2,
20146
+ 0xa7f26836f282b732,0x8e6cac7768d7141e,
20147
+ 0xd1ef0244af2364ff,0x3207d795430cd926,
20148
+ 0x8335616aed761f1f,0x7f44e6bd49e807b8,
20149
+ 0xa402b9c5a8d3a6e7,0x5f16206c9c6209a6,
20150
+ 0xcd036837130890a1,0x36dba887c37a8c0f,
20151
+ 0x802221226be55a64,0xc2494954da2c9789,
20152
+ 0xa02aa96b06deb0fd,0xf2db9baa10b7bd6c,
20153
+ 0xc83553c5c8965d3d,0x6f92829494e5acc7,
20154
+ 0xfa42a8b73abbf48c,0xcb772339ba1f17f9,
20155
+ 0x9c69a97284b578d7,0xff2a760414536efb,
20156
+ 0xc38413cf25e2d70d,0xfef5138519684aba,
20157
+ 0xf46518c2ef5b8cd1,0x7eb258665fc25d69,
20158
+ 0x98bf2f79d5993802,0xef2f773ffbd97a61,
20159
+ 0xbeeefb584aff8603,0xaafb550ffacfd8fa,
20160
+ 0xeeaaba2e5dbf6784,0x95ba2a53f983cf38,
20161
+ 0x952ab45cfa97a0b2,0xdd945a747bf26183,
20162
+ 0xba756174393d88df,0x94f971119aeef9e4,
20163
+ 0xe912b9d1478ceb17,0x7a37cd5601aab85d,
20164
+ 0x91abb422ccb812ee,0xac62e055c10ab33a,
20165
+ 0xb616a12b7fe617aa,0x577b986b314d6009,
20166
+ 0xe39c49765fdf9d94,0xed5a7e85fda0b80b,
20167
+ 0x8e41ade9fbebc27d,0x14588f13be847307,
20168
+ 0xb1d219647ae6b31c,0x596eb2d8ae258fc8,
20169
+ 0xde469fbd99a05fe3,0x6fca5f8ed9aef3bb,
20170
+ 0x8aec23d680043bee,0x25de7bb9480d5854,
20171
+ 0xada72ccc20054ae9,0xaf561aa79a10ae6a,
20172
+ 0xd910f7ff28069da4,0x1b2ba1518094da04,
20173
+ 0x87aa9aff79042286,0x90fb44d2f05d0842,
20174
+ 0xa99541bf57452b28,0x353a1607ac744a53,
20175
+ 0xd3fa922f2d1675f2,0x42889b8997915ce8,
20176
+ 0x847c9b5d7c2e09b7,0x69956135febada11,
20177
+ 0xa59bc234db398c25,0x43fab9837e699095,
20178
+ 0xcf02b2c21207ef2e,0x94f967e45e03f4bb,
20179
+ 0x8161afb94b44f57d,0x1d1be0eebac278f5,
20180
+ 0xa1ba1ba79e1632dc,0x6462d92a69731732,
20181
+ 0xca28a291859bbf93,0x7d7b8f7503cfdcfe,
20182
+ 0xfcb2cb35e702af78,0x5cda735244c3d43e,
20183
+ 0x9defbf01b061adab,0x3a0888136afa64a7,
20184
+ 0xc56baec21c7a1916,0x88aaa1845b8fdd0,
20185
+ 0xf6c69a72a3989f5b,0x8aad549e57273d45,
20186
+ 0x9a3c2087a63f6399,0x36ac54e2f678864b,
20187
+ 0xc0cb28a98fcf3c7f,0x84576a1bb416a7dd,
20188
+ 0xf0fdf2d3f3c30b9f,0x656d44a2a11c51d5,
20189
+ 0x969eb7c47859e743,0x9f644ae5a4b1b325,
20190
+ 0xbc4665b596706114,0x873d5d9f0dde1fee,
20191
+ 0xeb57ff22fc0c7959,0xa90cb506d155a7ea,
20192
+ 0x9316ff75dd87cbd8,0x9a7f12442d588f2,
20193
+ 0xb7dcbf5354e9bece,0xc11ed6d538aeb2f,
20194
+ 0xe5d3ef282a242e81,0x8f1668c8a86da5fa,
20195
+ 0x8fa475791a569d10,0xf96e017d694487bc,
20196
+ 0xb38d92d760ec4455,0x37c981dcc395a9ac,
20197
+ 0xe070f78d3927556a,0x85bbe253f47b1417,
20198
+ 0x8c469ab843b89562,0x93956d7478ccec8e,
20199
+ 0xaf58416654a6babb,0x387ac8d1970027b2,
20200
+ 0xdb2e51bfe9d0696a,0x6997b05fcc0319e,
20201
+ 0x88fcf317f22241e2,0x441fece3bdf81f03,
20202
+ 0xab3c2fddeeaad25a,0xd527e81cad7626c3,
20203
+ 0xd60b3bd56a5586f1,0x8a71e223d8d3b074,
20204
+ 0x85c7056562757456,0xf6872d5667844e49,
20205
+ 0xa738c6bebb12d16c,0xb428f8ac016561db,
20206
+ 0xd106f86e69d785c7,0xe13336d701beba52,
20207
+ 0x82a45b450226b39c,0xecc0024661173473,
20208
+ 0xa34d721642b06084,0x27f002d7f95d0190,
20209
+ 0xcc20ce9bd35c78a5,0x31ec038df7b441f4,
20210
+ 0xff290242c83396ce,0x7e67047175a15271,
20211
+ 0x9f79a169bd203e41,0xf0062c6e984d386,
20212
+ 0xc75809c42c684dd1,0x52c07b78a3e60868,
20213
+ 0xf92e0c3537826145,0xa7709a56ccdf8a82,
20214
+ 0x9bbcc7a142b17ccb,0x88a66076400bb691,
20215
+ 0xc2abf989935ddbfe,0x6acff893d00ea435,
20216
+ 0xf356f7ebf83552fe,0x583f6b8c4124d43,
20217
+ 0x98165af37b2153de,0xc3727a337a8b704a,
20218
+ 0xbe1bf1b059e9a8d6,0x744f18c0592e4c5c,
20219
+ 0xeda2ee1c7064130c,0x1162def06f79df73,
20220
+ 0x9485d4d1c63e8be7,0x8addcb5645ac2ba8,
20221
+ 0xb9a74a0637ce2ee1,0x6d953e2bd7173692,
20222
+ 0xe8111c87c5c1ba99,0xc8fa8db6ccdd0437,
20223
+ 0x910ab1d4db9914a0,0x1d9c9892400a22a2,
20224
+ 0xb54d5e4a127f59c8,0x2503beb6d00cab4b,
20225
+ 0xe2a0b5dc971f303a,0x2e44ae64840fd61d,
20226
+ 0x8da471a9de737e24,0x5ceaecfed289e5d2,
20227
+ 0xb10d8e1456105dad,0x7425a83e872c5f47,
20228
+ 0xdd50f1996b947518,0xd12f124e28f77719,
20229
+ 0x8a5296ffe33cc92f,0x82bd6b70d99aaa6f,
20230
+ 0xace73cbfdc0bfb7b,0x636cc64d1001550b,
20231
+ 0xd8210befd30efa5a,0x3c47f7e05401aa4e,
20232
+ 0x8714a775e3e95c78,0x65acfaec34810a71,
20233
+ 0xa8d9d1535ce3b396,0x7f1839a741a14d0d,
20234
+ 0xd31045a8341ca07c,0x1ede48111209a050,
20235
+ 0x83ea2b892091e44d,0x934aed0aab460432,
20236
+ 0xa4e4b66b68b65d60,0xf81da84d5617853f,
20237
+ 0xce1de40642e3f4b9,0x36251260ab9d668e,
20238
+ 0x80d2ae83e9ce78f3,0xc1d72b7c6b426019,
20239
+ 0xa1075a24e4421730,0xb24cf65b8612f81f,
20240
+ 0xc94930ae1d529cfc,0xdee033f26797b627,
20241
+ 0xfb9b7cd9a4a7443c,0x169840ef017da3b1,
20242
+ 0x9d412e0806e88aa5,0x8e1f289560ee864e,
20243
+ 0xc491798a08a2ad4e,0xf1a6f2bab92a27e2,
20244
+ 0xf5b5d7ec8acb58a2,0xae10af696774b1db,
20245
+ 0x9991a6f3d6bf1765,0xacca6da1e0a8ef29,
20246
+ 0xbff610b0cc6edd3f,0x17fd090a58d32af3,
20247
+ 0xeff394dcff8a948e,0xddfc4b4cef07f5b0,
20248
+ 0x95f83d0a1fb69cd9,0x4abdaf101564f98e,
20249
+ 0xbb764c4ca7a4440f,0x9d6d1ad41abe37f1,
20250
+ 0xea53df5fd18d5513,0x84c86189216dc5ed,
20251
+ 0x92746b9be2f8552c,0x32fd3cf5b4e49bb4,
20252
+ 0xb7118682dbb66a77,0x3fbc8c33221dc2a1,
20253
+ 0xe4d5e82392a40515,0xfabaf3feaa5334a,
20254
+ 0x8f05b1163ba6832d,0x29cb4d87f2a7400e,
20255
+ 0xb2c71d5bca9023f8,0x743e20e9ef511012,
20256
+ 0xdf78e4b2bd342cf6,0x914da9246b255416,
20257
+ 0x8bab8eefb6409c1a,0x1ad089b6c2f7548e,
20258
+ 0xae9672aba3d0c320,0xa184ac2473b529b1,
20259
+ 0xda3c0f568cc4f3e8,0xc9e5d72d90a2741e,
20260
+ 0x8865899617fb1871,0x7e2fa67c7a658892,
20261
+ 0xaa7eebfb9df9de8d,0xddbb901b98feeab7,
20262
+ 0xd51ea6fa85785631,0x552a74227f3ea565,
20263
+ 0x8533285c936b35de,0xd53a88958f87275f,
20264
+ 0xa67ff273b8460356,0x8a892abaf368f137,
20265
+ 0xd01fef10a657842c,0x2d2b7569b0432d85,
20266
+ 0x8213f56a67f6b29b,0x9c3b29620e29fc73,
20267
+ 0xa298f2c501f45f42,0x8349f3ba91b47b8f,
20268
+ 0xcb3f2f7642717713,0x241c70a936219a73,
20269
+ 0xfe0efb53d30dd4d7,0xed238cd383aa0110,
20270
+ 0x9ec95d1463e8a506,0xf4363804324a40aa,
20271
+ 0xc67bb4597ce2ce48,0xb143c6053edcd0d5,
20272
+ 0xf81aa16fdc1b81da,0xdd94b7868e94050a,
20273
+ 0x9b10a4e5e9913128,0xca7cf2b4191c8326,
20274
+ 0xc1d4ce1f63f57d72,0xfd1c2f611f63a3f0,
20275
+ 0xf24a01a73cf2dccf,0xbc633b39673c8cec,
20276
+ 0x976e41088617ca01,0xd5be0503e085d813,
20277
+ 0xbd49d14aa79dbc82,0x4b2d8644d8a74e18,
20278
+ 0xec9c459d51852ba2,0xddf8e7d60ed1219e,
20279
+ 0x93e1ab8252f33b45,0xcabb90e5c942b503,
20280
+ 0xb8da1662e7b00a17,0x3d6a751f3b936243,
20281
+ 0xe7109bfba19c0c9d,0xcc512670a783ad4,
20282
+ 0x906a617d450187e2,0x27fb2b80668b24c5,
20283
+ 0xb484f9dc9641e9da,0xb1f9f660802dedf6,
20284
+ 0xe1a63853bbd26451,0x5e7873f8a0396973,
20285
+ 0x8d07e33455637eb2,0xdb0b487b6423e1e8,
20286
+ 0xb049dc016abc5e5f,0x91ce1a9a3d2cda62,
20287
+ 0xdc5c5301c56b75f7,0x7641a140cc7810fb,
20288
+ 0x89b9b3e11b6329ba,0xa9e904c87fcb0a9d,
20289
+ 0xac2820d9623bf429,0x546345fa9fbdcd44,
20290
+ 0xd732290fbacaf133,0xa97c177947ad4095,
20291
+ 0x867f59a9d4bed6c0,0x49ed8eabcccc485d,
20292
+ 0xa81f301449ee8c70,0x5c68f256bfff5a74,
20293
+ 0xd226fc195c6a2f8c,0x73832eec6fff3111,
20294
+ 0x83585d8fd9c25db7,0xc831fd53c5ff7eab,
20295
+ 0xa42e74f3d032f525,0xba3e7ca8b77f5e55,
20296
+ 0xcd3a1230c43fb26f,0x28ce1bd2e55f35eb,
20297
+ 0x80444b5e7aa7cf85,0x7980d163cf5b81b3,
20298
+ 0xa0555e361951c366,0xd7e105bcc332621f,
20299
+ 0xc86ab5c39fa63440,0x8dd9472bf3fefaa7,
20300
+ 0xfa856334878fc150,0xb14f98f6f0feb951,
20301
+ 0x9c935e00d4b9d8d2,0x6ed1bf9a569f33d3,
20302
+ 0xc3b8358109e84f07,0xa862f80ec4700c8,
20303
+ 0xf4a642e14c6262c8,0xcd27bb612758c0fa,
20304
+ 0x98e7e9cccfbd7dbd,0x8038d51cb897789c,
20305
+ 0xbf21e44003acdd2c,0xe0470a63e6bd56c3,
20306
+ 0xeeea5d5004981478,0x1858ccfce06cac74,
20307
+ 0x95527a5202df0ccb,0xf37801e0c43ebc8,
20308
+ 0xbaa718e68396cffd,0xd30560258f54e6ba,
20309
+ 0xe950df20247c83fd,0x47c6b82ef32a2069,
20310
+ 0x91d28b7416cdd27e,0x4cdc331d57fa5441,
20311
+ 0xb6472e511c81471d,0xe0133fe4adf8e952,
20312
+ 0xe3d8f9e563a198e5,0x58180fddd97723a6,
20313
+ 0x8e679c2f5e44ff8f,0x570f09eaa7ea7648,};
20314
+ using powers = powers_template<>;
20315
+
20316
+ }
20317
+
20318
+ #endif
20319
+
20320
+ #ifndef FASTFLOAT_DECIMAL_TO_BINARY_H
20321
+ #define FASTFLOAT_DECIMAL_TO_BINARY_H
20322
+
20323
+ #include <cfloat>
20324
+ #include <cinttypes>
20325
+ #include <cmath>
20326
+ #include <cstdint>
20327
+ #include <cstdio>
20328
+ #include <cstdlib>
20329
+ #include <cstring>
20330
+
20331
+ namespace duckdb_fast_float {
20332
+
20333
+ // This will compute or rather approximate w * 5**q and return a pair of 64-bit words approximating
20334
+ // the result, with the "high" part corresponding to the most significant bits and the
20335
+ // low part corresponding to the least significant bits.
20336
+ //
20337
+ template <int bit_precision>
20338
+ fastfloat_really_inline
20339
+ value128 compute_product_approximation(int64_t q, uint64_t w) {
20340
+ const int index = 2 * int(q - powers::smallest_power_of_five);
20341
+ // For small values of q, e.g., q in [0,27], the answer is always exact because
20342
+ // The line value128 firstproduct = full_multiplication(w, power_of_five_128[index]);
20343
+ // gives the exact answer.
20344
+ value128 firstproduct = full_multiplication(w, powers::power_of_five_128[index]);
20345
+ static_assert((bit_precision >= 0) && (bit_precision <= 64), " precision should be in (0,64]");
20346
+ constexpr uint64_t precision_mask = (bit_precision < 64) ?
20347
+ (uint64_t(0xFFFFFFFFFFFFFFFF) >> bit_precision)
20348
+ : uint64_t(0xFFFFFFFFFFFFFFFF);
20349
+ if((firstproduct.high & precision_mask) == precision_mask) { // could further guard with (lower + w < lower)
20350
+ // regarding the second product, we only need secondproduct.high, but our expectation is that the compiler will optimize this extra work away if needed.
20351
+ value128 secondproduct = full_multiplication(w, powers::power_of_five_128[index + 1]);
20352
+ firstproduct.low += secondproduct.high;
20353
+ if(secondproduct.high > firstproduct.low) {
20354
+ firstproduct.high++;
20355
+ }
20356
+ }
20357
+ return firstproduct;
20358
+ }
20359
+
20360
+ namespace detail {
20361
+ /**
20362
+ * For q in (0,350), we have that
20363
+ * f = (((152170 + 65536) * q ) >> 16);
20364
+ * is equal to
20365
+ * floor(p) + q
20366
+ * where
20367
+ * p = log(5**q)/log(2) = q * log(5)/log(2)
20368
+ *
20369
+ * For negative values of q in (-400,0), we have that
20370
+ * f = (((152170 + 65536) * q ) >> 16);
20371
+ * is equal to
20372
+ * -ceil(p) + q
20373
+ * where
20374
+ * p = log(5**-q)/log(2) = -q * log(5)/log(2)
20375
+ */
20376
+ fastfloat_really_inline int power(int q) noexcept {
20377
+ return (((152170 + 65536) * q) >> 16) + 63;
20378
+ }
20379
+ } // namespace detail
20380
+
20381
+
20382
+ // w * 10 ** q
20383
+ // The returned value should be a valid ieee64 number that simply need to be packed.
20384
+ // However, in some very rare cases, the computation will fail. In such cases, we
20385
+ // return an adjusted_mantissa with a negative power of 2: the caller should recompute
20386
+ // in such cases.
20387
+ template <typename binary>
20388
+ fastfloat_really_inline
20389
+ adjusted_mantissa compute_float(int64_t q, uint64_t w) noexcept {
20390
+ adjusted_mantissa answer;
20391
+ if ((w == 0) || (q < binary::smallest_power_of_ten())) {
20392
+ answer.power2 = 0;
20393
+ answer.mantissa = 0;
20394
+ // result should be zero
20395
+ return answer;
20396
+ }
20397
+ if (q > binary::largest_power_of_ten()) {
20398
+ // we want to get infinity:
20399
+ answer.power2 = binary::infinite_power();
20400
+ answer.mantissa = 0;
20401
+ return answer;
20402
+ }
20403
+ // At this point in time q is in [powers::smallest_power_of_five, powers::largest_power_of_five].
20404
+
20405
+ // We want the most significant bit of i to be 1. Shift if needed.
20406
+ int lz = leading_zeroes(w);
20407
+ w <<= lz;
20408
+
20409
+ // The required precision is binary::mantissa_explicit_bits() + 3 because
20410
+ // 1. We need the implicit bit
20411
+ // 2. We need an extra bit for rounding purposes
20412
+ // 3. We might lose a bit due to the "upperbit" routine (result too small, requiring a shift)
20413
+
20414
+ value128 product = compute_product_approximation<binary::mantissa_explicit_bits() + 3>(q, w);
20415
+ if(product.low == 0xFFFFFFFFFFFFFFFF) { // could guard it further
20416
+ // In some very rare cases, this could happen, in which case we might need a more accurate
20417
+ // computation that what we can provide cheaply. This is very, very unlikely.
20418
+ //
20419
+ const bool inside_safe_exponent = (q >= -27) && (q <= 55); // always good because 5**q <2**128 when q>=0,
20420
+ // and otherwise, for q<0, we have 5**-q<2**64 and the 128-bit reciprocal allows for exact computation.
20421
+ if(!inside_safe_exponent) {
20422
+ answer.power2 = -1; // This (a negative value) indicates an error condition.
20423
+ return answer;
20424
+ }
20425
+ }
20426
+ // The "compute_product_approximation" function can be slightly slower than a branchless approach:
20427
+ // value128 product = compute_product(q, w);
20428
+ // but in practice, we can win big with the compute_product_approximation if its additional branch
20429
+ // is easily predicted. Which is best is data specific.
20430
+ int upperbit = int(product.high >> 63);
20431
+
20432
+ answer.mantissa = product.high >> (upperbit + 64 - binary::mantissa_explicit_bits() - 3);
20433
+
20434
+ answer.power2 = int(detail::power(int(q)) + upperbit - lz - binary::minimum_exponent());
20435
+ if (answer.power2 <= 0) { // we have a subnormal?
20436
+ // Here have that answer.power2 <= 0 so -answer.power2 >= 0
20437
+ if(-answer.power2 + 1 >= 64) { // if we have more than 64 bits below the minimum exponent, you have a zero for sure.
20438
+ answer.power2 = 0;
20439
+ answer.mantissa = 0;
20440
+ // result should be zero
20441
+ return answer;
20442
+ }
20443
+ // next line is safe because -answer.power2 + 1 < 64
20444
+ answer.mantissa >>= -answer.power2 + 1;
20445
+ // Thankfully, we can't have both "round-to-even" and subnormals because
20446
+ // "round-to-even" only occurs for powers close to 0.
20447
+ answer.mantissa += (answer.mantissa & 1); // round up
20448
+ answer.mantissa >>= 1;
20449
+ // There is a weird scenario where we don't have a subnormal but just.
20450
+ // Suppose we start with 2.2250738585072013e-308, we end up
20451
+ // with 0x3fffffffffffff x 2^-1023-53 which is technically subnormal
20452
+ // whereas 0x40000000000000 x 2^-1023-53 is normal. Now, we need to round
20453
+ // up 0x3fffffffffffff x 2^-1023-53 and once we do, we are no longer
20454
+ // subnormal, but we can only know this after rounding.
20455
+ // So we only declare a subnormal if we are smaller than the threshold.
20456
+ answer.power2 = (answer.mantissa < (uint64_t(1) << binary::mantissa_explicit_bits())) ? 0 : 1;
20457
+ return answer;
20458
+ }
20459
+
20460
+ // usually, we round *up*, but if we fall right in between and and we have an
20461
+ // even basis, we need to round down
20462
+ // We are only concerned with the cases where 5**q fits in single 64-bit word.
20463
+ if ((product.low <= 1) && (q >= binary::min_exponent_round_to_even()) && (q <= binary::max_exponent_round_to_even()) &&
20464
+ ((answer.mantissa & 3) == 1) ) { // we may fall between two floats!
20465
+ // To be in-between two floats we need that in doing
20466
+ // answer.mantissa = product.high >> (upperbit + 64 - binary::mantissa_explicit_bits() - 3);
20467
+ // ... we dropped out only zeroes. But if this happened, then we can go back!!!
20468
+ if((answer.mantissa << (upperbit + 64 - binary::mantissa_explicit_bits() - 3)) == product.high) {
20469
+ answer.mantissa &= ~uint64_t(1); // flip it so that we do not round up
20470
+ }
20471
+ }
20472
+
20473
+ answer.mantissa += (answer.mantissa & 1); // round up
20474
+ answer.mantissa >>= 1;
20475
+ if (answer.mantissa >= (uint64_t(2) << binary::mantissa_explicit_bits())) {
20476
+ answer.mantissa = (uint64_t(1) << binary::mantissa_explicit_bits());
20477
+ answer.power2++; // undo previous addition
20478
+ }
20479
+
20480
+ answer.mantissa &= ~(uint64_t(1) << binary::mantissa_explicit_bits());
20481
+ if (answer.power2 >= binary::infinite_power()) { // infinity
20482
+ answer.power2 = binary::infinite_power();
20483
+ answer.mantissa = 0;
20484
+ }
20485
+ return answer;
20486
+ }
20487
+
20488
+
20489
+ } // namespace duckdb_fast_float
20490
+
20491
+ #endif
20492
+
20493
+
20494
+ #ifndef FASTFLOAT_ASCII_NUMBER_H
20495
+ #define FASTFLOAT_ASCII_NUMBER_H
20496
+
20497
+ #include <cstdio>
20498
+ #include <cctype>
20499
+ #include <cstdint>
20500
+ #include <cstring>
20501
+
20502
+
20503
+ namespace duckdb_fast_float {
20504
+
20505
+ // Next function can be micro-optimized, but compilers are entirely
20506
+ // able to optimize it well.
20507
+ fastfloat_really_inline bool is_integer(char c) noexcept { return c >= '0' && c <= '9'; }
20508
+
20509
+ fastfloat_really_inline uint64_t byteswap(uint64_t val) {
20510
+ return (val & 0xFF00000000000000) >> 56
20511
+ | (val & 0x00FF000000000000) >> 40
20512
+ | (val & 0x0000FF0000000000) >> 24
20513
+ | (val & 0x000000FF00000000) >> 8
20514
+ | (val & 0x00000000FF000000) << 8
20515
+ | (val & 0x0000000000FF0000) << 24
20516
+ | (val & 0x000000000000FF00) << 40
20517
+ | (val & 0x00000000000000FF) << 56;
20518
+ }
20519
+
20520
+ fastfloat_really_inline uint64_t read_u64(const char *chars) {
20521
+ uint64_t val;
20522
+ ::memcpy(&val, chars, sizeof(uint64_t));
20523
+ #if FASTFLOAT_IS_BIG_ENDIAN == 1
20524
+ // Need to read as-if the number was in little-endian order.
20525
+ val = byteswap(val);
20526
+ #endif
20527
+ return val;
20528
+ }
20529
+
20530
+ fastfloat_really_inline void write_u64(uint8_t *chars, uint64_t val) {
20531
+ #if FASTFLOAT_IS_BIG_ENDIAN == 1
20532
+ // Need to read as-if the number was in little-endian order.
20533
+ val = byteswap(val);
20534
+ #endif
20535
+ ::memcpy(chars, &val, sizeof(uint64_t));
20536
+ }
20537
+
20538
+ // credit @aqrit
20539
+ fastfloat_really_inline uint32_t parse_eight_digits_unrolled(uint64_t val) {
20540
+ const uint64_t mask = 0x000000FF000000FF;
20541
+ const uint64_t mul1 = 0x000F424000000064; // 100 + (1000000ULL << 32)
20542
+ const uint64_t mul2 = 0x0000271000000001; // 1 + (10000ULL << 32)
20543
+ val -= 0x3030303030303030;
20544
+ val = (val * 10) + (val >> 8); // val = (val * 2561) >> 8;
20545
+ val = (((val & mask) * mul1) + (((val >> 16) & mask) * mul2)) >> 32;
20546
+ return uint32_t(val);
20547
+ }
20548
+
20549
+ fastfloat_really_inline uint32_t parse_eight_digits_unrolled(const char *chars) noexcept {
20550
+ return parse_eight_digits_unrolled(read_u64(chars));
20551
+ }
20552
+
20553
+ // credit @aqrit
20554
+ fastfloat_really_inline bool is_made_of_eight_digits_fast(uint64_t val) noexcept {
20555
+ return !((((val + 0x4646464646464646) | (val - 0x3030303030303030)) &
20556
+ 0x8080808080808080));
20557
+ }
20558
+
20559
+ fastfloat_really_inline bool is_made_of_eight_digits_fast(const char *chars) noexcept {
20560
+ return is_made_of_eight_digits_fast(read_u64(chars));
20561
+ }
20562
+
20563
+ struct parsed_number_string {
20564
+ int64_t exponent;
20565
+ uint64_t mantissa;
20566
+ const char *lastmatch;
20567
+ bool negative;
20568
+ bool valid;
20569
+ bool too_many_digits;
20570
+ };
20571
+
20572
+
20573
+ // Assuming that you use no more than 19 digits, this will
20574
+ // parse an ASCII string.
20575
+ fastfloat_really_inline
20576
+ parsed_number_string parse_number_string(const char *p, const char *pend, chars_format fmt) noexcept {
20577
+ parsed_number_string answer;
20578
+ answer.valid = false;
20579
+ answer.too_many_digits = false;
20580
+ answer.negative = (*p == '-');
20581
+ if (*p == '-') { // C++17 20.19.3.(7.1) explicitly forbids '+' sign here
20582
+ ++p;
20583
+ if (p == pend) {
20584
+ return answer;
20585
+ }
20586
+ if (!is_integer(*p) && (*p != '.')) { // a sign must be followed by an integer or the dot
20587
+ return answer;
20588
+ }
20589
+ }
20590
+ const char *const start_digits = p;
20591
+
20592
+ uint64_t i = 0; // an unsigned int avoids signed overflows (which are bad)
20593
+
20594
+ while ((p != pend) && is_integer(*p)) {
20595
+ // a multiplication by 10 is cheaper than an arbitrary integer
20596
+ // multiplication
20597
+ i = 10 * i +
20598
+ uint64_t(*p - '0'); // might overflow, we will handle the overflow later
20599
+ ++p;
20600
+ }
20601
+ const char *const end_of_integer_part = p;
20602
+ int64_t digit_count = int64_t(end_of_integer_part - start_digits);
20603
+ int64_t exponent = 0;
20604
+ if ((p != pend) && (*p == '.')) {
20605
+ ++p;
20606
+ // Fast approach only tested under little endian systems
20607
+ if ((p + 8 <= pend) && is_made_of_eight_digits_fast(p)) {
20608
+ i = i * 100000000 + parse_eight_digits_unrolled(p); // in rare cases, this will overflow, but that's ok
20609
+ p += 8;
20610
+ if ((p + 8 <= pend) && is_made_of_eight_digits_fast(p)) {
20611
+ i = i * 100000000 + parse_eight_digits_unrolled(p); // in rare cases, this will overflow, but that's ok
20612
+ p += 8;
20613
+ }
20614
+ }
20615
+ while ((p != pend) && is_integer(*p)) {
20616
+ uint8_t digit = uint8_t(*p - '0');
20617
+ ++p;
20618
+ i = i * 10 + digit; // in rare cases, this will overflow, but that's ok
20619
+ }
20620
+ exponent = end_of_integer_part + 1 - p;
20621
+ digit_count -= exponent;
20622
+ }
20623
+ // we must have encountered at least one integer!
20624
+ if (digit_count == 0) {
20625
+ return answer;
20626
+ }
20627
+ int64_t exp_number = 0; // explicit exponential part
20628
+ if ((fmt & chars_format::scientific) && (p != pend) && (('e' == *p) || ('E' == *p))) {
20629
+ const char * location_of_e = p;
20630
+ ++p;
20631
+ bool neg_exp = false;
20632
+ if ((p != pend) && ('-' == *p)) {
20633
+ neg_exp = true;
20634
+ ++p;
20635
+ } else if ((p != pend) && ('+' == *p)) { // '+' on exponent is allowed by C++17 20.19.3.(7.1)
20636
+ ++p;
20637
+ }
20638
+ if ((p == pend) || !is_integer(*p)) {
20639
+ if(!(fmt & chars_format::fixed)) {
20640
+ // We are in error.
20641
+ return answer;
20642
+ }
20643
+ // Otherwise, we will be ignoring the 'e'.
20644
+ p = location_of_e;
20645
+ } else {
20646
+ while ((p != pend) && is_integer(*p)) {
20647
+ uint8_t digit = uint8_t(*p - '0');
20648
+ if (exp_number < 0x10000) {
20649
+ exp_number = 10 * exp_number + digit;
20650
+ }
20651
+ ++p;
20652
+ }
20653
+ if(neg_exp) { exp_number = - exp_number; }
20654
+ exponent += exp_number;
20655
+ }
20656
+ } else {
20657
+ // If it scientific and not fixed, we have to bail out.
20658
+ if((fmt & chars_format::scientific) && !(fmt & chars_format::fixed)) { return answer; }
20659
+ }
20660
+ answer.lastmatch = p;
20661
+ answer.valid = true;
20662
+
20663
+ // If we frequently had to deal with long strings of digits,
20664
+ // we could extend our code by using a 128-bit integer instead
20665
+ // of a 64-bit integer. However, this is uncommon.
20666
+ //
20667
+ // We can deal with up to 19 digits.
20668
+ if (digit_count > 19) { // this is uncommon
20669
+ // It is possible that the integer had an overflow.
20670
+ // We have to handle the case where we have 0.0000somenumber.
20671
+ // We need to be mindful of the case where we only have zeroes...
20672
+ // E.g., 0.000000000...000.
20673
+ const char *start = start_digits;
20674
+ while ((start != pend) && (*start == '0' || *start == '.')) {
20675
+ if(*start == '0') { digit_count --; }
20676
+ start++;
20677
+ }
20678
+ if (digit_count > 19) {
20679
+ answer.too_many_digits = true;
20680
+ // Let us start again, this time, avoiding overflows.
20681
+ i = 0;
20682
+ p = start_digits;
20683
+ const uint64_t minimal_nineteen_digit_integer{1000000000000000000};
20684
+ while((i < minimal_nineteen_digit_integer) && (p != pend) && is_integer(*p)) {
20685
+ i = i * 10 + uint64_t(*p - '0');
20686
+ ++p;
20687
+ }
20688
+ if (i >= minimal_nineteen_digit_integer) { // We have a big integers
20689
+ exponent = end_of_integer_part - p + exp_number;
20690
+ } else { // We have a value with a fractional component.
20691
+ p++; // skip the '.'
20692
+ const char *first_after_period = p;
20693
+ while((i < minimal_nineteen_digit_integer) && (p != pend) && is_integer(*p)) {
20694
+ i = i * 10 + uint64_t(*p - '0');
20695
+ ++p;
20696
+ }
20697
+ exponent = first_after_period - p + exp_number;
20698
+ }
20699
+ // We have now corrected both exponent and i, to a truncated value
20700
+ }
20701
+ }
20702
+ answer.exponent = exponent;
20703
+ answer.mantissa = i;
20704
+ return answer;
20705
+ }
20706
+
20707
+
20708
+ // This should always succeed since it follows a call to parse_number_string
20709
+ // This function could be optimized. In particular, we could stop after 19 digits
20710
+ // and try to bail out. Furthermore, we should be able to recover the computed
20711
+ // exponent from the pass in parse_number_string.
20712
+ fastfloat_really_inline decimal parse_decimal(const char *p, const char *pend) noexcept {
20713
+ decimal answer;
20714
+ answer.num_digits = 0;
20715
+ answer.decimal_point = 0;
20716
+ answer.truncated = false;
20717
+ answer.negative = (*p == '-');
20718
+ if (*p == '-') { // C++17 20.19.3.(7.1) explicitly forbids '+' sign here
20719
+ ++p;
20720
+ }
20721
+ // skip leading zeroes
20722
+ while ((p != pend) && (*p == '0')) {
20723
+ ++p;
20724
+ }
20725
+ while ((p != pend) && is_integer(*p)) {
20726
+ if (answer.num_digits < max_digits) {
20727
+ answer.digits[answer.num_digits] = uint8_t(*p - '0');
20728
+ }
20729
+ answer.num_digits++;
20730
+ ++p;
20731
+ }
20732
+ if ((p != pend) && (*p == '.')) {
20733
+ ++p;
20734
+ const char *first_after_period = p;
20735
+ // if we have not yet encountered a zero, we have to skip it as well
20736
+ if(answer.num_digits == 0) {
20737
+ // skip zeros
20738
+ while ((p != pend) && (*p == '0')) {
20739
+ ++p;
20740
+ }
20741
+ }
20742
+ // We expect that this loop will often take the bulk of the running time
20743
+ // because when a value has lots of digits, these digits often
20744
+ while ((p + 8 <= pend) && (answer.num_digits + 8 < max_digits)) {
20745
+ uint64_t val = read_u64(p);
20746
+ if(! is_made_of_eight_digits_fast(val)) { break; }
20747
+ // We have eight digits, process them in one go!
20748
+ val -= 0x3030303030303030;
20749
+ write_u64(answer.digits + answer.num_digits, val);
20750
+ answer.num_digits += 8;
20751
+ p += 8;
20752
+ }
20753
+ while ((p != pend) && is_integer(*p)) {
20754
+ if (answer.num_digits < max_digits) {
20755
+ answer.digits[answer.num_digits] = uint8_t(*p - '0');
20756
+ }
20757
+ answer.num_digits++;
20758
+ ++p;
20759
+ }
20760
+ answer.decimal_point = int32_t(first_after_period - p);
20761
+ }
20762
+ // We want num_digits to be the number of significant digits, excluding
20763
+ // leading *and* trailing zeros! Otherwise the truncated flag later is
20764
+ // going to be misleading.
20765
+ if(answer.num_digits > 0) {
20766
+ // We potentially need the answer.num_digits > 0 guard because we
20767
+ // prune leading zeros. So with answer.num_digits > 0, we know that
20768
+ // we have at least one non-zero digit.
20769
+ const char *preverse = p - 1;
20770
+ int32_t trailing_zeros = 0;
20771
+ while ((*preverse == '0') || (*preverse == '.')) {
20772
+ if(*preverse == '0') { trailing_zeros++; };
20773
+ --preverse;
20774
+ }
20775
+ answer.decimal_point += int32_t(answer.num_digits);
20776
+ answer.num_digits -= uint32_t(trailing_zeros);
20777
+ }
20778
+ if(answer.num_digits > max_digits) {
20779
+ answer.truncated = true;
20780
+ answer.num_digits = max_digits;
20781
+ }
20782
+ if ((p != pend) && (('e' == *p) || ('E' == *p))) {
20783
+ ++p;
20784
+ bool neg_exp = false;
20785
+ if ((p != pend) && ('-' == *p)) {
20786
+ neg_exp = true;
20787
+ ++p;
20788
+ } else if ((p != pend) && ('+' == *p)) { // '+' on exponent is allowed by C++17 20.19.3.(7.1)
20789
+ ++p;
20790
+ }
20791
+ int32_t exp_number = 0; // exponential part
20792
+ while ((p != pend) && is_integer(*p)) {
20793
+ uint8_t digit = uint8_t(*p - '0');
20794
+ if (exp_number < 0x10000) {
20795
+ exp_number = 10 * exp_number + digit;
20796
+ }
20797
+ ++p;
20798
+ }
20799
+ answer.decimal_point += (neg_exp ? -exp_number : exp_number);
20800
+ }
20801
+ // In very rare cases, we may have fewer than 19 digits, we want to be able to reliably
20802
+ // assume that all digits up to max_digit_without_overflow have been initialized.
20803
+ for(uint32_t i = answer.num_digits; i < max_digit_without_overflow; i++) { answer.digits[i] = 0; }
20804
+
20805
+ return answer;
20806
+ }
20807
+ } // namespace duckdb_fast_float
20808
+
20809
+ #endif
20810
+
20811
+
20812
+ #ifndef FASTFLOAT_GENERIC_DECIMAL_TO_BINARY_H
20813
+ #define FASTFLOAT_GENERIC_DECIMAL_TO_BINARY_H
20814
+
20815
+ /**
20816
+ * This code is meant to handle the case where we have more than 19 digits.
20817
+ *
20818
+ * It is based on work by Nigel Tao (at https://github.com/google/wuffs/)
20819
+ * who credits Ken Thompson for the design (via a reference to the Go source
20820
+ * code).
20821
+ *
20822
+ * Rob Pike suggested that this algorithm be called "Simple Decimal Conversion".
20823
+ *
20824
+ * It is probably not very fast but it is a fallback that should almost never
20825
+ * be used in real life. Though it is not fast, it is "easily" understood and debugged.
20826
+ **/
20827
+ #include <cstdint>
20828
+
20829
+ namespace duckdb_fast_float {
20830
+
20831
+ namespace detail {
20832
+
20833
+ // remove all final zeroes
20834
+ inline void trim(decimal &h) {
20835
+ while ((h.num_digits > 0) && (h.digits[h.num_digits - 1] == 0)) {
20836
+ h.num_digits--;
20837
+ }
20838
+ }
20839
+
20840
+
20841
+
20842
+ inline uint32_t number_of_digits_decimal_left_shift(const decimal &h, uint32_t shift) {
20843
+ shift &= 63;
20844
+ const static uint16_t number_of_digits_decimal_left_shift_table[65] = {
20845
+ 0x0000, 0x0800, 0x0801, 0x0803, 0x1006, 0x1009, 0x100D, 0x1812, 0x1817,
20846
+ 0x181D, 0x2024, 0x202B, 0x2033, 0x203C, 0x2846, 0x2850, 0x285B, 0x3067,
20847
+ 0x3073, 0x3080, 0x388E, 0x389C, 0x38AB, 0x38BB, 0x40CC, 0x40DD, 0x40EF,
20848
+ 0x4902, 0x4915, 0x4929, 0x513E, 0x5153, 0x5169, 0x5180, 0x5998, 0x59B0,
20849
+ 0x59C9, 0x61E3, 0x61FD, 0x6218, 0x6A34, 0x6A50, 0x6A6D, 0x6A8B, 0x72AA,
20850
+ 0x72C9, 0x72E9, 0x7B0A, 0x7B2B, 0x7B4D, 0x8370, 0x8393, 0x83B7, 0x83DC,
20851
+ 0x8C02, 0x8C28, 0x8C4F, 0x9477, 0x949F, 0x94C8, 0x9CF2, 0x051C, 0x051C,
20852
+ 0x051C, 0x051C,
20853
+ };
20854
+ uint32_t x_a = number_of_digits_decimal_left_shift_table[shift];
20855
+ uint32_t x_b = number_of_digits_decimal_left_shift_table[shift + 1];
20856
+ uint32_t num_new_digits = x_a >> 11;
20857
+ uint32_t pow5_a = 0x7FF & x_a;
20858
+ uint32_t pow5_b = 0x7FF & x_b;
20859
+ const static uint8_t
20860
+ number_of_digits_decimal_left_shift_table_powers_of_5[0x051C] = {
20861
+ 5, 2, 5, 1, 2, 5, 6, 2, 5, 3, 1, 2, 5, 1, 5, 6, 2, 5, 7, 8, 1, 2, 5, 3,
20862
+ 9, 0, 6, 2, 5, 1, 9, 5, 3, 1, 2, 5, 9, 7, 6, 5, 6, 2, 5, 4, 8, 8, 2, 8,
20863
+ 1, 2, 5, 2, 4, 4, 1, 4, 0, 6, 2, 5, 1, 2, 2, 0, 7, 0, 3, 1, 2, 5, 6, 1,
20864
+ 0, 3, 5, 1, 5, 6, 2, 5, 3, 0, 5, 1, 7, 5, 7, 8, 1, 2, 5, 1, 5, 2, 5, 8,
20865
+ 7, 8, 9, 0, 6, 2, 5, 7, 6, 2, 9, 3, 9, 4, 5, 3, 1, 2, 5, 3, 8, 1, 4, 6,
20866
+ 9, 7, 2, 6, 5, 6, 2, 5, 1, 9, 0, 7, 3, 4, 8, 6, 3, 2, 8, 1, 2, 5, 9, 5,
20867
+ 3, 6, 7, 4, 3, 1, 6, 4, 0, 6, 2, 5, 4, 7, 6, 8, 3, 7, 1, 5, 8, 2, 0, 3,
20868
+ 1, 2, 5, 2, 3, 8, 4, 1, 8, 5, 7, 9, 1, 0, 1, 5, 6, 2, 5, 1, 1, 9, 2, 0,
20869
+ 9, 2, 8, 9, 5, 5, 0, 7, 8, 1, 2, 5, 5, 9, 6, 0, 4, 6, 4, 4, 7, 7, 5, 3,
20870
+ 9, 0, 6, 2, 5, 2, 9, 8, 0, 2, 3, 2, 2, 3, 8, 7, 6, 9, 5, 3, 1, 2, 5, 1,
20871
+ 4, 9, 0, 1, 1, 6, 1, 1, 9, 3, 8, 4, 7, 6, 5, 6, 2, 5, 7, 4, 5, 0, 5, 8,
20872
+ 0, 5, 9, 6, 9, 2, 3, 8, 2, 8, 1, 2, 5, 3, 7, 2, 5, 2, 9, 0, 2, 9, 8, 4,
20873
+ 6, 1, 9, 1, 4, 0, 6, 2, 5, 1, 8, 6, 2, 6, 4, 5, 1, 4, 9, 2, 3, 0, 9, 5,
20874
+ 7, 0, 3, 1, 2, 5, 9, 3, 1, 3, 2, 2, 5, 7, 4, 6, 1, 5, 4, 7, 8, 5, 1, 5,
20875
+ 6, 2, 5, 4, 6, 5, 6, 6, 1, 2, 8, 7, 3, 0, 7, 7, 3, 9, 2, 5, 7, 8, 1, 2,
20876
+ 5, 2, 3, 2, 8, 3, 0, 6, 4, 3, 6, 5, 3, 8, 6, 9, 6, 2, 8, 9, 0, 6, 2, 5,
20877
+ 1, 1, 6, 4, 1, 5, 3, 2, 1, 8, 2, 6, 9, 3, 4, 8, 1, 4, 4, 5, 3, 1, 2, 5,
20878
+ 5, 8, 2, 0, 7, 6, 6, 0, 9, 1, 3, 4, 6, 7, 4, 0, 7, 2, 2, 6, 5, 6, 2, 5,
20879
+ 2, 9, 1, 0, 3, 8, 3, 0, 4, 5, 6, 7, 3, 3, 7, 0, 3, 6, 1, 3, 2, 8, 1, 2,
20880
+ 5, 1, 4, 5, 5, 1, 9, 1, 5, 2, 2, 8, 3, 6, 6, 8, 5, 1, 8, 0, 6, 6, 4, 0,
20881
+ 6, 2, 5, 7, 2, 7, 5, 9, 5, 7, 6, 1, 4, 1, 8, 3, 4, 2, 5, 9, 0, 3, 3, 2,
20882
+ 0, 3, 1, 2, 5, 3, 6, 3, 7, 9, 7, 8, 8, 0, 7, 0, 9, 1, 7, 1, 2, 9, 5, 1,
20883
+ 6, 6, 0, 1, 5, 6, 2, 5, 1, 8, 1, 8, 9, 8, 9, 4, 0, 3, 5, 4, 5, 8, 5, 6,
20884
+ 4, 7, 5, 8, 3, 0, 0, 7, 8, 1, 2, 5, 9, 0, 9, 4, 9, 4, 7, 0, 1, 7, 7, 2,
20885
+ 9, 2, 8, 2, 3, 7, 9, 1, 5, 0, 3, 9, 0, 6, 2, 5, 4, 5, 4, 7, 4, 7, 3, 5,
20886
+ 0, 8, 8, 6, 4, 6, 4, 1, 1, 8, 9, 5, 7, 5, 1, 9, 5, 3, 1, 2, 5, 2, 2, 7,
20887
+ 3, 7, 3, 6, 7, 5, 4, 4, 3, 2, 3, 2, 0, 5, 9, 4, 7, 8, 7, 5, 9, 7, 6, 5,
20888
+ 6, 2, 5, 1, 1, 3, 6, 8, 6, 8, 3, 7, 7, 2, 1, 6, 1, 6, 0, 2, 9, 7, 3, 9,
20889
+ 3, 7, 9, 8, 8, 2, 8, 1, 2, 5, 5, 6, 8, 4, 3, 4, 1, 8, 8, 6, 0, 8, 0, 8,
20890
+ 0, 1, 4, 8, 6, 9, 6, 8, 9, 9, 4, 1, 4, 0, 6, 2, 5, 2, 8, 4, 2, 1, 7, 0,
20891
+ 9, 4, 3, 0, 4, 0, 4, 0, 0, 7, 4, 3, 4, 8, 4, 4, 9, 7, 0, 7, 0, 3, 1, 2,
20892
+ 5, 1, 4, 2, 1, 0, 8, 5, 4, 7, 1, 5, 2, 0, 2, 0, 0, 3, 7, 1, 7, 4, 2, 2,
20893
+ 4, 8, 5, 3, 5, 1, 5, 6, 2, 5, 7, 1, 0, 5, 4, 2, 7, 3, 5, 7, 6, 0, 1, 0,
20894
+ 0, 1, 8, 5, 8, 7, 1, 1, 2, 4, 2, 6, 7, 5, 7, 8, 1, 2, 5, 3, 5, 5, 2, 7,
20895
+ 1, 3, 6, 7, 8, 8, 0, 0, 5, 0, 0, 9, 2, 9, 3, 5, 5, 6, 2, 1, 3, 3, 7, 8,
20896
+ 9, 0, 6, 2, 5, 1, 7, 7, 6, 3, 5, 6, 8, 3, 9, 4, 0, 0, 2, 5, 0, 4, 6, 4,
20897
+ 6, 7, 7, 8, 1, 0, 6, 6, 8, 9, 4, 5, 3, 1, 2, 5, 8, 8, 8, 1, 7, 8, 4, 1,
20898
+ 9, 7, 0, 0, 1, 2, 5, 2, 3, 2, 3, 3, 8, 9, 0, 5, 3, 3, 4, 4, 7, 2, 6, 5,
20899
+ 6, 2, 5, 4, 4, 4, 0, 8, 9, 2, 0, 9, 8, 5, 0, 0, 6, 2, 6, 1, 6, 1, 6, 9,
20900
+ 4, 5, 2, 6, 6, 7, 2, 3, 6, 3, 2, 8, 1, 2, 5, 2, 2, 2, 0, 4, 4, 6, 0, 4,
20901
+ 9, 2, 5, 0, 3, 1, 3, 0, 8, 0, 8, 4, 7, 2, 6, 3, 3, 3, 6, 1, 8, 1, 6, 4,
20902
+ 0, 6, 2, 5, 1, 1, 1, 0, 2, 2, 3, 0, 2, 4, 6, 2, 5, 1, 5, 6, 5, 4, 0, 4,
20903
+ 2, 3, 6, 3, 1, 6, 6, 8, 0, 9, 0, 8, 2, 0, 3, 1, 2, 5, 5, 5, 5, 1, 1, 1,
20904
+ 5, 1, 2, 3, 1, 2, 5, 7, 8, 2, 7, 0, 2, 1, 1, 8, 1, 5, 8, 3, 4, 0, 4, 5,
20905
+ 4, 1, 0, 1, 5, 6, 2, 5, 2, 7, 7, 5, 5, 5, 7, 5, 6, 1, 5, 6, 2, 8, 9, 1,
20906
+ 3, 5, 1, 0, 5, 9, 0, 7, 9, 1, 7, 0, 2, 2, 7, 0, 5, 0, 7, 8, 1, 2, 5, 1,
20907
+ 3, 8, 7, 7, 7, 8, 7, 8, 0, 7, 8, 1, 4, 4, 5, 6, 7, 5, 5, 2, 9, 5, 3, 9,
20908
+ 5, 8, 5, 1, 1, 3, 5, 2, 5, 3, 9, 0, 6, 2, 5, 6, 9, 3, 8, 8, 9, 3, 9, 0,
20909
+ 3, 9, 0, 7, 2, 2, 8, 3, 7, 7, 6, 4, 7, 6, 9, 7, 9, 2, 5, 5, 6, 7, 6, 2,
20910
+ 6, 9, 5, 3, 1, 2, 5, 3, 4, 6, 9, 4, 4, 6, 9, 5, 1, 9, 5, 3, 6, 1, 4, 1,
20911
+ 8, 8, 8, 2, 3, 8, 4, 8, 9, 6, 2, 7, 8, 3, 8, 1, 3, 4, 7, 6, 5, 6, 2, 5,
20912
+ 1, 7, 3, 4, 7, 2, 3, 4, 7, 5, 9, 7, 6, 8, 0, 7, 0, 9, 4, 4, 1, 1, 9, 2,
20913
+ 4, 4, 8, 1, 3, 9, 1, 9, 0, 6, 7, 3, 8, 2, 8, 1, 2, 5, 8, 6, 7, 3, 6, 1,
20914
+ 7, 3, 7, 9, 8, 8, 4, 0, 3, 5, 4, 7, 2, 0, 5, 9, 6, 2, 2, 4, 0, 6, 9, 5,
20915
+ 9, 5, 3, 3, 6, 9, 1, 4, 0, 6, 2, 5,
20916
+ };
20917
+ const uint8_t *pow5 =
20918
+ &number_of_digits_decimal_left_shift_table_powers_of_5[pow5_a];
20919
+ uint32_t i = 0;
20920
+ uint32_t n = pow5_b - pow5_a;
20921
+ for (; i < n; i++) {
20922
+ if (i >= h.num_digits) {
20923
+ return num_new_digits - 1;
20924
+ } else if (h.digits[i] == pow5[i]) {
20925
+ continue;
20926
+ } else if (h.digits[i] < pow5[i]) {
20927
+ return num_new_digits - 1;
20928
+ } else {
20929
+ return num_new_digits;
20930
+ }
20931
+ }
20932
+ return num_new_digits;
20933
+ }
20934
+
20935
+ inline uint64_t round(decimal &h) {
20936
+ if ((h.num_digits == 0) || (h.decimal_point < 0)) {
20937
+ return 0;
20938
+ } else if (h.decimal_point > 18) {
20939
+ return UINT64_MAX;
20940
+ }
20941
+ // at this point, we know that h.decimal_point >= 0
20942
+ uint32_t dp = uint32_t(h.decimal_point);
20943
+ uint64_t n = 0;
20944
+ for (uint32_t i = 0; i < dp; i++) {
20945
+ n = (10 * n) + ((i < h.num_digits) ? h.digits[i] : 0);
20946
+ }
20947
+ bool round_up = false;
20948
+ if (dp < h.num_digits) {
20949
+ round_up = h.digits[dp] >= 5; // normally, we round up
20950
+ // but we may need to round to even!
20951
+ if ((h.digits[dp] == 5) && (dp + 1 == h.num_digits)) {
20952
+ round_up = h.truncated || ((dp > 0) && (1 & h.digits[dp - 1]));
20953
+ }
20954
+ }
20955
+ if (round_up) {
20956
+ n++;
20957
+ }
20958
+ return n;
20959
+ }
20960
+
20961
+ // computes h * 2^-shift
20962
+ inline void decimal_left_shift(decimal &h, uint32_t shift) {
20963
+ if (h.num_digits == 0) {
20964
+ return;
20965
+ }
20966
+ uint32_t num_new_digits = number_of_digits_decimal_left_shift(h, shift);
20967
+ int32_t read_index = int32_t(h.num_digits - 1);
20968
+ uint32_t write_index = h.num_digits - 1 + num_new_digits;
20969
+ uint64_t n = 0;
20970
+
20971
+ while (read_index >= 0) {
20972
+ n += uint64_t(h.digits[read_index]) << shift;
20973
+ uint64_t quotient = n / 10;
20974
+ uint64_t remainder = n - (10 * quotient);
20975
+ if (write_index < max_digits) {
20976
+ h.digits[write_index] = uint8_t(remainder);
20977
+ } else if (remainder > 0) {
20978
+ h.truncated = true;
20979
+ }
20980
+ n = quotient;
20981
+ write_index--;
20982
+ read_index--;
20983
+ }
20984
+ while (n > 0) {
20985
+ uint64_t quotient = n / 10;
20986
+ uint64_t remainder = n - (10 * quotient);
20987
+ if (write_index < max_digits) {
20988
+ h.digits[write_index] = uint8_t(remainder);
20989
+ } else if (remainder > 0) {
20990
+ h.truncated = true;
20991
+ }
20992
+ n = quotient;
20993
+ write_index--;
20994
+ }
20995
+ h.num_digits += num_new_digits;
20996
+ if (h.num_digits > max_digits) {
20997
+ h.num_digits = max_digits;
20998
+ }
20999
+ h.decimal_point += int32_t(num_new_digits);
21000
+ trim(h);
21001
+ }
21002
+
21003
+ // computes h * 2^shift
21004
+ inline void decimal_right_shift(decimal &h, uint32_t shift) {
21005
+ uint32_t read_index = 0;
21006
+ uint32_t write_index = 0;
21007
+
21008
+ uint64_t n = 0;
21009
+
21010
+ while ((n >> shift) == 0) {
21011
+ if (read_index < h.num_digits) {
21012
+ n = (10 * n) + h.digits[read_index++];
21013
+ } else if (n == 0) {
21014
+ return;
21015
+ } else {
21016
+ while ((n >> shift) == 0) {
21017
+ n = 10 * n;
21018
+ read_index++;
21019
+ }
21020
+ break;
21021
+ }
21022
+ }
21023
+ h.decimal_point -= int32_t(read_index - 1);
21024
+ if (h.decimal_point < -decimal_point_range) { // it is zero
21025
+ h.num_digits = 0;
21026
+ h.decimal_point = 0;
21027
+ h.negative = false;
21028
+ h.truncated = false;
21029
+ return;
21030
+ }
21031
+ uint64_t mask = (uint64_t(1) << shift) - 1;
21032
+ while (read_index < h.num_digits) {
21033
+ uint8_t new_digit = uint8_t(n >> shift);
21034
+ n = (10 * (n & mask)) + h.digits[read_index++];
21035
+ h.digits[write_index++] = new_digit;
21036
+ }
21037
+ while (n > 0) {
21038
+ uint8_t new_digit = uint8_t(n >> shift);
21039
+ n = 10 * (n & mask);
21040
+ if (write_index < max_digits) {
21041
+ h.digits[write_index++] = new_digit;
21042
+ } else if (new_digit > 0) {
21043
+ h.truncated = true;
21044
+ }
21045
+ }
21046
+ h.num_digits = write_index;
21047
+ trim(h);
21048
+ }
21049
+
21050
+ } // namespace detail
21051
+
21052
+ template <typename binary>
21053
+ adjusted_mantissa compute_float(decimal &d) {
21054
+ adjusted_mantissa answer;
21055
+ if (d.num_digits == 0) {
21056
+ // should be zero
21057
+ answer.power2 = 0;
21058
+ answer.mantissa = 0;
21059
+ return answer;
21060
+ }
21061
+ // At this point, going further, we can assume that d.num_digits > 0.
21062
+ //
21063
+ // We want to guard against excessive decimal point values because
21064
+ // they can result in long running times. Indeed, we do
21065
+ // shifts by at most 60 bits. We have that log(10**400)/log(2**60) ~= 22
21066
+ // which is fine, but log(10**299995)/log(2**60) ~= 16609 which is not
21067
+ // fine (runs for a long time).
21068
+ //
21069
+ if(d.decimal_point < -324) {
21070
+ // We have something smaller than 1e-324 which is always zero
21071
+ // in binary64 and binary32.
21072
+ // It should be zero.
21073
+ answer.power2 = 0;
21074
+ answer.mantissa = 0;
21075
+ return answer;
21076
+ } else if(d.decimal_point >= 310) {
21077
+ // We have something at least as large as 0.1e310 which is
21078
+ // always infinite.
21079
+ answer.power2 = binary::infinite_power();
21080
+ answer.mantissa = 0;
21081
+ return answer;
21082
+ }
21083
+ static const uint32_t max_shift = 60;
21084
+ static const uint32_t num_powers = 19;
21085
+ static const uint8_t decimal_powers[19] = {
21086
+ 0, 3, 6, 9, 13, 16, 19, 23, 26, 29, //
21087
+ 33, 36, 39, 43, 46, 49, 53, 56, 59, //
21088
+ };
21089
+ int32_t exp2 = 0;
21090
+ while (d.decimal_point > 0) {
21091
+ uint32_t n = uint32_t(d.decimal_point);
21092
+ uint32_t shift = (n < num_powers) ? decimal_powers[n] : max_shift;
21093
+ detail::decimal_right_shift(d, shift);
21094
+ if (d.decimal_point < -decimal_point_range) {
21095
+ // should be zero
21096
+ answer.power2 = 0;
21097
+ answer.mantissa = 0;
21098
+ return answer;
21099
+ }
21100
+ exp2 += int32_t(shift);
21101
+ }
21102
+ // We shift left toward [1/2 ... 1].
21103
+ while (d.decimal_point <= 0) {
21104
+ uint32_t shift;
21105
+ if (d.decimal_point == 0) {
21106
+ if (d.digits[0] >= 5) {
21107
+ break;
21108
+ }
21109
+ shift = (d.digits[0] < 2) ? 2 : 1;
21110
+ } else {
21111
+ uint32_t n = uint32_t(-d.decimal_point);
21112
+ shift = (n < num_powers) ? decimal_powers[n] : max_shift;
21113
+ }
21114
+ detail::decimal_left_shift(d, shift);
21115
+ if (d.decimal_point > decimal_point_range) {
21116
+ // we want to get infinity:
21117
+ answer.power2 = binary::infinite_power();
21118
+ answer.mantissa = 0;
21119
+ return answer;
21120
+ }
21121
+ exp2 -= int32_t(shift);
21122
+ }
21123
+ // We are now in the range [1/2 ... 1] but the binary format uses [1 ... 2].
21124
+ exp2--;
21125
+ constexpr int32_t minimum_exponent = binary::minimum_exponent();
21126
+ while ((minimum_exponent + 1) > exp2) {
21127
+ uint32_t n = uint32_t((minimum_exponent + 1) - exp2);
21128
+ if (n > max_shift) {
21129
+ n = max_shift;
21130
+ }
21131
+ detail::decimal_right_shift(d, n);
21132
+ exp2 += int32_t(n);
21133
+ }
21134
+ if ((exp2 - minimum_exponent) >= binary::infinite_power()) {
21135
+ answer.power2 = binary::infinite_power();
21136
+ answer.mantissa = 0;
21137
+ return answer;
21138
+ }
21139
+
21140
+ const int mantissa_size_in_bits = binary::mantissa_explicit_bits() + 1;
21141
+ detail::decimal_left_shift(d, mantissa_size_in_bits);
21142
+
21143
+ uint64_t mantissa = detail::round(d);
21144
+ // It is possible that we have an overflow, in which case we need
21145
+ // to shift back.
21146
+ if(mantissa >= (uint64_t(1) << mantissa_size_in_bits)) {
21147
+ detail::decimal_right_shift(d, 1);
21148
+ exp2 += 1;
21149
+ mantissa = detail::round(d);
21150
+ if ((exp2 - minimum_exponent) >= binary::infinite_power()) {
21151
+ answer.power2 = binary::infinite_power();
21152
+ answer.mantissa = 0;
21153
+ return answer;
21154
+ }
21155
+ }
21156
+ answer.power2 = exp2 - binary::minimum_exponent();
21157
+ if(mantissa < (uint64_t(1) << binary::mantissa_explicit_bits())) { answer.power2--; }
21158
+ answer.mantissa = mantissa & ((uint64_t(1) << binary::mantissa_explicit_bits()) - 1);
21159
+ return answer;
21160
+ }
21161
+
21162
+ template <typename binary>
21163
+ adjusted_mantissa parse_long_mantissa(const char *first, const char* last) {
21164
+ decimal d = parse_decimal(first, last);
21165
+ return compute_float<binary>(d);
21166
+ }
21167
+
21168
+ } // namespace duckdb_fast_float
21169
+ #endif
21170
+
21171
+
21172
+ #ifndef FASTFLOAT_PARSE_NUMBER_H
21173
+ #define FASTFLOAT_PARSE_NUMBER_H
21174
+
21175
+ #include <cassert>
21176
+ #include <cmath>
21177
+ #include <cstring>
21178
+ #include <limits>
21179
+ #include <system_error>
21180
+
21181
+ namespace duckdb_fast_float {
21182
+
21183
+
21184
+ namespace detail {
21185
+ /**
21186
+ * Special case +inf, -inf, nan, infinity, -infinity.
21187
+ * The case comparisons could be made much faster given that we know that the
21188
+ * strings a null-free and fixed.
21189
+ **/
21190
+ template <typename T>
21191
+ from_chars_result parse_infnan(const char *first, const char *last, T &value) noexcept {
21192
+ from_chars_result answer;
21193
+ answer.ptr = first;
21194
+ answer.ec = std::errc(); // be optimistic
21195
+ bool minusSign = false;
21196
+ if (*first == '-') { // assume first < last, so dereference without checks; C++17 20.19.3.(7.1) explicitly forbids '+' here
21197
+ minusSign = true;
21198
+ ++first;
21199
+ }
21200
+ if (last - first >= 3) {
21201
+ if (fastfloat_strncasecmp(first, "nan", 3)) {
21202
+ answer.ptr = (first += 3);
21203
+ value = minusSign ? -std::numeric_limits<T>::quiet_NaN() : std::numeric_limits<T>::quiet_NaN();
21204
+ // Check for possible nan(n-char-seq-opt), C++17 20.19.3.7, C11 7.20.1.3.3. At least MSVC produces nan(ind) and nan(snan).
21205
+ if(first != last && *first == '(') {
21206
+ for(const char* ptr = first + 1; ptr != last; ++ptr) {
21207
+ if (*ptr == ')') {
21208
+ answer.ptr = ptr + 1; // valid nan(n-char-seq-opt)
21209
+ break;
21210
+ }
21211
+ else if(!(('a' <= *ptr && *ptr <= 'z') || ('A' <= *ptr && *ptr <= 'Z') || ('0' <= *ptr && *ptr <= '9') || *ptr == '_'))
21212
+ break; // forbidden char, not nan(n-char-seq-opt)
21213
+ }
21214
+ }
21215
+ return answer;
21216
+ }
21217
+ if (fastfloat_strncasecmp(first, "inf", 3)) {
21218
+ if ((last - first >= 8) && fastfloat_strncasecmp(first + 3, "inity", 5)) {
21219
+ answer.ptr = first + 8;
21220
+ } else {
21221
+ answer.ptr = first + 3;
21222
+ }
21223
+ value = minusSign ? -std::numeric_limits<T>::infinity() : std::numeric_limits<T>::infinity();
21224
+ return answer;
21225
+ }
21226
+ }
21227
+ answer.ec = std::errc::invalid_argument;
21228
+ return answer;
21229
+ }
21230
+
21231
+ template<typename T>
21232
+ fastfloat_really_inline void to_float(bool negative, adjusted_mantissa am, T &value) {
21233
+ uint64_t word = am.mantissa;
21234
+ word |= uint64_t(am.power2) << binary_format<T>::mantissa_explicit_bits();
21235
+ word = negative
21236
+ ? word | (uint64_t(1) << binary_format<T>::sign_index()) : word;
21237
+ #if FASTFLOAT_IS_BIG_ENDIAN == 1
21238
+ if (std::is_same<T, float>::value) {
21239
+ ::memcpy(&value, (char *)&word + 4, sizeof(T)); // extract value at offset 4-7 if float on big-endian
21240
+ } else {
21241
+ ::memcpy(&value, &word, sizeof(T));
21242
+ }
21243
+ #else
21244
+ // For little-endian systems:
21245
+ ::memcpy(&value, &word, sizeof(T));
21246
+ #endif
21247
+ }
21248
+
21249
+ } // namespace detail
21250
+
21251
+
21252
+
21253
+ template<typename T>
21254
+ from_chars_result from_chars(const char *first, const char *last,
21255
+ T &value, chars_format fmt /*= chars_format::general*/) noexcept {
21256
+ static_assert (std::is_same<T, double>::value || std::is_same<T, float>::value, "only float and double are supported");
21257
+
21258
+
21259
+ from_chars_result answer;
21260
+ if (first == last) {
21261
+ answer.ec = std::errc::invalid_argument;
21262
+ answer.ptr = first;
21263
+ return answer;
21264
+ }
21265
+ parsed_number_string pns = parse_number_string(first, last, fmt);
21266
+ if (!pns.valid) {
21267
+ return detail::parse_infnan(first, last, value);
21268
+ }
21269
+ answer.ec = std::errc(); // be optimistic
21270
+ answer.ptr = pns.lastmatch;
21271
+ // Next is Clinger's fast path.
21272
+ if (binary_format<T>::min_exponent_fast_path() <= pns.exponent && pns.exponent <= binary_format<T>::max_exponent_fast_path() && pns.mantissa <=binary_format<T>::max_mantissa_fast_path() && !pns.too_many_digits) {
21273
+ value = T(pns.mantissa);
21274
+ if (pns.exponent < 0) { value = value / binary_format<T>::exact_power_of_ten(-pns.exponent); }
21275
+ else { value = value * binary_format<T>::exact_power_of_ten(pns.exponent); }
21276
+ if (pns.negative) { value = -value; }
21277
+ return answer;
21278
+ }
21279
+ adjusted_mantissa am = compute_float<binary_format<T>>(pns.exponent, pns.mantissa);
21280
+ if(pns.too_many_digits) {
21281
+ if(am != compute_float<binary_format<T>>(pns.exponent, pns.mantissa + 1)) {
21282
+ am.power2 = -1; // value is invalid.
21283
+ }
21284
+ }
21285
+ // If we called compute_float<binary_format<T>>(pns.exponent, pns.mantissa) and we have an invalid power (am.power2 < 0),
21286
+ // then we need to go the long way around again. This is very uncommon.
21287
+ if(am.power2 < 0) { am = parse_long_mantissa<binary_format<T>>(first,last); }
21288
+ detail::to_float(pns.negative, am, value);
21289
+ return answer;
21290
+ }
21291
+
21292
+ } // namespace duckdb_fast_float
21293
+
21294
+ #endif
21295
+
21296
+
21297
+
21298
+ // LICENSE_CHANGE_END
21299
+
21300
+
21301
+
18911
21302
  #include <cctype>
18912
21303
  #include <cmath>
18913
21304
  #include <cstdlib>
@@ -19901,82 +22292,6 @@ bool TryCast::Operation(string_t input, uint64_t &result, bool strict) {
19901
22292
  return TryIntegerCast<uint64_t, false>(input.GetDataUnsafe(), input.GetSize(), result, strict);
19902
22293
  }
19903
22294
 
19904
- template <class T, bool NEGATIVE>
19905
- static void ComputeDoubleResult(T &result, idx_t decimal, idx_t decimal_factor) {
19906
- if (decimal_factor > 1) {
19907
- if (NEGATIVE) {
19908
- result -= (T)decimal / (T)decimal_factor;
19909
- } else {
19910
- result += (T)decimal / (T)decimal_factor;
19911
- }
19912
- }
19913
- }
19914
-
19915
- template <class T, bool NEGATIVE>
19916
- static bool DoubleCastLoop(const char *buf, idx_t len, T &result, bool strict) {
19917
- idx_t start_pos = NEGATIVE || *buf == '+' ? 1 : 0;
19918
- idx_t pos = start_pos;
19919
- idx_t decimal = 0;
19920
- idx_t decimal_factor = 0;
19921
- while (pos < len) {
19922
- if (!StringUtil::CharacterIsDigit(buf[pos])) {
19923
- // not a digit!
19924
- if (buf[pos] == '.') {
19925
- // decimal point
19926
- if (decimal_factor != 0) {
19927
- // nested periods
19928
- return false;
19929
- }
19930
- decimal_factor = 1;
19931
- pos++;
19932
- continue;
19933
- } else if (StringUtil::CharacterIsSpace(buf[pos])) {
19934
- // skip any trailing spaces
19935
- while (++pos < len) {
19936
- if (!StringUtil::CharacterIsSpace(buf[pos])) {
19937
- return false;
19938
- }
19939
- }
19940
- ComputeDoubleResult<T, NEGATIVE>(result, decimal, decimal_factor);
19941
- return true;
19942
- } else if (buf[pos] == 'e' || buf[pos] == 'E') {
19943
- if (pos == start_pos) {
19944
- return false;
19945
- }
19946
- // E power
19947
- // parse an integer, this time not allowing another exponent
19948
- pos++;
19949
- int64_t exponent;
19950
- if (!TryIntegerCast<int64_t, true, false>(buf + pos, len - pos, exponent, strict)) {
19951
- return false;
19952
- }
19953
- ComputeDoubleResult<T, NEGATIVE>(result, decimal, decimal_factor);
19954
- if (result > NumericLimits<T>::Maximum() / std::pow(10.0L, exponent)) {
19955
- return false;
19956
- }
19957
- result = result * std::pow(10.0L, exponent);
19958
-
19959
- return true;
19960
- } else {
19961
- return false;
19962
- }
19963
- }
19964
- T digit = buf[pos++] - '0';
19965
- if (decimal_factor == 0) {
19966
- result = result * 10 + (NEGATIVE ? -digit : digit);
19967
- } else {
19968
- if (decimal_factor >= 1000000000000000000) {
19969
- // decimal value will overflow if we parse more, ignore any subsequent numbers
19970
- continue;
19971
- }
19972
- decimal = decimal * 10 + digit;
19973
- decimal_factor *= 10;
19974
- }
19975
- }
19976
- ComputeDoubleResult<T, NEGATIVE>(result, decimal, decimal_factor);
19977
- return pos > start_pos;
19978
- }
19979
-
19980
22295
  template <class T>
19981
22296
  bool CheckDoubleValidity(T value);
19982
22297
 
@@ -20000,28 +22315,32 @@ static bool TryDoubleCast(const char *buf, idx_t len, T &result, bool strict) {
20000
22315
  if (len == 0) {
20001
22316
  return false;
20002
22317
  }
20003
- int negative = *buf == '-';
20004
-
20005
- result = 0;
20006
- if (!negative) {
20007
- if (!DoubleCastLoop<T, false>(buf, len, result, strict)) {
20008
- return false;
20009
- }
20010
- } else {
20011
- if (!DoubleCastLoop<T, true>(buf, len, result, strict)) {
20012
- return false;
20013
- }
22318
+ if (*buf == '+') {
22319
+ buf++;
22320
+ len--;
20014
22321
  }
22322
+ auto endptr = buf + len;
22323
+ auto parse_result = duckdb_fast_float::from_chars(buf, buf + len, result);
20015
22324
  if (!CheckDoubleValidity<T>(result)) {
20016
22325
  return false;
20017
22326
  }
20018
- return true;
22327
+ if (parse_result.ec != std::errc()) {
22328
+ return false;
22329
+ }
22330
+ auto current_end = parse_result.ptr;
22331
+ if (!strict) {
22332
+ while (current_end < endptr && StringUtil::CharacterIsSpace(*current_end)) {
22333
+ current_end++;
22334
+ }
22335
+ }
22336
+ return current_end == endptr;
20019
22337
  }
20020
22338
 
20021
22339
  template <>
20022
22340
  bool TryCast::Operation(string_t input, float &result, bool strict) {
20023
22341
  return TryDoubleCast<float>(input.GetDataUnsafe(), input.GetSize(), result, strict);
20024
22342
  }
22343
+
20025
22344
  template <>
20026
22345
  bool TryCast::Operation(string_t input, double &result, bool strict) {
20027
22346
  return TryDoubleCast<double>(input.GetDataUnsafe(), input.GetSize(), result, strict);
@@ -32405,7 +34724,7 @@ private:
32405
34724
 
32406
34725
 
32407
34726
  // LICENSE_CHANGE_BEGIN
32408
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4
34727
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5
32409
34728
  // See the end of this file for a list
32410
34729
 
32411
34730
  //===----------------------------------------------------------------------===//
@@ -35734,6 +38053,56 @@ string Value::ToString() const {
35734
38053
  }
35735
38054
  }
35736
38055
 
38056
+ string Value::ToSQLString() const {
38057
+ if (IsNull()) {
38058
+ return ToString();
38059
+ }
38060
+ switch (type_.id()) {
38061
+ case LogicalTypeId::UUID:
38062
+ case LogicalTypeId::DATE:
38063
+ case LogicalTypeId::TIME:
38064
+ case LogicalTypeId::TIMESTAMP:
38065
+ case LogicalTypeId::TIME_TZ:
38066
+ case LogicalTypeId::TIMESTAMP_TZ:
38067
+ case LogicalTypeId::TIMESTAMP_SEC:
38068
+ case LogicalTypeId::TIMESTAMP_MS:
38069
+ case LogicalTypeId::TIMESTAMP_NS:
38070
+ case LogicalTypeId::INTERVAL:
38071
+ case LogicalTypeId::BLOB:
38072
+ return "'" + ToString() + "'::" + type_.ToString();
38073
+ case LogicalTypeId::VARCHAR:
38074
+ return "'" + ToString() + "'";
38075
+ case LogicalTypeId::STRUCT: {
38076
+ string ret = "{";
38077
+ auto &child_types = StructType::GetChildTypes(type_);
38078
+ for (size_t i = 0; i < struct_value.size(); i++) {
38079
+ auto &name = child_types[i].first;
38080
+ auto &child = struct_value[i];
38081
+ ret += "'" + name + "': " + child.ToSQLString();
38082
+ if (i < struct_value.size() - 1) {
38083
+ ret += ", ";
38084
+ }
38085
+ }
38086
+ ret += "}";
38087
+ return ret;
38088
+ }
38089
+ case LogicalTypeId::LIST: {
38090
+ string ret = "[";
38091
+ for (size_t i = 0; i < list_value.size(); i++) {
38092
+ auto &child = list_value[i];
38093
+ ret += child.ToSQLString();
38094
+ if (i < list_value.size() - 1) {
38095
+ ret += ", ";
38096
+ }
38097
+ }
38098
+ ret += "]";
38099
+ return ret;
38100
+ }
38101
+ default:
38102
+ return ToString();
38103
+ }
38104
+ }
38105
+
35737
38106
  //===--------------------------------------------------------------------===//
35738
38107
  // Type-specific getters
35739
38108
  //===--------------------------------------------------------------------===//
@@ -37880,6 +40249,7 @@ const sel_t ConstantVector::ZERO_VECTOR[STANDARD_VECTOR_SIZE] = {0};
37880
40249
 
37881
40250
 
37882
40251
 
40252
+
37883
40253
  namespace duckdb {
37884
40254
 
37885
40255
  LogicalType::LogicalType() : LogicalType(LogicalTypeId::INVALID) {
@@ -38245,11 +40615,11 @@ string LogicalTypeIdToString(LogicalTypeId id) {
38245
40615
  case LogicalTypeId::TIMESTAMP:
38246
40616
  return "TIMESTAMP";
38247
40617
  case LogicalTypeId::TIMESTAMP_MS:
38248
- return "TIMESTAMP (MS)";
40618
+ return "TIMESTAMP_MS";
38249
40619
  case LogicalTypeId::TIMESTAMP_NS:
38250
- return "TIMESTAMP (NS)";
40620
+ return "TIMESTAMP_NS";
38251
40621
  case LogicalTypeId::TIMESTAMP_SEC:
38252
- return "TIMESTAMP (SEC)";
40622
+ return "TIMESTAMP_S";
38253
40623
  case LogicalTypeId::TIMESTAMP_TZ:
38254
40624
  return "TIMESTAMP WITH TIME ZONE";
38255
40625
  case LogicalTypeId::TIME_TZ:
@@ -38307,21 +40677,21 @@ string LogicalType::ToString() const {
38307
40677
  return "STRUCT";
38308
40678
  }
38309
40679
  auto &child_types = StructType::GetChildTypes(*this);
38310
- string ret = "STRUCT<";
40680
+ string ret = "STRUCT(";
38311
40681
  for (size_t i = 0; i < child_types.size(); i++) {
38312
- ret += child_types[i].first + ": " + child_types[i].second.ToString();
40682
+ ret += child_types[i].first + " " + child_types[i].second.ToString();
38313
40683
  if (i < child_types.size() - 1) {
38314
40684
  ret += ", ";
38315
40685
  }
38316
40686
  }
38317
- ret += ">";
40687
+ ret += ")";
38318
40688
  return ret;
38319
40689
  }
38320
40690
  case LogicalTypeId::LIST: {
38321
40691
  if (!type_info_) {
38322
40692
  return "LIST";
38323
40693
  }
38324
- return "LIST<" + ListType::GetChildType(*this).ToString() + ">";
40694
+ return ListType::GetChildType(*this).ToString() + "[]";
38325
40695
  }
38326
40696
  case LogicalTypeId::MAP: {
38327
40697
  if (!type_info_) {
@@ -38349,7 +40719,10 @@ string LogicalType::ToString() const {
38349
40719
  return StringUtil::Format("DECIMAL(%d,%d)", width, scale);
38350
40720
  }
38351
40721
  case LogicalTypeId::ENUM: {
38352
- return EnumType::GetTypeName(*this);
40722
+ return KeywordHelper::WriteOptionallyQuoted(EnumType::GetTypeName(*this));
40723
+ }
40724
+ case LogicalTypeId::USER: {
40725
+ return KeywordHelper::WriteOptionallyQuoted(UserType::GetTypeName(*this));
38353
40726
  }
38354
40727
  case LogicalTypeId::AGGREGATE_STATE: {
38355
40728
  return AggregateStateType::GetTypeName(*this);
@@ -68942,6 +71315,7 @@ unique_ptr<FunctionData> BindDecimalFirst(ClientContext &context, AggregateFunct
68942
71315
  vector<unique_ptr<Expression>> &arguments) {
68943
71316
  auto decimal_type = arguments[0]->return_type;
68944
71317
  function = GetFirstFunction<LAST>(decimal_type);
71318
+ function.name = "first";
68945
71319
  function.return_type = decimal_type;
68946
71320
  return nullptr;
68947
71321
  }
@@ -69558,6 +71932,7 @@ template <class OP>
69558
71932
  unique_ptr<FunctionData> BindDecimalMinMax(ClientContext &context, AggregateFunction &function,
69559
71933
  vector<unique_ptr<Expression>> &arguments) {
69560
71934
  auto decimal_type = arguments[0]->return_type;
71935
+ auto name = function.name;
69561
71936
  switch (decimal_type.InternalType()) {
69562
71937
  case PhysicalType::INT16:
69563
71938
  function = GetUnaryAggregate<OP>(LogicalType::SMALLINT);
@@ -69572,6 +71947,7 @@ unique_ptr<FunctionData> BindDecimalMinMax(ClientContext &context, AggregateFunc
69572
71947
  function = GetUnaryAggregate<OP>(LogicalType::HUGEINT);
69573
71948
  break;
69574
71949
  }
71950
+ function.name = move(name);
69575
71951
  function.arguments[0] = decimal_type;
69576
71952
  function.return_type = decimal_type;
69577
71953
  return nullptr;
@@ -70173,7 +72549,7 @@ struct ReservoirQuantileFun {
70173
72549
 
70174
72550
 
70175
72551
  // LICENSE_CHANGE_BEGIN
70176
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5
72552
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
70177
72553
  // See the end of this file for a list
70178
72554
 
70179
72555
  /*
@@ -78698,6 +81074,21 @@ static void ExecuteMakeDate(DataChunk &input, ExpressionState &state, Vector &re
78698
81074
  MakeDateOperator::Operation<T, T, T, date_t>);
78699
81075
  }
78700
81076
 
81077
+ template <typename T>
81078
+ static void ExecuteStructMakeDate(DataChunk &input, ExpressionState &state, Vector &result) {
81079
+ // this should be guaranteed by the binder
81080
+ D_ASSERT(input.ColumnCount() == 1);
81081
+ auto &vec = input.data[0];
81082
+
81083
+ auto &children = StructVector::GetEntries(vec);
81084
+ D_ASSERT(children.size() == 3);
81085
+ auto &yyyy = *children[0];
81086
+ auto &mm = *children[1];
81087
+ auto &dd = *children[2];
81088
+
81089
+ TernaryExecutor::Execute<T, T, T, date_t>(yyyy, mm, dd, result, input.size(), Date::FromDate);
81090
+ }
81091
+
78701
81092
  struct MakeTimeOperator {
78702
81093
  template <typename HH, typename MM, typename SS, typename RESULT_TYPE>
78703
81094
  static RESULT_TYPE Operation(HH hh, MM mm, SS ss) {
@@ -78739,6 +81130,11 @@ void MakeDateFun::RegisterFunction(BuiltinFunctions &set) {
78739
81130
  ScalarFunctionSet make_date("make_date");
78740
81131
  make_date.AddFunction(ScalarFunction({LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT},
78741
81132
  LogicalType::DATE, ExecuteMakeDate<int64_t>));
81133
+
81134
+ child_list_t<LogicalType> make_date_children {
81135
+ {"year", LogicalType::BIGINT}, {"month", LogicalType::BIGINT}, {"day", LogicalType::BIGINT}};
81136
+ make_date.AddFunction(
81137
+ ScalarFunction({LogicalType::STRUCT(make_date_children)}, LogicalType::DATE, ExecuteStructMakeDate<int64_t>));
78742
81138
  set.AddFunction(make_date);
78743
81139
 
78744
81140
  ScalarFunctionSet make_time("make_time");
@@ -85355,8 +87751,8 @@ static unique_ptr<BaseStatistics> CaseConvertPropagateStats(ClientContext &conte
85355
87751
  }
85356
87752
 
85357
87753
  ScalarFunction LowerFun::GetFunction() {
85358
- return ScalarFunction({LogicalType::VARCHAR}, LogicalType::VARCHAR, CaseConvertFunction<false>, false, nullptr,
85359
- nullptr, CaseConvertPropagateStats<false>);
87754
+ return ScalarFunction("lower", {LogicalType::VARCHAR}, LogicalType::VARCHAR, CaseConvertFunction<false>, false,
87755
+ nullptr, nullptr, CaseConvertPropagateStats<false>);
85360
87756
  }
85361
87757
 
85362
87758
  void LowerFun::RegisterFunction(BuiltinFunctions &set) {
@@ -87256,7 +89652,7 @@ void PrintfFun::RegisterFunction(BuiltinFunctions &set) {
87256
89652
 
87257
89653
 
87258
89654
  // LICENSE_CHANGE_BEGIN
87259
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
89655
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
87260
89656
  // See the end of this file for a list
87261
89657
 
87262
89658
  // Copyright 2003-2009 The RE2 Authors. All Rights Reserved.
@@ -87460,7 +89856,7 @@ void PrintfFun::RegisterFunction(BuiltinFunctions &set) {
87460
89856
 
87461
89857
 
87462
89858
  // LICENSE_CHANGE_BEGIN
87463
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
89859
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
87464
89860
  // See the end of this file for a list
87465
89861
 
87466
89862
  // Copyright 2001-2010 The RE2 Authors. All Rights Reserved.
@@ -100264,7 +102660,7 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query,
100264
102660
  D_ASSERT(orig_expr_list.size() == de_expr_list.size() && cp_expr_list.size() == de_expr_list.size());
100265
102661
  for (idx_t i = 0; i < orig_expr_list.size(); i++) {
100266
102662
  // run the ToString, to verify that it doesn't crash
100267
- orig_expr_list[i]->ToString();
102663
+ auto str = orig_expr_list[i]->ToString();
100268
102664
  // check that the expressions are equivalent
100269
102665
  D_ASSERT(orig_expr_list[i]->Equals(de_expr_list[i].get()));
100270
102666
  D_ASSERT(orig_expr_list[i]->Equals(cp_expr_list[i].get()));
@@ -100274,6 +102670,17 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query,
100274
102670
  D_ASSERT(orig_expr_list[i]->Hash() == cp_expr_list[i]->Hash());
100275
102671
 
100276
102672
  D_ASSERT(!orig_expr_list[i]->Equals(nullptr));
102673
+ orig_expr_list[i]->Verify();
102674
+ de_expr_list[i]->Verify();
102675
+ cp_expr_list[i]->Verify();
102676
+
102677
+ // ToString round trip
102678
+ if (orig_expr_list[i]->HasSubquery()) {
102679
+ continue;
102680
+ }
102681
+ auto parsed_list = Parser::ParseExpressionList(str);
102682
+ D_ASSERT(parsed_list.size() == 1);
102683
+ D_ASSERT(parsed_list[0]->Equals(orig_expr_list[i].get()));
100277
102684
  }
100278
102685
  // now perform additional checking within the expressions
100279
102686
  for (idx_t outer_idx = 0; outer_idx < orig_expr_list.size(); outer_idx++) {
@@ -101976,7 +104383,7 @@ ExtensionLoadResult ExtensionHelper::LoadExtensionInternal(DuckDB &db, const std
101976
104383
 
101977
104384
 
101978
104385
  // LICENSE_CHANGE_BEGIN
101979
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
104386
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #8
101980
104387
  // See the end of this file for a list
101981
104388
 
101982
104389
  //
@@ -124328,7 +126735,7 @@ void PipelineFinishEvent::FinishEvent() {
124328
126735
 
124329
126736
 
124330
126737
  // LICENSE_CHANGE_BEGIN
124331
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #8
126738
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
124332
126739
  // See the end of this file for a list
124333
126740
 
124334
126741
  // Provides a C++11 implementation of a multi-producer, multi-consumer lock-free queue.
@@ -128005,7 +130412,7 @@ inline void swap(typename ConcurrentQueue<T, Traits>::ImplicitProducerKVP& a, ty
128005
130412
 
128006
130413
 
128007
130414
  // LICENSE_CHANGE_BEGIN
128008
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #8
130415
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
128009
130416
  // See the end of this file for a list
128010
130417
 
128011
130418
  // Provides an efficient implementation of a semaphore (LightweightSemaphore).
@@ -128667,6 +131074,9 @@ bool BaseExpression::Equals(const BaseExpression *other) const {
128667
131074
  return true;
128668
131075
  }
128669
131076
 
131077
+ void BaseExpression::Verify() const {
131078
+ }
131079
+
128670
131080
  } // namespace duckdb
128671
131081
 
128672
131082
 
@@ -128886,7 +131296,7 @@ BetweenExpression::BetweenExpression(unique_ptr<ParsedExpression> input_p, uniqu
128886
131296
  }
128887
131297
 
128888
131298
  string BetweenExpression::ToString() const {
128889
- return input->ToString() + " BETWEEN " + lower->ToString() + " AND " + upper->ToString();
131299
+ return ToString<BetweenExpression, ParsedExpression>(*this);
128890
131300
  }
128891
131301
 
128892
131302
  bool BetweenExpression::Equals(const BetweenExpression *a, const BetweenExpression *b) {
@@ -128932,13 +131342,7 @@ CaseExpression::CaseExpression() : ParsedExpression(ExpressionType::CASE_EXPR, E
128932
131342
  }
128933
131343
 
128934
131344
  string CaseExpression::ToString() const {
128935
- string case_str = "CASE ";
128936
- for (auto &check : case_checks) {
128937
- case_str += " WHEN (" + check.when_expr->ToString() + ")";
128938
- case_str += " THEN (" + check.then_expr->ToString() + ")";
128939
- }
128940
- case_str += " ELSE " + else_expr->ToString();
128941
- return case_str;
131345
+ return ToString<CaseExpression, ParsedExpression>(*this);
128942
131346
  }
128943
131347
 
128944
131348
  bool CaseExpression::Equals(const CaseExpression *a, const CaseExpression *b) {
@@ -129014,7 +131418,7 @@ CastExpression::CastExpression(LogicalType target, unique_ptr<ParsedExpression>
129014
131418
  }
129015
131419
 
129016
131420
  string CastExpression::ToString() const {
129017
- return (try_cast ? "TRY_CAST(" : "CAST(") + child->ToString() + " AS " + cast_type.ToString() + ")";
131421
+ return ToString<CastExpression, ParsedExpression>(*this);
129018
131422
  }
129019
131423
 
129020
131424
  bool CastExpression::Equals(const CastExpression *a, const CastExpression *b) {
@@ -129064,7 +131468,7 @@ CollateExpression::CollateExpression(string collation_p, unique_ptr<ParsedExpres
129064
131468
  }
129065
131469
 
129066
131470
  string CollateExpression::ToString() const {
129067
- return "COLLATE(" + child->ToString() + ")";
131471
+ return child->ToString() + " COLLATE " + collation;
129068
131472
  }
129069
131473
 
129070
131474
  bool CollateExpression::Equals(const CollateExpression *a, const CollateExpression *b) {
@@ -129101,6 +131505,7 @@ unique_ptr<ParsedExpression> CollateExpression::Deserialize(ExpressionType type,
129101
131505
 
129102
131506
 
129103
131507
 
131508
+
129104
131509
  namespace duckdb {
129105
131510
 
129106
131511
  ColumnRefExpression::ColumnRefExpression(string column_name, string table_name)
@@ -129144,7 +131549,7 @@ string ColumnRefExpression::ToString() const {
129144
131549
  if (i > 0) {
129145
131550
  result += ".";
129146
131551
  }
129147
- result += column_names[i];
131552
+ result += KeywordHelper::WriteOptionallyQuoted(column_names[i]);
129148
131553
  }
129149
131554
  return result;
129150
131555
  }
@@ -129205,7 +131610,7 @@ ComparisonExpression::ComparisonExpression(ExpressionType type, unique_ptr<Parse
129205
131610
  }
129206
131611
 
129207
131612
  string ComparisonExpression::ToString() const {
129208
- return left->ToString() + ExpressionTypeToOperator(type) + right->ToString();
131613
+ return ToString<ComparisonExpression, ParsedExpression>(*this);
129209
131614
  }
129210
131615
 
129211
131616
  bool ComparisonExpression::Equals(const ComparisonExpression *a, const ComparisonExpression *b) {
@@ -129239,41 +131644,6 @@ unique_ptr<ParsedExpression> ComparisonExpression::Deserialize(ExpressionType ty
129239
131644
 
129240
131645
 
129241
131646
 
129242
- //===----------------------------------------------------------------------===//
129243
- // DuckDB
129244
- //
129245
- // duckdb/parser/expression_util.hpp
129246
- //
129247
- //
129248
- //===----------------------------------------------------------------------===//
129249
-
129250
-
129251
-
129252
-
129253
-
129254
-
129255
- namespace duckdb {
129256
- class ParsedExpression;
129257
- class Expression;
129258
-
129259
- class ExpressionUtil {
129260
- public:
129261
- //! ListEquals: check if a list of two expressions is equal (order is important)
129262
- static bool ListEquals(const vector<unique_ptr<ParsedExpression>> &a,
129263
- const vector<unique_ptr<ParsedExpression>> &b);
129264
- static bool ListEquals(const vector<unique_ptr<Expression>> &a, const vector<unique_ptr<Expression>> &b);
129265
- //! SetEquals: check if two sets of expressions are equal (order is not important)
129266
- static bool SetEquals(const vector<unique_ptr<ParsedExpression>> &a, const vector<unique_ptr<ParsedExpression>> &b);
129267
- static bool SetEquals(const vector<unique_ptr<Expression>> &a, const vector<unique_ptr<Expression>> &b);
129268
-
129269
- private:
129270
- template <class T>
129271
- static bool ExpressionListEquals(const vector<unique_ptr<T>> &a, const vector<unique_ptr<T>> &b);
129272
- template <class T>
129273
- static bool ExpressionSetEquals(const vector<unique_ptr<T>> &a, const vector<unique_ptr<T>> &b);
129274
- };
129275
-
129276
- } // namespace duckdb
129277
131647
 
129278
131648
 
129279
131649
  namespace duckdb {
@@ -129309,11 +131679,7 @@ void ConjunctionExpression::AddExpression(unique_ptr<ParsedExpression> expr) {
129309
131679
  }
129310
131680
 
129311
131681
  string ConjunctionExpression::ToString() const {
129312
- string result = children[0]->ToString();
129313
- for (idx_t i = 1; i < children.size(); i++) {
129314
- result += " " + ExpressionTypeToOperator(type) + " " + children[i]->ToString();
129315
- }
129316
- return result;
131682
+ return ToString<ConjunctionExpression, ParsedExpression>(*this);
129317
131683
  }
129318
131684
 
129319
131685
  bool ConjunctionExpression::Equals(const ConjunctionExpression *a, const ConjunctionExpression *b) {
@@ -129355,7 +131721,7 @@ ConstantExpression::ConstantExpression(Value val)
129355
131721
  }
129356
131722
 
129357
131723
  string ConstantExpression::ToString() const {
129358
- return value.ToString();
131724
+ return value.ToSQLString();
129359
131725
  }
129360
131726
 
129361
131727
  bool ConstantExpression::Equals(const ConstantExpression *a, const ConstantExpression *b) {
@@ -129426,6 +131792,7 @@ FunctionExpression::FunctionExpression(string schema, const string &function_nam
129426
131792
  : ParsedExpression(ExpressionType::FUNCTION, ExpressionClass::FUNCTION), schema(std::move(schema)),
129427
131793
  function_name(StringUtil::Lower(function_name)), is_operator(is_operator), children(move(children_p)),
129428
131794
  distinct(distinct), filter(move(filter)), order_bys(move(order_bys_p)), export_state(export_state_p) {
131795
+ D_ASSERT(!function_name.empty());
129429
131796
  if (!order_bys) {
129430
131797
  order_bys = make_unique<OrderModifier>();
129431
131798
  }
@@ -129439,35 +131806,8 @@ FunctionExpression::FunctionExpression(const string &function_name, vector<uniqu
129439
131806
  }
129440
131807
 
129441
131808
  string FunctionExpression::ToString() const {
129442
- if (is_operator) {
129443
- // built-in operator
129444
- if (children.size() == 1) {
129445
- return function_name + children[0]->ToString();
129446
- } else if (children.size() == 2) {
129447
- return children[0]->ToString() + " " + function_name + " " + children[1]->ToString();
129448
- }
129449
- }
129450
- // standard function call
129451
- string result = function_name + "(";
129452
- result += StringUtil::Join(children, children.size(), ", ",
129453
- [](const unique_ptr<ParsedExpression> &child) { return child->ToString(); });
129454
-
129455
- // filtered aggregate
129456
- if (filter) {
129457
- result += " FILTER " + filter->ToString();
129458
- }
129459
-
129460
- // ordered aggregate
129461
- if (!order_bys->orders.empty()) {
129462
- result += " ORDER BY";
129463
- for (const auto &order : order_bys->orders) {
129464
- result += " " + order.ToString();
129465
- }
129466
- }
129467
- if (export_state) {
129468
- result += " EXPORT_STATE";
129469
- }
129470
- return result + ")";
131809
+ return ToString<FunctionExpression, ParsedExpression>(*this, schema, function_name, is_operator, distinct,
131810
+ filter.get(), order_bys.get(), export_state);
129471
131811
  }
129472
131812
 
129473
131813
  bool FunctionExpression::Equals(const FunctionExpression *a, const FunctionExpression *b) {
@@ -129552,6 +131892,10 @@ unique_ptr<ParsedExpression> FunctionExpression::Deserialize(ExpressionType type
129552
131892
  return move(function);
129553
131893
  }
129554
131894
 
131895
+ void FunctionExpression::Verify() const {
131896
+ D_ASSERT(!function_name.empty());
131897
+ }
131898
+
129555
131899
  } // namespace duckdb
129556
131900
 
129557
131901
 
@@ -129620,7 +131964,6 @@ unique_ptr<ParsedExpression> LambdaExpression::Deserialize(ExpressionType type,
129620
131964
 
129621
131965
 
129622
131966
 
129623
-
129624
131967
  namespace duckdb {
129625
131968
 
129626
131969
  OperatorExpression::OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
@@ -129639,21 +131982,7 @@ OperatorExpression::OperatorExpression(ExpressionType type, vector<unique_ptr<Pa
129639
131982
  }
129640
131983
 
129641
131984
  string OperatorExpression::ToString() const {
129642
- auto op = ExpressionTypeToOperator(type);
129643
- if (!op.empty()) {
129644
- // use the operator string to represent the operator
129645
- if (children.size() == 1) {
129646
- return op + children[0]->ToString();
129647
- } else if (children.size() == 2) {
129648
- return children[0]->ToString() + " " + op + " " + children[1]->ToString();
129649
- }
129650
- }
129651
- // if there is no operator we render it as a function
129652
- auto result = ExpressionTypeToString(type) + "(";
129653
- result += StringUtil::Join(children, children.size(), ", ",
129654
- [](const unique_ptr<ParsedExpression> &child) { return child->ToString(); });
129655
- result += ")";
129656
- return result;
131985
+ return ToString<OperatorExpression, ParsedExpression>(*this);
129657
131986
  }
129658
131987
 
129659
131988
  bool OperatorExpression::Equals(const OperatorExpression *a, const OperatorExpression *b) {
@@ -129785,7 +132114,7 @@ StarExpression::StarExpression(string relation_name_p)
129785
132114
  string StarExpression::ToString() const {
129786
132115
  string result = relation_name.empty() ? "*" : relation_name + ".*";
129787
132116
  if (!exclude_list.empty()) {
129788
- result += " EXCEPT (";
132117
+ result += " EXCLUDE (";
129789
132118
  bool first_entry = true;
129790
132119
  for (auto &entry : exclude_list) {
129791
132120
  if (!first_entry) {
@@ -129803,9 +132132,9 @@ string StarExpression::ToString() const {
129803
132132
  if (!first_entry) {
129804
132133
  result += ", ";
129805
132134
  }
129806
- result += entry.first;
129807
- result += " AS ";
129808
132135
  result += entry.second->ToString();
132136
+ result += " AS ";
132137
+ result += entry.first;
129809
132138
  first_entry = false;
129810
132139
  }
129811
132140
  result += ")";
@@ -129972,125 +132301,8 @@ WindowExpression::WindowExpression(ExpressionType type, string schema, const str
129972
132301
  }
129973
132302
  }
129974
132303
 
129975
- string WindowExpression::GetName() const {
129976
- return !alias.empty() ? alias : function_name;
129977
- }
129978
-
129979
132304
  string WindowExpression::ToString() const {
129980
- // Start with function call
129981
- string result = function_name + "(";
129982
- result += StringUtil::Join(children, children.size(), ", ",
129983
- [](const unique_ptr<ParsedExpression> &child) { return child->ToString(); });
129984
- // Lead/Lag extra arguments
129985
- if (offset_expr.get()) {
129986
- result += ", ";
129987
- result += offset_expr->ToString();
129988
- }
129989
- if (default_expr.get()) {
129990
- result += ", ";
129991
- result += default_expr->ToString();
129992
- }
129993
- // IGNORE NULLS
129994
- if (ignore_nulls) {
129995
- result += " IGNORE NULLS";
129996
- }
129997
- // Over clause
129998
- result += ") OVER(";
129999
- string sep;
130000
-
130001
- // Partitions
130002
- if (!partitions.empty()) {
130003
- result += "PARTITION BY ";
130004
- result += StringUtil::Join(partitions, partitions.size(), ", ",
130005
- [](const unique_ptr<ParsedExpression> &partition) { return partition->ToString(); });
130006
- sep = " ";
130007
- }
130008
-
130009
- // Orders
130010
- if (!orders.empty()) {
130011
- result += sep;
130012
- result += "ORDER BY ";
130013
- result +=
130014
- StringUtil::Join(orders, orders.size(), ", ", [](const OrderByNode &order) { return order.ToString(); });
130015
- sep = " ";
130016
- }
130017
-
130018
- // Rows/Range
130019
- string units = "ROWS";
130020
- string from;
130021
- switch (start) {
130022
- case WindowBoundary::CURRENT_ROW_RANGE:
130023
- case WindowBoundary::CURRENT_ROW_ROWS:
130024
- from = "CURRENT ROW";
130025
- units = (start == WindowBoundary::CURRENT_ROW_RANGE) ? "RANGE" : "ROWS";
130026
- break;
130027
- case WindowBoundary::UNBOUNDED_PRECEDING:
130028
- if (end != WindowBoundary::CURRENT_ROW_RANGE) {
130029
- from = "UNBOUNDED PRECEDING";
130030
- }
130031
- break;
130032
- case WindowBoundary::EXPR_PRECEDING_ROWS:
130033
- case WindowBoundary::EXPR_PRECEDING_RANGE:
130034
- from = start_expr->GetName() + " PRECEDING";
130035
- units = (start == WindowBoundary::EXPR_PRECEDING_RANGE) ? "RANGE" : "ROWS";
130036
- break;
130037
- case WindowBoundary::EXPR_FOLLOWING_ROWS:
130038
- case WindowBoundary::EXPR_FOLLOWING_RANGE:
130039
- from = start_expr->GetName() + " FOLLOWING";
130040
- units = (start == WindowBoundary::EXPR_FOLLOWING_RANGE) ? "RANGE" : "ROWS";
130041
- break;
130042
- default:
130043
- break;
130044
- }
130045
-
130046
- string to;
130047
- switch (end) {
130048
- case WindowBoundary::CURRENT_ROW_RANGE:
130049
- if (start != WindowBoundary::UNBOUNDED_PRECEDING) {
130050
- to = "CURRENT ROW";
130051
- units = "RANGE";
130052
- }
130053
- break;
130054
- case WindowBoundary::CURRENT_ROW_ROWS:
130055
- to = "CURRENT ROW";
130056
- units = "ROWS";
130057
- break;
130058
- case WindowBoundary::UNBOUNDED_PRECEDING:
130059
- to = "UNBOUNDED PRECEDING";
130060
- break;
130061
- case WindowBoundary::EXPR_PRECEDING_ROWS:
130062
- case WindowBoundary::EXPR_PRECEDING_RANGE:
130063
- to = end_expr->GetName() + " PRECEDING";
130064
- units = (start == WindowBoundary::EXPR_PRECEDING_RANGE) ? "RANGE" : "ROWS";
130065
- break;
130066
- case WindowBoundary::EXPR_FOLLOWING_ROWS:
130067
- case WindowBoundary::EXPR_FOLLOWING_RANGE:
130068
- to = end_expr->GetName() + " FOLLOWING";
130069
- units = (start == WindowBoundary::EXPR_FOLLOWING_RANGE) ? "RANGE" : "ROWS";
130070
- break;
130071
- default:
130072
- break;
130073
- }
130074
-
130075
- if (!from.empty() || !to.empty()) {
130076
- result += sep + units;
130077
- }
130078
- if (!from.empty() && !to.empty()) {
130079
- result += " BETWEEN ";
130080
- result += from;
130081
- result += " AND ";
130082
- result += to;
130083
- } else if (!from.empty()) {
130084
- result += " ";
130085
- result += from;
130086
- } else if (!to.empty()) {
130087
- result += " ";
130088
- result += to;
130089
- }
130090
-
130091
- result += ")";
130092
-
130093
- return result;
132305
+ return ToString<WindowExpression, ParsedExpression, OrderByNode>(*this, schema, function_name);
130094
132306
  }
130095
132307
 
130096
132308
  bool WindowExpression::Equals(const WindowExpression *a, const WindowExpression *b) {
@@ -131171,7 +133383,7 @@ void ParsedExpressionIterator::EnumerateQueryNodeChildren(
131171
133383
 
131172
133384
 
131173
133385
  // LICENSE_CHANGE_BEGIN
131174
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133386
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131175
133387
  // See the end of this file for a list
131176
133388
 
131177
133389
  // this is a bit of a mess from c.h, port.h and some others. Upside is it makes the parser compile with minimal
@@ -131283,7 +133495,7 @@ typedef enum PGPostgresAttributIdentityTypes {
131283
133495
 
131284
133496
 
131285
133497
  // LICENSE_CHANGE_BEGIN
131286
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133498
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131287
133499
  // See the end of this file for a list
131288
133500
 
131289
133501
  /*-------------------------------------------------------------------------
@@ -131312,7 +133524,7 @@ typedef enum PGPostgresAttributIdentityTypes {
131312
133524
 
131313
133525
 
131314
133526
  // LICENSE_CHANGE_BEGIN
131315
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133527
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131316
133528
  // See the end of this file for a list
131317
133529
 
131318
133530
  /*-------------------------------------------------------------------------
@@ -131423,7 +133635,7 @@ uint32_t bms_hash_value(const PGBitmapset *a);
131423
133635
 
131424
133636
 
131425
133637
  // LICENSE_CHANGE_BEGIN
131426
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133638
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131427
133639
  // See the end of this file for a list
131428
133640
 
131429
133641
  /*-------------------------------------------------------------------------
@@ -131476,7 +133688,7 @@ typedef enum PGLockWaitPolicy {
131476
133688
 
131477
133689
 
131478
133690
  // LICENSE_CHANGE_BEGIN
131479
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133691
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131480
133692
  // See the end of this file for a list
131481
133693
 
131482
133694
  /*-------------------------------------------------------------------------
@@ -131500,7 +133712,7 @@ typedef enum PGLockWaitPolicy {
131500
133712
 
131501
133713
 
131502
133714
  // LICENSE_CHANGE_BEGIN
131503
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133715
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131504
133716
  // See the end of this file for a list
131505
133717
 
131506
133718
  /*-------------------------------------------------------------------------
@@ -131573,7 +133785,7 @@ typedef int16_t PGAttrNumber;
131573
133785
 
131574
133786
 
131575
133787
  // LICENSE_CHANGE_BEGIN
131576
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133788
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131577
133789
  // See the end of this file for a list
131578
133790
 
131579
133791
  /*-------------------------------------------------------------------------
@@ -131617,7 +133829,7 @@ typedef int16_t PGAttrNumber;
131617
133829
 
131618
133830
 
131619
133831
  // LICENSE_CHANGE_BEGIN
131620
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133832
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131621
133833
  // See the end of this file for a list
131622
133834
 
131623
133835
  /*-------------------------------------------------------------------------
@@ -134074,7 +136286,7 @@ typedef struct PGOnConflictExpr {
134074
136286
 
134075
136287
 
134076
136288
  // LICENSE_CHANGE_BEGIN
134077
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
136289
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
134078
136290
  // See the end of this file for a list
134079
136291
 
134080
136292
  /*-------------------------------------------------------------------------
@@ -136414,7 +138626,7 @@ private:
136414
138626
 
136415
138627
 
136416
138628
  // LICENSE_CHANGE_BEGIN
136417
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
138629
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
136418
138630
  // See the end of this file for a list
136419
138631
 
136420
138632
  //===----------------------------------------------------------------------===//
@@ -136433,7 +138645,7 @@ private:
136433
138645
 
136434
138646
 
136435
138647
  // LICENSE_CHANGE_BEGIN
136436
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
138648
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
136437
138649
  // See the end of this file for a list
136438
138650
 
136439
138651
 
@@ -136505,7 +138717,7 @@ public:
136505
138717
 
136506
138718
 
136507
138719
  // LICENSE_CHANGE_BEGIN
136508
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
138720
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
136509
138721
  // See the end of this file for a list
136510
138722
 
136511
138723
  /*-------------------------------------------------------------------------
@@ -139033,7 +141245,6 @@ unique_ptr<ParsedExpression> Transformer::TransformFuncCall(duckdb_libpgquery::P
139033
141245
  function_name = reinterpret_cast<duckdb_libpgquery::PGValue *>(name->head->next->data.ptr_value)->val.str;
139034
141246
  } else {
139035
141247
  // unqualified name
139036
- // schema = DEFAULT_SCHEMA;
139037
141248
  schema = INVALID_SCHEMA;
139038
141249
  function_name = reinterpret_cast<duckdb_libpgquery::PGValue *>(name->head->data.ptr_value)->val.str;
139039
141250
  }
@@ -142150,6 +144361,7 @@ unique_ptr<LoadStatement> Transformer::TransformLoad(duckdb_libpgquery::PGNode *
142150
144361
 
142151
144362
 
142152
144363
 
144364
+
142153
144365
  namespace duckdb {
142154
144366
 
142155
144367
  unique_ptr<SQLStatement> Transformer::TransformPragma(duckdb_libpgquery::PGNode *node) {
@@ -142167,7 +144379,15 @@ unique_ptr<SQLStatement> Transformer::TransformPragma(duckdb_libpgquery::PGNode
142167
144379
 
142168
144380
  if (expr->type == ExpressionType::COMPARE_EQUAL) {
142169
144381
  auto &comp = (ComparisonExpression &)*expr;
142170
- info.named_parameters[comp.left->ToString()] = Value(comp.right->ToString());
144382
+ if (comp.right->type != ExpressionType::VALUE_CONSTANT) {
144383
+ throw ParserException("Named parameter requires a constant on the RHS");
144384
+ }
144385
+ if (comp.left->type != ExpressionType::COLUMN_REF) {
144386
+ throw ParserException("Named parameter requires a column reference on the LHS");
144387
+ }
144388
+ auto &columnref = (ColumnRefExpression &)*comp.left;
144389
+ auto &constant = (ConstantExpression &)*comp.right;
144390
+ info.named_parameters[columnref.GetName()] = constant.value;
142171
144391
  } else if (node->type == duckdb_libpgquery::T_PGAConst) {
142172
144392
  auto constant = TransformConstant((duckdb_libpgquery::PGAConst *)node);
142173
144393
  info.parameters.push_back(((ConstantExpression &)*constant).value);
@@ -145156,6 +147376,8 @@ static LogicalType BindRangeExpression(ClientContext &context, const string &nam
145156
147376
  }
145157
147377
 
145158
147378
  BindResult SelectBinder::BindWindow(WindowExpression &window, idx_t depth) {
147379
+ auto name = window.GetName();
147380
+
145159
147381
  QueryErrorContext error_context(binder.root_statement, window.query_location);
145160
147382
  if (inside_window) {
145161
147383
  throw BinderException(error_context.FormatError("window function calls cannot be nested"));
@@ -145323,7 +147545,7 @@ BindResult SelectBinder::BindWindow(WindowExpression &window, idx_t depth) {
145323
147545
  result->end = window.end;
145324
147546
 
145325
147547
  // create a BoundColumnRef that references this entry
145326
- auto colref = make_unique<BoundColumnRefExpression>(window.GetName(), result->return_type,
147548
+ auto colref = make_unique<BoundColumnRefExpression>(move(name), result->return_type,
145327
147549
  ColumnBinding(node.window_index, node.windows.size()), depth);
145328
147550
  // move the WINDOW expression into the set of bound windows
145329
147551
  node.windows.push_back(move(result));
@@ -150301,7 +152523,70 @@ string Binder::FormatErrorRecursive(idx_t query_location, const string &message,
150301
152523
  } // namespace duckdb
150302
152524
 
150303
152525
 
152526
+ namespace duckdb {
150304
152527
 
152528
+ BoundResultModifier::BoundResultModifier(ResultModifierType type) : type(type) {
152529
+ }
152530
+
152531
+ BoundResultModifier::~BoundResultModifier() {
152532
+ }
152533
+
152534
+ BoundOrderByNode::BoundOrderByNode(OrderType type, OrderByNullType null_order, unique_ptr<Expression> expression)
152535
+ : type(type), null_order(null_order), expression(move(expression)) {
152536
+ }
152537
+ BoundOrderByNode::BoundOrderByNode(OrderType type, OrderByNullType null_order, unique_ptr<Expression> expression,
152538
+ unique_ptr<BaseStatistics> stats)
152539
+ : type(type), null_order(null_order), expression(move(expression)), stats(move(stats)) {
152540
+ }
152541
+
152542
+ BoundOrderByNode BoundOrderByNode::Copy() const {
152543
+ if (stats) {
152544
+ return BoundOrderByNode(type, null_order, expression->Copy(), stats->Copy());
152545
+ } else {
152546
+ return BoundOrderByNode(type, null_order, expression->Copy());
152547
+ }
152548
+ }
152549
+
152550
+ string BoundOrderByNode::ToString() const {
152551
+ auto str = expression->ToString();
152552
+ switch (type) {
152553
+ case OrderType::ASCENDING:
152554
+ str += " ASC";
152555
+ break;
152556
+ case OrderType::DESCENDING:
152557
+ str += " DESC";
152558
+ break;
152559
+ default:
152560
+ break;
152561
+ }
152562
+
152563
+ switch (null_order) {
152564
+ case OrderByNullType::NULLS_FIRST:
152565
+ str += " NULLS FIRST";
152566
+ break;
152567
+ case OrderByNullType::NULLS_LAST:
152568
+ str += " NULLS LAST";
152569
+ break;
152570
+ default:
152571
+ break;
152572
+ }
152573
+ return str;
152574
+ }
152575
+
152576
+ BoundLimitModifier::BoundLimitModifier() : BoundResultModifier(ResultModifierType::LIMIT_MODIFIER) {
152577
+ }
152578
+
152579
+ BoundOrderModifier::BoundOrderModifier() : BoundResultModifier(ResultModifierType::ORDER_MODIFIER) {
152580
+ }
152581
+
152582
+ BoundDistinctModifier::BoundDistinctModifier() : BoundResultModifier(ResultModifierType::DISTINCT_MODIFIER) {
152583
+ }
152584
+
152585
+ BoundLimitPercentModifier::BoundLimitPercentModifier()
152586
+ : BoundResultModifier(ResultModifierType::LIMIT_PERCENT_MODIFIER) {
152587
+ }
152588
+
152589
+ } // namespace duckdb
150305
152590
 
150306
152591
 
150307
152592
 
@@ -150317,17 +152602,12 @@ BoundAggregateExpression::BoundAggregateExpression(AggregateFunction function, v
150317
152602
  : Expression(ExpressionType::BOUND_AGGREGATE, ExpressionClass::BOUND_AGGREGATE, function.return_type),
150318
152603
  function(move(function)), children(move(children)), bind_info(move(bind_info)), distinct(distinct),
150319
152604
  filter(move(filter)) {
152605
+ D_ASSERT(!function.name.empty());
150320
152606
  }
150321
152607
 
150322
152608
  string BoundAggregateExpression::ToString() const {
150323
- string result = function.name + "(";
150324
- if (distinct) {
150325
- result += "DISTINCT ";
150326
- }
150327
- result += StringUtil::Join(children, children.size(), ", ",
150328
- [](const unique_ptr<Expression> &child) { return child->ToString(); });
150329
- result += ")";
150330
- return result;
152609
+ return FunctionExpression::ToString<BoundAggregateExpression, Expression>(*this, string(), function.name, false,
152610
+ distinct, filter.get());
150331
152611
  }
150332
152612
 
150333
152613
  hash_t BoundAggregateExpression::Hash() const {
@@ -150381,6 +152661,7 @@ unique_ptr<Expression> BoundAggregateExpression::Copy() {
150381
152661
  } // namespace duckdb
150382
152662
 
150383
152663
 
152664
+
150384
152665
  namespace duckdb {
150385
152666
 
150386
152667
  BoundBetweenExpression::BoundBetweenExpression(unique_ptr<Expression> input, unique_ptr<Expression> lower,
@@ -150391,7 +152672,7 @@ BoundBetweenExpression::BoundBetweenExpression(unique_ptr<Expression> input, uni
150391
152672
  }
150392
152673
 
150393
152674
  string BoundBetweenExpression::ToString() const {
150394
- return input->ToString() + " BETWEEN " + lower->ToString() + " AND " + upper->ToString();
152675
+ return BetweenExpression::ToString<BoundBetweenExpression, Expression>(*this);
150395
152676
  }
150396
152677
 
150397
152678
  bool BoundBetweenExpression::Equals(const BaseExpression *other_p) const {
@@ -150421,6 +152702,7 @@ unique_ptr<Expression> BoundBetweenExpression::Copy() {
150421
152702
  } // namespace duckdb
150422
152703
 
150423
152704
 
152705
+
150424
152706
  namespace duckdb {
150425
152707
 
150426
152708
  BoundCaseExpression::BoundCaseExpression(LogicalType type)
@@ -150438,13 +152720,7 @@ BoundCaseExpression::BoundCaseExpression(unique_ptr<Expression> when_expr, uniqu
150438
152720
  }
150439
152721
 
150440
152722
  string BoundCaseExpression::ToString() const {
150441
- string result = "CASE";
150442
- for (auto &check : case_checks) {
150443
- result += " WHEN (" + check.when_expr->ToString() + ")";
150444
- result += " THEN (" + check.then_expr->ToString() + ")";
150445
- }
150446
- result += " ELSE (" + else_expr->ToString() + ")";
150447
- return result;
152723
+ return CaseExpression::ToString<BoundCaseExpression, Expression>(*this);
150448
152724
  }
150449
152725
 
150450
152726
  bool BoundCaseExpression::Equals(const BaseExpression *other_p) const {
@@ -150618,10 +152894,10 @@ unique_ptr<Expression> BoundCastExpression::Copy() {
150618
152894
 
150619
152895
  namespace duckdb {
150620
152896
 
150621
- BoundColumnRefExpression::BoundColumnRefExpression(string alias, LogicalType type, ColumnBinding binding, idx_t depth)
152897
+ BoundColumnRefExpression::BoundColumnRefExpression(string alias_p, LogicalType type, ColumnBinding binding, idx_t depth)
150622
152898
  : Expression(ExpressionType::BOUND_COLUMN_REF, ExpressionClass::BOUND_COLUMN_REF, move(type)), binding(binding),
150623
152899
  depth(depth) {
150624
- this->alias = move(alias);
152900
+ this->alias = move(alias_p);
150625
152901
  }
150626
152902
 
150627
152903
  BoundColumnRefExpression::BoundColumnRefExpression(LogicalType type, ColumnBinding binding, idx_t depth)
@@ -150648,12 +152924,16 @@ bool BoundColumnRefExpression::Equals(const BaseExpression *other_p) const {
150648
152924
  }
150649
152925
 
150650
152926
  string BoundColumnRefExpression::ToString() const {
152927
+ if (!alias.empty()) {
152928
+ return alias;
152929
+ }
150651
152930
  return "#[" + to_string(binding.table_index) + "." + to_string(binding.column_index) + "]";
150652
152931
  }
150653
152932
 
150654
152933
  } // namespace duckdb
150655
152934
 
150656
152935
 
152936
+
150657
152937
  namespace duckdb {
150658
152938
 
150659
152939
  BoundComparisonExpression::BoundComparisonExpression(ExpressionType type, unique_ptr<Expression> left,
@@ -150662,7 +152942,7 @@ BoundComparisonExpression::BoundComparisonExpression(ExpressionType type, unique
150662
152942
  }
150663
152943
 
150664
152944
  string BoundComparisonExpression::ToString() const {
150665
- return left->GetName() + ExpressionTypeToOperator(type) + right->GetName();
152945
+ return ComparisonExpression::ToString<BoundComparisonExpression, Expression>(*this);
150666
152946
  }
150667
152947
 
150668
152948
  bool BoundComparisonExpression::Equals(const BaseExpression *other_p) const {
@@ -150689,6 +152969,7 @@ unique_ptr<Expression> BoundComparisonExpression::Copy() {
150689
152969
 
150690
152970
 
150691
152971
 
152972
+
150692
152973
  namespace duckdb {
150693
152974
 
150694
152975
  BoundConjunctionExpression::BoundConjunctionExpression(ExpressionType type)
@@ -150703,11 +152984,7 @@ BoundConjunctionExpression::BoundConjunctionExpression(ExpressionType type, uniq
150703
152984
  }
150704
152985
 
150705
152986
  string BoundConjunctionExpression::ToString() const {
150706
- string result = "(" + children[0]->ToString();
150707
- for (idx_t i = 1; i < children.size(); i++) {
150708
- result += " " + ExpressionTypeToOperator(type) + " " + children[i]->ToString();
150709
- }
150710
- return result + ")";
152987
+ return ConjunctionExpression::ToString<BoundConjunctionExpression, Expression>(*this);
150711
152988
  }
150712
152989
 
150713
152990
  bool BoundConjunctionExpression::Equals(const BaseExpression *other_p) const {
@@ -150741,7 +153018,7 @@ BoundConstantExpression::BoundConstantExpression(Value value_p)
150741
153018
  }
150742
153019
 
150743
153020
  string BoundConstantExpression::ToString() const {
150744
- return value.ToString();
153021
+ return value.ToSQLString();
150745
153022
  }
150746
153023
 
150747
153024
  bool BoundConstantExpression::Equals(const BaseExpression *other_p) const {
@@ -150770,7 +153047,6 @@ unique_ptr<Expression> BoundConstantExpression::Copy() {
150770
153047
 
150771
153048
 
150772
153049
 
150773
-
150774
153050
  namespace duckdb {
150775
153051
 
150776
153052
  BoundFunctionExpression::BoundFunctionExpression(LogicalType return_type, ScalarFunction bound_function,
@@ -150778,6 +153054,7 @@ BoundFunctionExpression::BoundFunctionExpression(LogicalType return_type, Scalar
150778
153054
  unique_ptr<FunctionData> bind_info, bool is_operator)
150779
153055
  : Expression(ExpressionType::BOUND_FUNCTION, ExpressionClass::BOUND_FUNCTION, move(return_type)),
150780
153056
  function(move(bound_function)), children(move(arguments)), bind_info(move(bind_info)), is_operator(is_operator) {
153057
+ D_ASSERT(!function.name.empty());
150781
153058
  }
150782
153059
 
150783
153060
  bool BoundFunctionExpression::HasSideEffects() const {
@@ -150790,11 +153067,8 @@ bool BoundFunctionExpression::IsFoldable() const {
150790
153067
  }
150791
153068
 
150792
153069
  string BoundFunctionExpression::ToString() const {
150793
- string result = function.name + "(";
150794
- result += StringUtil::Join(children, children.size(), ", ",
150795
- [](const unique_ptr<Expression> &child) { return child->GetName(); });
150796
- result += ")";
150797
- return result;
153070
+ return FunctionExpression::ToString<BoundFunctionExpression, Expression>(*this, string(), function.name,
153071
+ is_operator);
150798
153072
  }
150799
153073
 
150800
153074
  hash_t BoundFunctionExpression::Hash() const {
@@ -150832,11 +153106,16 @@ unique_ptr<Expression> BoundFunctionExpression::Copy() {
150832
153106
  return move(copy);
150833
153107
  }
150834
153108
 
153109
+ void BoundFunctionExpression::Verify() const {
153110
+ D_ASSERT(!function.name.empty());
153111
+ }
153112
+
150835
153113
  } // namespace duckdb
150836
153114
 
150837
153115
 
150838
153116
 
150839
153117
 
153118
+
150840
153119
  namespace duckdb {
150841
153120
 
150842
153121
  BoundOperatorExpression::BoundOperatorExpression(ExpressionType type, LogicalType return_type)
@@ -150844,21 +153123,7 @@ BoundOperatorExpression::BoundOperatorExpression(ExpressionType type, LogicalTyp
150844
153123
  }
150845
153124
 
150846
153125
  string BoundOperatorExpression::ToString() const {
150847
- auto op = ExpressionTypeToOperator(type);
150848
- if (!op.empty()) {
150849
- // use the operator string to represent the operator
150850
- if (children.size() == 1) {
150851
- return op + "(" + children[0]->GetName() + ")";
150852
- } else if (children.size() == 2) {
150853
- return children[0]->GetName() + " " + op + " " + children[1]->GetName();
150854
- }
150855
- }
150856
- // if there is no operator we render it as a function
150857
- auto result = ExpressionTypeToString(type) + "(";
150858
- result += StringUtil::Join(children, children.size(), ", ",
150859
- [](const unique_ptr<Expression> &child) { return child->GetName(); });
150860
- result += ")";
150861
- return result;
153126
+ return OperatorExpression::ToString<BoundOperatorExpression, Expression>(*this);
150862
153127
  }
150863
153128
 
150864
153129
  bool BoundOperatorExpression::Equals(const BaseExpression *other_p) const {
@@ -150948,6 +153213,9 @@ BoundReferenceExpression::BoundReferenceExpression(LogicalType type, idx_t index
150948
153213
  }
150949
153214
 
150950
153215
  string BoundReferenceExpression::ToString() const {
153216
+ if (!alias.empty()) {
153217
+ return alias;
153218
+ }
150951
153219
  return "#" + to_string(index);
150952
153220
  }
150953
153221
 
@@ -151039,6 +153307,7 @@ unique_ptr<Expression> BoundUnnestExpression::Copy() {
151039
153307
 
151040
153308
 
151041
153309
 
153310
+
151042
153311
  namespace duckdb {
151043
153312
 
151044
153313
  BoundWindowExpression::BoundWindowExpression(ExpressionType type, LogicalType return_type,
@@ -151049,134 +153318,9 @@ BoundWindowExpression::BoundWindowExpression(ExpressionType type, LogicalType re
151049
153318
  }
151050
153319
 
151051
153320
  string BoundWindowExpression::ToString() const {
151052
- string result = aggregate.get() ? aggregate->name : ExpressionTypeToString(type);
151053
- result += "(";
151054
- result += StringUtil::Join(children, children.size(), ", ",
151055
- [](const unique_ptr<Expression> &child) { return child->GetName(); });
151056
- // Lead/Lag extra arguments
151057
- if (offset_expr.get()) {
151058
- result += ", ";
151059
- result += offset_expr->GetName();
151060
- }
151061
- if (default_expr.get()) {
151062
- result += ", ";
151063
- result += default_expr->GetName();
151064
- }
151065
-
151066
- // IGNORE NULLS
151067
- if (ignore_nulls) {
151068
- result += " IGNORE NULLS";
151069
- }
151070
-
151071
- // Over clause
151072
- result += ") OVER(";
151073
- string sep;
151074
-
151075
- // Partitions
151076
- if (!partitions.empty()) {
151077
- result += "PARTITION BY ";
151078
- result += StringUtil::Join(partitions, partitions.size(), ", ",
151079
- [](const unique_ptr<Expression> &partition) { return partition->GetName(); });
151080
- sep = " ";
151081
- }
151082
-
151083
- // Orders
151084
- if (!orders.empty()) {
151085
- result += sep;
151086
- result += "ORDER BY ";
151087
- result += StringUtil::Join(orders, orders.size(), ", ", [](const BoundOrderByNode &order) {
151088
- auto str = order.expression->GetName();
151089
- str += (order.type == OrderType::ASCENDING) ? " ASC" : " DESC";
151090
- switch (order.null_order) {
151091
- case OrderByNullType::NULLS_FIRST:
151092
- str += " NULLS FIRST";
151093
- break;
151094
- case OrderByNullType::NULLS_LAST:
151095
- str += " NULLS LAST";
151096
- break;
151097
- default:
151098
- break;
151099
- }
151100
- return str;
151101
- });
151102
- sep = " ";
151103
- }
151104
-
151105
- // Rows/Range
151106
- string units = "ROWS";
151107
- string from;
151108
- switch (start) {
151109
- case WindowBoundary::CURRENT_ROW_RANGE:
151110
- case WindowBoundary::CURRENT_ROW_ROWS:
151111
- from = "CURRENT ROW";
151112
- units = (start == WindowBoundary::CURRENT_ROW_RANGE) ? "RANGE" : "ROWS";
151113
- break;
151114
- case WindowBoundary::UNBOUNDED_PRECEDING:
151115
- if (end != WindowBoundary::CURRENT_ROW_RANGE) {
151116
- from = "UNBOUNDED PRECEDING";
151117
- }
151118
- break;
151119
- case WindowBoundary::EXPR_PRECEDING_ROWS:
151120
- case WindowBoundary::EXPR_PRECEDING_RANGE:
151121
- from = start_expr->GetName() + " PRECEDING";
151122
- units = (start == WindowBoundary::EXPR_PRECEDING_RANGE) ? "RANGE" : "ROWS";
151123
- break;
151124
- case WindowBoundary::EXPR_FOLLOWING_ROWS:
151125
- case WindowBoundary::EXPR_FOLLOWING_RANGE:
151126
- from = start_expr->GetName() + " FOLLOWING";
151127
- units = (start == WindowBoundary::EXPR_FOLLOWING_RANGE) ? "RANGE" : "ROWS";
151128
- break;
151129
- default:
151130
- break;
151131
- }
151132
-
151133
- string to;
151134
- switch (end) {
151135
- case WindowBoundary::CURRENT_ROW_RANGE:
151136
- if (start != WindowBoundary::UNBOUNDED_PRECEDING) {
151137
- to = "CURRENT ROW";
151138
- units = "RANGE";
151139
- }
151140
- break;
151141
- case WindowBoundary::CURRENT_ROW_ROWS:
151142
- to = "CURRENT ROW";
151143
- units = "ROWS";
151144
- break;
151145
- case WindowBoundary::UNBOUNDED_PRECEDING:
151146
- to = "UNBOUNDED PRECEDING";
151147
- break;
151148
- case WindowBoundary::EXPR_PRECEDING_ROWS:
151149
- case WindowBoundary::EXPR_PRECEDING_RANGE:
151150
- to = end_expr->GetName() + " PRECEDING";
151151
- units = (start == WindowBoundary::EXPR_PRECEDING_RANGE) ? "RANGE" : "ROWS";
151152
- break;
151153
- case WindowBoundary::EXPR_FOLLOWING_ROWS:
151154
- case WindowBoundary::EXPR_FOLLOWING_RANGE:
151155
- to = end_expr->GetName() + " FOLLOWING";
151156
- units = (start == WindowBoundary::EXPR_FOLLOWING_RANGE) ? "RANGE" : "ROWS";
151157
- break;
151158
- default:
151159
- break;
151160
- }
151161
-
151162
- if (!from.empty() || !to.empty()) {
151163
- result += sep + units;
151164
- }
151165
- if (!from.empty() && !to.empty()) {
151166
- result += " BETWEEN ";
151167
- result += from;
151168
- result += " AND ";
151169
- result += to;
151170
- } else if (!from.empty()) {
151171
- result += " ";
151172
- result += from;
151173
- } else if (!to.empty()) {
151174
- result += " ";
151175
- result += to;
151176
- }
151177
-
151178
- result += ")";
151179
- return result;
153321
+ string function_name = aggregate.get() ? aggregate->name : ExpressionTypeToString(type);
153322
+ return WindowExpression::ToString<BoundWindowExpression, Expression, BoundOrderByNode>(*this, string(),
153323
+ function_name);
151180
153324
  }
151181
153325
 
151182
153326
  bool BoundWindowExpression::Equals(const BaseExpression *other_p) const {
@@ -151770,7 +153914,13 @@ OrderBinder::OrderBinder(vector<Binder *> binders, idx_t projection_index, Selec
151770
153914
  }
151771
153915
 
151772
153916
  unique_ptr<Expression> OrderBinder::CreateProjectionReference(ParsedExpression &expr, idx_t index) {
151773
- return make_unique<BoundColumnRefExpression>(expr.GetName(), LogicalType::INVALID,
153917
+ string alias;
153918
+ if (extra_list && index < extra_list->size()) {
153919
+ alias = extra_list->at(index)->ToString();
153920
+ } else {
153921
+ alias = expr.GetName();
153922
+ }
153923
+ return make_unique<BoundColumnRefExpression>(move(alias), LogicalType::INVALID,
151774
153924
  ColumnBinding(projection_index, index));
151775
153925
  }
151776
153926
 
@@ -152879,6 +155029,7 @@ JoinSide JoinSide::GetJoinSide(const unordered_set<idx_t> &bindings, unordered_s
152879
155029
 
152880
155030
 
152881
155031
 
155032
+
152882
155033
  namespace duckdb {
152883
155034
 
152884
155035
  string LogicalOperator::GetName() const {
@@ -152955,6 +155106,7 @@ void LogicalOperator::Verify() {
152955
155106
  #ifdef DEBUG
152956
155107
  // verify expressions
152957
155108
  for (idx_t expr_idx = 0; expr_idx < expressions.size(); expr_idx++) {
155109
+ auto str = expressions[expr_idx]->ToString();
152958
155110
  // verify that we can (correctly) copy this expression
152959
155111
  auto copy = expressions[expr_idx]->Copy();
152960
155112
  auto original_hash = expressions[expr_idx]->Hash();
@@ -152974,6 +155126,7 @@ void LogicalOperator::Verify() {
152974
155126
  D_ASSERT(!expr_equal);
152975
155127
  }
152976
155128
  }
155129
+ D_ASSERT(!str.empty());
152977
155130
  }
152978
155131
  D_ASSERT(!ToString().empty());
152979
155132
  for (auto &child : children) {
@@ -156230,7 +158383,7 @@ void PartialBlock::FlushToDisk(DatabaseInstance &db) {
156230
158383
 
156231
158384
 
156232
158385
  // LICENSE_CHANGE_BEGIN
156233
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
158386
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #11
156234
158387
  // See the end of this file for a list
156235
158388
 
156236
158389
  /**
@@ -156243,7 +158396,7 @@ void PartialBlock::FlushToDisk(DatabaseInstance &db) {
156243
158396
 
156244
158397
 
156245
158398
  // LICENSE_CHANGE_BEGIN
156246
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
158399
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #11
156247
158400
  // See the end of this file for a list
156248
158401
 
156249
158402
  /**
@@ -179681,7 +181834,7 @@ mz_bool mz_zip_end(mz_zip_archive *pZip)
179681
181834
 
179682
181835
 
179683
181836
  // LICENSE_CHANGE_BEGIN
179684
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
181837
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179685
181838
  // See the end of this file for a list
179686
181839
 
179687
181840
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -179712,7 +181865,7 @@ mz_bool mz_zip_end(mz_zip_archive *pZip)
179712
181865
 
179713
181866
 
179714
181867
  // LICENSE_CHANGE_BEGIN
179715
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
181868
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179716
181869
  // See the end of this file for a list
179717
181870
 
179718
181871
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -179733,7 +181886,7 @@ mz_bool mz_zip_end(mz_zip_archive *pZip)
179733
181886
 
179734
181887
 
179735
181888
  // LICENSE_CHANGE_BEGIN
179736
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
181889
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179737
181890
  // See the end of this file for a list
179738
181891
 
179739
181892
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -179880,7 +182033,7 @@ class LogMessageFatal : public LogMessage {
179880
182033
 
179881
182034
 
179882
182035
  // LICENSE_CHANGE_BEGIN
179883
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
182036
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179884
182037
  // See the end of this file for a list
179885
182038
 
179886
182039
  // Copyright 2018 The RE2 Authors. All Rights Reserved.
@@ -179945,7 +182098,7 @@ class PODArray {
179945
182098
 
179946
182099
 
179947
182100
  // LICENSE_CHANGE_BEGIN
179948
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
182101
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179949
182102
  // See the end of this file for a list
179950
182103
 
179951
182104
  // Copyright 2007 The RE2 Authors. All Rights Reserved.
@@ -179972,7 +182125,7 @@ class PODArray {
179972
182125
 
179973
182126
 
179974
182127
  // LICENSE_CHANGE_BEGIN
179975
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
182128
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179976
182129
  // See the end of this file for a list
179977
182130
 
179978
182131
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -180374,7 +182527,7 @@ template<typename Value> bool SparseArray<Value>::less(const IndexValue& a,
180374
182527
 
180375
182528
 
180376
182529
  // LICENSE_CHANGE_BEGIN
180377
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
182530
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
180378
182531
  // See the end of this file for a list
180379
182532
 
180380
182533
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -181063,7 +183216,7 @@ class Prog {
181063
183216
 
181064
183217
 
181065
183218
  // LICENSE_CHANGE_BEGIN
181066
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
183219
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
181067
183220
  // See the end of this file for a list
181068
183221
 
181069
183222
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -181164,7 +183317,7 @@ class Prog {
181164
183317
 
181165
183318
 
181166
183319
  // LICENSE_CHANGE_BEGIN
181167
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
183320
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
181168
183321
  // See the end of this file for a list
181169
183322
 
181170
183323
  /*
@@ -182138,7 +184291,7 @@ bool Prog::SearchBitState(const StringPiece& text,
182138
184291
 
182139
184292
 
182140
184293
  // LICENSE_CHANGE_BEGIN
182141
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
184294
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
182142
184295
  // See the end of this file for a list
182143
184296
 
182144
184297
  // Copyright 2007 The RE2 Authors. All Rights Reserved.
@@ -182165,7 +184318,7 @@ bool Prog::SearchBitState(const StringPiece& text,
182165
184318
 
182166
184319
 
182167
184320
  // LICENSE_CHANGE_BEGIN
182168
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
184321
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
182169
184322
  // See the end of this file for a list
182170
184323
 
182171
184324
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -183681,7 +185834,7 @@ Prog* Prog::CompileSet(Regexp* re, RE2::Anchor anchor, int64_t max_mem) {
183681
185834
 
183682
185835
 
183683
185836
  // LICENSE_CHANGE_BEGIN
183684
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
185837
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
183685
185838
  // See the end of this file for a list
183686
185839
 
183687
185840
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -183726,7 +185879,7 @@ Prog* Prog::CompileSet(Regexp* re, RE2::Anchor anchor, int64_t max_mem) {
183726
185879
 
183727
185880
 
183728
185881
  // LICENSE_CHANGE_BEGIN
183729
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
185882
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
183730
185883
  // See the end of this file for a list
183731
185884
 
183732
185885
  // Copyright 2016 The RE2 Authors. All Rights Reserved.
@@ -183777,7 +185930,7 @@ class HashMix {
183777
185930
 
183778
185931
 
183779
185932
  // LICENSE_CHANGE_BEGIN
183780
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
185933
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
183781
185934
  // See the end of this file for a list
183782
185935
 
183783
185936
  // Copyright 2007 The RE2 Authors. All Rights Reserved.
@@ -183921,7 +186074,7 @@ class WriterMutexLock {
183921
186074
 
183922
186075
 
183923
186076
  // LICENSE_CHANGE_BEGIN
183924
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
186077
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
183925
186078
  // See the end of this file for a list
183926
186079
 
183927
186080
  // Copyright 2016 The RE2 Authors. All Rights Reserved.
@@ -185997,7 +188150,7 @@ bool Prog::PossibleMatchRange(std::string* min, std::string* max, int maxlen) {
185997
188150
 
185998
188151
 
185999
188152
  // LICENSE_CHANGE_BEGIN
186000
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188153
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186001
188154
  // See the end of this file for a list
186002
188155
 
186003
188156
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -186007,7 +188160,7 @@ bool Prog::PossibleMatchRange(std::string* min, std::string* max, int maxlen) {
186007
188160
 
186008
188161
 
186009
188162
  // LICENSE_CHANGE_BEGIN
186010
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188163
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186011
188164
  // See the end of this file for a list
186012
188165
 
186013
188166
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -186133,7 +188286,7 @@ class FilteredRE2 {
186133
188286
 
186134
188287
 
186135
188288
  // LICENSE_CHANGE_BEGIN
186136
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188289
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186137
188290
  // See the end of this file for a list
186138
188291
 
186139
188292
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -186251,7 +188404,7 @@ class Prefilter {
186251
188404
 
186252
188405
 
186253
188406
  // LICENSE_CHANGE_BEGIN
186254
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188407
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186255
188408
  // See the end of this file for a list
186256
188409
 
186257
188410
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -186511,7 +188664,7 @@ void FilteredRE2::PrintPrefilter(int regexpid) {
186511
188664
 
186512
188665
 
186513
188666
  // LICENSE_CHANGE_BEGIN
186514
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188667
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186515
188668
  // See the end of this file for a list
186516
188669
 
186517
188670
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -186707,7 +188860,7 @@ static bool CanBeEmptyString(Regexp* re) {
186707
188860
 
186708
188861
 
186709
188862
  // LICENSE_CHANGE_BEGIN
186710
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188863
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186711
188864
  // See the end of this file for a list
186712
188865
 
186713
188866
  // Copyright 2006-2007 The RE2 Authors. All Rights Reserved.
@@ -187430,7 +189583,7 @@ void Prog::Fanout(SparseArray<int>* fanout) {
187430
189583
 
187431
189584
 
187432
189585
  // LICENSE_CHANGE_BEGIN
187433
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
189586
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
187434
189587
  // See the end of this file for a list
187435
189588
 
187436
189589
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -188014,7 +190167,7 @@ fail:
188014
190167
 
188015
190168
 
188016
190169
  // LICENSE_CHANGE_BEGIN
188017
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
190170
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
188018
190171
  // See the end of this file for a list
188019
190172
 
188020
190173
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -188054,7 +190207,7 @@ fail:
188054
190207
 
188055
190208
 
188056
190209
  // LICENSE_CHANGE_BEGIN
188057
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
190210
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
188058
190211
  // See the end of this file for a list
188059
190212
 
188060
190213
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -188142,7 +190295,7 @@ extern Rune ApplyFold(const CaseFold *f, Rune r);
188142
190295
 
188143
190296
 
188144
190297
  // LICENSE_CHANGE_BEGIN
188145
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
190298
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
188146
190299
  // See the end of this file for a list
188147
190300
 
188148
190301
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -190650,7 +192803,7 @@ Regexp* Regexp::Parse(const StringPiece& s, ParseFlags global_flags,
190650
192803
 
190651
192804
 
190652
192805
  // LICENSE_CHANGE_BEGIN
190653
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
192806
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
190654
192807
  // See the end of this file for a list
190655
192808
 
190656
192809
  // GENERATED BY make_perl_groups.pl; DO NOT EDIT.
@@ -190778,7 +192931,7 @@ const int num_posix_groups = 28;
190778
192931
 
190779
192932
 
190780
192933
  // LICENSE_CHANGE_BEGIN
190781
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
192934
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
190782
192935
  // See the end of this file for a list
190783
192936
 
190784
192937
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -191479,7 +193632,7 @@ Prefilter* Prefilter::FromRE2(const RE2* re2) {
191479
193632
 
191480
193633
 
191481
193634
  // LICENSE_CHANGE_BEGIN
191482
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
193635
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
191483
193636
  // See the end of this file for a list
191484
193637
 
191485
193638
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -191890,7 +194043,7 @@ std::string PrefilterTree::DebugNodeString(Prefilter* node) const {
191890
194043
 
191891
194044
 
191892
194045
  // LICENSE_CHANGE_BEGIN
191893
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
194046
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
191894
194047
  // See the end of this file for a list
191895
194048
 
191896
194049
  // Copyright 2007 The RE2 Authors. All Rights Reserved.
@@ -191914,7 +194067,7 @@ std::string PrefilterTree::DebugNodeString(Prefilter* node) const {
191914
194067
 
191915
194068
 
191916
194069
  // LICENSE_CHANGE_BEGIN
191917
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
194070
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
191918
194071
  // See the end of this file for a list
191919
194072
 
191920
194073
  // Copyright 2016 The RE2 Authors. All Rights Reserved.
@@ -192940,7 +195093,7 @@ void Prog::ComputeHints(std::vector<Inst>* flat, int begin, int end) {
192940
195093
 
192941
195094
 
192942
195095
  // LICENSE_CHANGE_BEGIN
192943
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
195096
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
192944
195097
  // See the end of this file for a list
192945
195098
 
192946
195099
  // Copyright 2003-2009 The RE2 Authors. All Rights Reserved.
@@ -194184,7 +196337,7 @@ DEFINE_INTEGER_PARSER(ulonglong)
194184
196337
 
194185
196338
 
194186
196339
  // LICENSE_CHANGE_BEGIN
194187
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
196340
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
194188
196341
  // See the end of this file for a list
194189
196342
 
194190
196343
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -195164,7 +197317,7 @@ CharClass* CharClassBuilder::GetCharClass() {
195164
197317
 
195165
197318
 
195166
197319
  // LICENSE_CHANGE_BEGIN
195167
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
197320
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
195168
197321
  // See the end of this file for a list
195169
197322
 
195170
197323
  // Copyright 2010 The RE2 Authors. All Rights Reserved.
@@ -195174,7 +197327,7 @@ CharClass* CharClassBuilder::GetCharClass() {
195174
197327
 
195175
197328
 
195176
197329
  // LICENSE_CHANGE_BEGIN
195177
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
197330
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
195178
197331
  // See the end of this file for a list
195179
197332
 
195180
197333
  // Copyright 2010 The RE2 Authors. All Rights Reserved.
@@ -195415,7 +197568,7 @@ bool RE2::Set::Match(const StringPiece& text, std::vector<int>* v,
195415
197568
 
195416
197569
 
195417
197570
  // LICENSE_CHANGE_BEGIN
195418
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
197571
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
195419
197572
  // See the end of this file for a list
195420
197573
 
195421
197574
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -196080,7 +198233,7 @@ Regexp* SimplifyWalker::SimplifyCharClass(Regexp* re) {
196080
198233
 
196081
198234
 
196082
198235
  // LICENSE_CHANGE_BEGIN
196083
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
198236
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
196084
198237
  // See the end of this file for a list
196085
198238
 
196086
198239
  // Copyright 2004 The RE2 Authors. All Rights Reserved.
@@ -196154,7 +198307,7 @@ std::ostream& operator<<(std::ostream& o, const StringPiece& p) {
196154
198307
 
196155
198308
 
196156
198309
  // LICENSE_CHANGE_BEGIN
196157
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
198310
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
196158
198311
  // See the end of this file for a list
196159
198312
 
196160
198313
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -196512,7 +198665,7 @@ static void AppendCCRange(std::string* t, Rune lo, Rune hi) {
196512
198665
 
196513
198666
 
196514
198667
  // LICENSE_CHANGE_BEGIN
196515
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
198668
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
196516
198669
  // See the end of this file for a list
196517
198670
 
196518
198671
 
@@ -197088,7 +199241,7 @@ const int num_unicode_tolower = 194;
197088
199241
 
197089
199242
 
197090
199243
  // LICENSE_CHANGE_BEGIN
197091
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
199244
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
197092
199245
  // See the end of this file for a list
197093
199246
 
197094
199247
 
@@ -203156,7 +205309,7 @@ const int num_unicode_groups = 184;
203156
205309
 
203157
205310
 
203158
205311
  // LICENSE_CHANGE_BEGIN
203159
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
205312
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
203160
205313
  // See the end of this file for a list
203161
205314
 
203162
205315
  /*
@@ -203425,7 +205578,7 @@ utfrune(const char *s, Rune c)
203425
205578
 
203426
205579
 
203427
205580
  // LICENSE_CHANGE_BEGIN
203428
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
205581
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
203429
205582
  // See the end of this file for a list
203430
205583
 
203431
205584
  // Copyright 1999-2005 The RE2 Authors. All Rights Reserved.
@@ -203598,7 +205751,7 @@ void StringAppendF(std::string* dst, const char* format, ...) {
203598
205751
 
203599
205752
 
203600
205753
  // LICENSE_CHANGE_BEGIN
203601
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4
205754
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5
203602
205755
  // See the end of this file for a list
203603
205756
 
203604
205757
  /* hyperloglog.c - Redis HyperLogLog probabilistic cardinality approximation.
@@ -203636,7 +205789,7 @@ void StringAppendF(std::string* dst, const char* format, ...) {
203636
205789
 
203637
205790
 
203638
205791
  // LICENSE_CHANGE_BEGIN
203639
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4
205792
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5
203640
205793
  // See the end of this file for a list
203641
205794
 
203642
205795
  /* SDSLib 2.0 -- A C dynamic strings library
@@ -205140,7 +207293,7 @@ robj *hll_merge(robj **hlls, size_t hll_count) {
205140
207293
 
205141
207294
 
205142
207295
  // LICENSE_CHANGE_BEGIN
205143
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4
207296
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5
205144
207297
  // See the end of this file for a list
205145
207298
 
205146
207299
  /* SDSLib 2.0 -- A C dynamic strings library
@@ -206263,7 +208416,7 @@ void sdfree(void *ptr) { free(ptr); }
206263
208416
 
206264
208417
 
206265
208418
  // LICENSE_CHANGE_BEGIN
206266
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
208419
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #11
206267
208420
  // See the end of this file for a list
206268
208421
 
206269
208422
 
@@ -223402,7 +225555,7 @@ size_t Utf8Proc::RenderWidth(const char *s, size_t len, size_t pos) {
223402
225555
 
223403
225556
 
223404
225557
  // LICENSE_CHANGE_BEGIN
223405
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
225558
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223406
225559
  // See the end of this file for a list
223407
225560
 
223408
225561
  #include <stdexcept>
@@ -223412,7 +225565,7 @@ size_t Utf8Proc::RenderWidth(const char *s, size_t len, size_t pos) {
223412
225565
 
223413
225566
 
223414
225567
  // LICENSE_CHANGE_BEGIN
223415
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
225568
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223416
225569
  // See the end of this file for a list
223417
225570
 
223418
225571
 
@@ -223740,7 +225893,7 @@ PGNode *newNode(size_t size, PGNodeTag type) {
223740
225893
 
223741
225894
 
223742
225895
  // LICENSE_CHANGE_BEGIN
223743
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
225896
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223744
225897
  // See the end of this file for a list
223745
225898
 
223746
225899
 
@@ -223750,7 +225903,7 @@ PGNode *newNode(size_t size, PGNodeTag type) {
223750
225903
 
223751
225904
 
223752
225905
  // LICENSE_CHANGE_BEGIN
223753
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
225906
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223754
225907
  // See the end of this file for a list
223755
225908
 
223756
225909
  /*-------------------------------------------------------------------------
@@ -223789,7 +225942,7 @@ bool get_preserve_identifier_case();
223789
225942
 
223790
225943
 
223791
225944
  // LICENSE_CHANGE_BEGIN
223792
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
225945
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223793
225946
  // See the end of this file for a list
223794
225947
 
223795
225948
  /*-------------------------------------------------------------------------
@@ -223837,7 +225990,7 @@ PostgresParser::PostgresParser() : success(false), parse_tree(nullptr), error_me
223837
225990
 
223838
225991
  void PostgresParser::Parse(const string &query) {
223839
225992
  duckdb_libpgquery::pg_parser_init();
223840
- duckdb_libpgquery::parse_result res;
225993
+ duckdb_libpgquery::parse_result res;
223841
225994
  pg_parser_parse(query.c_str(), &res);
223842
225995
  success = res.success;
223843
225996
 
@@ -223879,7 +226032,7 @@ void PostgresParser::SetPreserveIdentifierCase(bool preserve) {
223879
226032
 
223880
226033
 
223881
226034
  // LICENSE_CHANGE_BEGIN
223882
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
226035
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223883
226036
  // See the end of this file for a list
223884
226037
 
223885
226038
  /*--------------------------------------------------------------------
@@ -224427,7 +226580,7 @@ int length(const PGList *list);
224427
226580
 
224428
226581
 
224429
226582
  // LICENSE_CHANGE_BEGIN
224430
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
226583
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
224431
226584
  // See the end of this file for a list
224432
226585
 
224433
226586
  /*--------------------------------------------------------------------
@@ -224468,7 +226621,7 @@ int length(const PGList *list);
224468
226621
 
224469
226622
 
224470
226623
  // LICENSE_CHANGE_BEGIN
224471
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
226624
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
224472
226625
  // See the end of this file for a list
224473
226626
 
224474
226627
  /*-------------------------------------------------------------------------
@@ -224503,7 +226656,7 @@ typedef struct PGFunctionCallInfoData *PGFunctionCallInfo;
224503
226656
 
224504
226657
 
224505
226658
  // LICENSE_CHANGE_BEGIN
224506
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
226659
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
224507
226660
  // See the end of this file for a list
224508
226661
 
224509
226662
  /*-------------------------------------------------------------------------
@@ -224581,7 +226734,7 @@ PGGroupingSet *makeGroupingSet(GroupingSetKind kind, PGList *content, int locati
224581
226734
 
224582
226735
 
224583
226736
  // LICENSE_CHANGE_BEGIN
224584
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
226737
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
224585
226738
  // See the end of this file for a list
224586
226739
 
224587
226740
  /*-------------------------------------------------------------------------
@@ -224928,7 +227081,7 @@ PGGroupingSet *makeGroupingSet(GroupingSetKind kind, PGList *content, int locati
224928
227081
 
224929
227082
 
224930
227083
  // LICENSE_CHANGE_BEGIN
224931
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
227084
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
224932
227085
  // See the end of this file for a list
224933
227086
 
224934
227087
  /*--------------------------------------------------------------------
@@ -225010,7 +227163,7 @@ PGValue *makeString(const char *str) {
225010
227163
 
225011
227164
 
225012
227165
  // LICENSE_CHANGE_BEGIN
225013
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
227166
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
225014
227167
  // See the end of this file for a list
225015
227168
 
225016
227169
  /* A Bison parser, made by GNU Bison 2.3. */
@@ -226114,7 +228267,7 @@ PGValue *makeString(const char *str) {
226114
228267
 
226115
228268
 
226116
228269
  // LICENSE_CHANGE_BEGIN
226117
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
228270
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
226118
228271
  // See the end of this file for a list
226119
228272
 
226120
228273
  /*-------------------------------------------------------------------------
@@ -226141,7 +228294,7 @@ PGValue *makeString(const char *str) {
226141
228294
 
226142
228295
 
226143
228296
  // LICENSE_CHANGE_BEGIN
226144
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
228297
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
226145
228298
  // See the end of this file for a list
226146
228299
 
226147
228300
  /*-------------------------------------------------------------------------
@@ -226279,7 +228432,7 @@ namespace duckdb_libpgquery {
226279
228432
 
226280
228433
 
226281
228434
  // LICENSE_CHANGE_BEGIN
226282
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
228435
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
226283
228436
  // See the end of this file for a list
226284
228437
 
226285
228438
  /* A Bison parser, made by GNU Bison 2.3. */
@@ -227414,7 +229567,7 @@ int base_yyparse(core_yyscan_t yyscanner);
227414
229567
 
227415
229568
 
227416
229569
  // LICENSE_CHANGE_BEGIN
227417
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
229570
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
227418
229571
  // See the end of this file for a list
227419
229572
 
227420
229573
  /*-------------------------------------------------------------------------
@@ -227438,7 +229591,7 @@ int base_yyparse(core_yyscan_t yyscanner);
227438
229591
 
227439
229592
 
227440
229593
  // LICENSE_CHANGE_BEGIN
227441
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
229594
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
227442
229595
  // See the end of this file for a list
227443
229596
 
227444
229597
  /*-------------------------------------------------------------------------
@@ -227458,7 +229611,7 @@ int base_yyparse(core_yyscan_t yyscanner);
227458
229611
 
227459
229612
 
227460
229613
  // LICENSE_CHANGE_BEGIN
227461
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
229614
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
227462
229615
  // See the end of this file for a list
227463
229616
 
227464
229617
  /*-------------------------------------------------------------------------
@@ -227519,7 +229672,7 @@ typedef struct {
227519
229672
 
227520
229673
 
227521
229674
  // LICENSE_CHANGE_BEGIN
227522
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
229675
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
227523
229676
  // See the end of this file for a list
227524
229677
 
227525
229678
  /*-------------------------------------------------------------------------
@@ -252437,7 +254590,7 @@ parser_init(base_yy_extra_type *yyext)
252437
254590
 
252438
254591
 
252439
254592
  // LICENSE_CHANGE_BEGIN
252440
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
254593
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
252441
254594
  // See the end of this file for a list
252442
254595
 
252443
254596
  /*--------------------------------------------------------------------
@@ -252476,7 +254629,7 @@ parser_init(base_yy_extra_type *yyext)
252476
254629
 
252477
254630
 
252478
254631
  // LICENSE_CHANGE_BEGIN
252479
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
254632
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
252480
254633
  // See the end of this file for a list
252481
254634
 
252482
254635
 
@@ -253208,7 +255361,7 @@ int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner) {
253208
255361
 
253209
255362
 
253210
255363
  // LICENSE_CHANGE_BEGIN
253211
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
255364
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
253212
255365
  // See the end of this file for a list
253213
255366
 
253214
255367
  #line 2 "third_party/libpg_query/src_backend_parser_scan.cpp"
@@ -253253,7 +255406,7 @@ int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner) {
253253
255406
 
253254
255407
 
253255
255408
  // LICENSE_CHANGE_BEGIN
253256
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
255409
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
253257
255410
  // See the end of this file for a list
253258
255411
 
253259
255412
  /*-------------------------------------------------------------------------
@@ -257345,7 +259498,7 @@ core_yyfree(void *ptr, core_yyscan_t yyscanner)
257345
259498
 
257346
259499
 
257347
259500
  // LICENSE_CHANGE_BEGIN
257348
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
259501
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
257349
259502
  // See the end of this file for a list
257350
259503
 
257351
259504
  /*--------------------------------------------------------------------
@@ -257477,7 +259630,7 @@ bool scanner_isspace(char ch) {
257477
259630
 
257478
259631
 
257479
259632
  // LICENSE_CHANGE_BEGIN
257480
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
259633
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
257481
259634
  // See the end of this file for a list
257482
259635
 
257483
259636
  /*--------------------------------------------------------------------
@@ -257741,6 +259894,34 @@ THE SOFTWARE.
257741
259894
 
257742
259895
  ### THIRD PARTY LICENSE #4 ###
257743
259896
 
259897
+ Permission is hereby granted, free of charge, to any
259898
+ person obtaining a copy of this software and associated
259899
+ documentation files (the "Software"), to deal in the
259900
+ Software without restriction, including without
259901
+ limitation the rights to use, copy, modify, merge,
259902
+ publish, distribute, sublicense, and/or sell copies of
259903
+ the Software, and to permit persons to whom the Software
259904
+ is furnished to do so, subject to the following
259905
+ conditions:
259906
+
259907
+ The above copyright notice and this permission notice
259908
+ shall be included in all copies or substantial portions
259909
+ of the Software.
259910
+
259911
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
259912
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
259913
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
259914
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
259915
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
259916
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
259917
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
259918
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
259919
+ DEALINGS IN THE SOFTWARE.
259920
+
259921
+
259922
+
259923
+ ### THIRD PARTY LICENSE #5 ###
259924
+
257744
259925
  Copyright (c) 2012 Art.sy, Inc.
257745
259926
 
257746
259927
  Permission is hereby granted, free of charge, to any person obtaining a copy of
@@ -257762,7 +259943,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
257762
259943
  SOFTWARE.
257763
259944
 
257764
259945
 
257765
- ### THIRD PARTY LICENSE #5 ###
259946
+ ### THIRD PARTY LICENSE #6 ###
257766
259947
 
257767
259948
  Apache License
257768
259949
  Version 2.0, January 2004
@@ -257967,7 +260148,7 @@ SOFTWARE.
257967
260148
  limitations under the License.
257968
260149
 
257969
260150
 
257970
- ### THIRD PARTY LICENSE #6 ###
260151
+ ### THIRD PARTY LICENSE #7 ###
257971
260152
 
257972
260153
  // Copyright (c) 2009 The RE2 Authors. All rights reserved.
257973
260154
  //
@@ -257999,7 +260180,7 @@ SOFTWARE.
257999
260180
 
258000
260181
 
258001
260182
 
258002
- ### THIRD PARTY LICENSE #7 ###
260183
+ ### THIRD PARTY LICENSE #8 ###
258003
260184
 
258004
260185
  The MIT License (MIT)
258005
260186
 
@@ -258026,7 +260207,7 @@ SOFTWARE.
258026
260207
 
258027
260208
 
258028
260209
 
258029
- ### THIRD PARTY LICENSE #8 ###
260210
+ ### THIRD PARTY LICENSE #9 ###
258030
260211
 
258031
260212
  This license file applies to everything in this repository except that which
258032
260213
  is explicitly annotated as being written by other authors, i.e. the Boost
@@ -258092,7 +260273,7 @@ DEALINGS IN THE SOFTWARE.
258092
260273
 
258093
260274
 
258094
260275
 
258095
- ### THIRD PARTY LICENSE #9 ###
260276
+ ### THIRD PARTY LICENSE #10 ###
258096
260277
 
258097
260278
  Copyright (c) 2015, Lukas Fittl <lukas@fittl.com>
258098
260279
  All rights reserved.
@@ -258124,7 +260305,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
258124
260305
  POSSIBILITY OF SUCH DAMAGE.
258125
260306
 
258126
260307
 
258127
- ### THIRD PARTY LICENSE #10 ###
260308
+ ### THIRD PARTY LICENSE #11 ###
258128
260309
 
258129
260310
  Apache License
258130
260311
  Version 2.0, January 2004