duckdb 0.3.3-dev255.0 → 0.3.3-dev286.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
  /*
@@ -85355,8 +87731,8 @@ static unique_ptr<BaseStatistics> CaseConvertPropagateStats(ClientContext &conte
85355
87731
  }
85356
87732
 
85357
87733
  ScalarFunction LowerFun::GetFunction() {
85358
- return ScalarFunction({LogicalType::VARCHAR}, LogicalType::VARCHAR, CaseConvertFunction<false>, false, nullptr,
85359
- nullptr, CaseConvertPropagateStats<false>);
87734
+ return ScalarFunction("lower", {LogicalType::VARCHAR}, LogicalType::VARCHAR, CaseConvertFunction<false>, false,
87735
+ nullptr, nullptr, CaseConvertPropagateStats<false>);
85360
87736
  }
85361
87737
 
85362
87738
  void LowerFun::RegisterFunction(BuiltinFunctions &set) {
@@ -87256,7 +89632,7 @@ void PrintfFun::RegisterFunction(BuiltinFunctions &set) {
87256
89632
 
87257
89633
 
87258
89634
  // LICENSE_CHANGE_BEGIN
87259
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
89635
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
87260
89636
  // See the end of this file for a list
87261
89637
 
87262
89638
  // Copyright 2003-2009 The RE2 Authors. All Rights Reserved.
@@ -87460,7 +89836,7 @@ void PrintfFun::RegisterFunction(BuiltinFunctions &set) {
87460
89836
 
87461
89837
 
87462
89838
  // LICENSE_CHANGE_BEGIN
87463
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
89839
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
87464
89840
  // See the end of this file for a list
87465
89841
 
87466
89842
  // Copyright 2001-2010 The RE2 Authors. All Rights Reserved.
@@ -100264,7 +102640,7 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query,
100264
102640
  D_ASSERT(orig_expr_list.size() == de_expr_list.size() && cp_expr_list.size() == de_expr_list.size());
100265
102641
  for (idx_t i = 0; i < orig_expr_list.size(); i++) {
100266
102642
  // run the ToString, to verify that it doesn't crash
100267
- orig_expr_list[i]->ToString();
102643
+ auto str = orig_expr_list[i]->ToString();
100268
102644
  // check that the expressions are equivalent
100269
102645
  D_ASSERT(orig_expr_list[i]->Equals(de_expr_list[i].get()));
100270
102646
  D_ASSERT(orig_expr_list[i]->Equals(cp_expr_list[i].get()));
@@ -100274,6 +102650,17 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query,
100274
102650
  D_ASSERT(orig_expr_list[i]->Hash() == cp_expr_list[i]->Hash());
100275
102651
 
100276
102652
  D_ASSERT(!orig_expr_list[i]->Equals(nullptr));
102653
+ orig_expr_list[i]->Verify();
102654
+ de_expr_list[i]->Verify();
102655
+ cp_expr_list[i]->Verify();
102656
+
102657
+ // ToString round trip
102658
+ if (orig_expr_list[i]->HasSubquery()) {
102659
+ continue;
102660
+ }
102661
+ auto parsed_list = Parser::ParseExpressionList(str);
102662
+ D_ASSERT(parsed_list.size() == 1);
102663
+ D_ASSERT(parsed_list[0]->Equals(orig_expr_list[i].get()));
100277
102664
  }
100278
102665
  // now perform additional checking within the expressions
100279
102666
  for (idx_t outer_idx = 0; outer_idx < orig_expr_list.size(); outer_idx++) {
@@ -101976,7 +104363,7 @@ ExtensionLoadResult ExtensionHelper::LoadExtensionInternal(DuckDB &db, const std
101976
104363
 
101977
104364
 
101978
104365
  // LICENSE_CHANGE_BEGIN
101979
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
104366
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #8
101980
104367
  // See the end of this file for a list
101981
104368
 
101982
104369
  //
@@ -124328,7 +126715,7 @@ void PipelineFinishEvent::FinishEvent() {
124328
126715
 
124329
126716
 
124330
126717
  // LICENSE_CHANGE_BEGIN
124331
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #8
126718
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
124332
126719
  // See the end of this file for a list
124333
126720
 
124334
126721
  // Provides a C++11 implementation of a multi-producer, multi-consumer lock-free queue.
@@ -128005,7 +130392,7 @@ inline void swap(typename ConcurrentQueue<T, Traits>::ImplicitProducerKVP& a, ty
128005
130392
 
128006
130393
 
128007
130394
  // LICENSE_CHANGE_BEGIN
128008
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #8
130395
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
128009
130396
  // See the end of this file for a list
128010
130397
 
128011
130398
  // Provides an efficient implementation of a semaphore (LightweightSemaphore).
@@ -128667,6 +131054,9 @@ bool BaseExpression::Equals(const BaseExpression *other) const {
128667
131054
  return true;
128668
131055
  }
128669
131056
 
131057
+ void BaseExpression::Verify() const {
131058
+ }
131059
+
128670
131060
  } // namespace duckdb
128671
131061
 
128672
131062
 
@@ -128886,7 +131276,7 @@ BetweenExpression::BetweenExpression(unique_ptr<ParsedExpression> input_p, uniqu
128886
131276
  }
128887
131277
 
128888
131278
  string BetweenExpression::ToString() const {
128889
- return input->ToString() + " BETWEEN " + lower->ToString() + " AND " + upper->ToString();
131279
+ return ToString<BetweenExpression, ParsedExpression>(*this);
128890
131280
  }
128891
131281
 
128892
131282
  bool BetweenExpression::Equals(const BetweenExpression *a, const BetweenExpression *b) {
@@ -128932,13 +131322,7 @@ CaseExpression::CaseExpression() : ParsedExpression(ExpressionType::CASE_EXPR, E
128932
131322
  }
128933
131323
 
128934
131324
  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;
131325
+ return ToString<CaseExpression, ParsedExpression>(*this);
128942
131326
  }
128943
131327
 
128944
131328
  bool CaseExpression::Equals(const CaseExpression *a, const CaseExpression *b) {
@@ -129014,7 +131398,7 @@ CastExpression::CastExpression(LogicalType target, unique_ptr<ParsedExpression>
129014
131398
  }
129015
131399
 
129016
131400
  string CastExpression::ToString() const {
129017
- return (try_cast ? "TRY_CAST(" : "CAST(") + child->ToString() + " AS " + cast_type.ToString() + ")";
131401
+ return ToString<CastExpression, ParsedExpression>(*this);
129018
131402
  }
129019
131403
 
129020
131404
  bool CastExpression::Equals(const CastExpression *a, const CastExpression *b) {
@@ -129064,7 +131448,7 @@ CollateExpression::CollateExpression(string collation_p, unique_ptr<ParsedExpres
129064
131448
  }
129065
131449
 
129066
131450
  string CollateExpression::ToString() const {
129067
- return "COLLATE(" + child->ToString() + ")";
131451
+ return child->ToString() + " COLLATE " + collation;
129068
131452
  }
129069
131453
 
129070
131454
  bool CollateExpression::Equals(const CollateExpression *a, const CollateExpression *b) {
@@ -129101,6 +131485,7 @@ unique_ptr<ParsedExpression> CollateExpression::Deserialize(ExpressionType type,
129101
131485
 
129102
131486
 
129103
131487
 
131488
+
129104
131489
  namespace duckdb {
129105
131490
 
129106
131491
  ColumnRefExpression::ColumnRefExpression(string column_name, string table_name)
@@ -129144,7 +131529,7 @@ string ColumnRefExpression::ToString() const {
129144
131529
  if (i > 0) {
129145
131530
  result += ".";
129146
131531
  }
129147
- result += column_names[i];
131532
+ result += KeywordHelper::WriteOptionallyQuoted(column_names[i]);
129148
131533
  }
129149
131534
  return result;
129150
131535
  }
@@ -129205,7 +131590,7 @@ ComparisonExpression::ComparisonExpression(ExpressionType type, unique_ptr<Parse
129205
131590
  }
129206
131591
 
129207
131592
  string ComparisonExpression::ToString() const {
129208
- return left->ToString() + ExpressionTypeToOperator(type) + right->ToString();
131593
+ return ToString<ComparisonExpression, ParsedExpression>(*this);
129209
131594
  }
129210
131595
 
129211
131596
  bool ComparisonExpression::Equals(const ComparisonExpression *a, const ComparisonExpression *b) {
@@ -129239,41 +131624,6 @@ unique_ptr<ParsedExpression> ComparisonExpression::Deserialize(ExpressionType ty
129239
131624
 
129240
131625
 
129241
131626
 
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
131627
 
129278
131628
 
129279
131629
  namespace duckdb {
@@ -129309,11 +131659,7 @@ void ConjunctionExpression::AddExpression(unique_ptr<ParsedExpression> expr) {
129309
131659
  }
129310
131660
 
129311
131661
  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;
131662
+ return ToString<ConjunctionExpression, ParsedExpression>(*this);
129317
131663
  }
129318
131664
 
129319
131665
  bool ConjunctionExpression::Equals(const ConjunctionExpression *a, const ConjunctionExpression *b) {
@@ -129355,7 +131701,7 @@ ConstantExpression::ConstantExpression(Value val)
129355
131701
  }
129356
131702
 
129357
131703
  string ConstantExpression::ToString() const {
129358
- return value.ToString();
131704
+ return value.ToSQLString();
129359
131705
  }
129360
131706
 
129361
131707
  bool ConstantExpression::Equals(const ConstantExpression *a, const ConstantExpression *b) {
@@ -129426,6 +131772,7 @@ FunctionExpression::FunctionExpression(string schema, const string &function_nam
129426
131772
  : ParsedExpression(ExpressionType::FUNCTION, ExpressionClass::FUNCTION), schema(std::move(schema)),
129427
131773
  function_name(StringUtil::Lower(function_name)), is_operator(is_operator), children(move(children_p)),
129428
131774
  distinct(distinct), filter(move(filter)), order_bys(move(order_bys_p)), export_state(export_state_p) {
131775
+ D_ASSERT(!function_name.empty());
129429
131776
  if (!order_bys) {
129430
131777
  order_bys = make_unique<OrderModifier>();
129431
131778
  }
@@ -129439,35 +131786,8 @@ FunctionExpression::FunctionExpression(const string &function_name, vector<uniqu
129439
131786
  }
129440
131787
 
129441
131788
  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 + ")";
131789
+ return ToString<FunctionExpression, ParsedExpression>(*this, schema, function_name, is_operator, distinct,
131790
+ filter.get(), order_bys.get(), export_state);
129471
131791
  }
129472
131792
 
129473
131793
  bool FunctionExpression::Equals(const FunctionExpression *a, const FunctionExpression *b) {
@@ -129552,6 +131872,10 @@ unique_ptr<ParsedExpression> FunctionExpression::Deserialize(ExpressionType type
129552
131872
  return move(function);
129553
131873
  }
129554
131874
 
131875
+ void FunctionExpression::Verify() const {
131876
+ D_ASSERT(!function_name.empty());
131877
+ }
131878
+
129555
131879
  } // namespace duckdb
129556
131880
 
129557
131881
 
@@ -129620,7 +131944,6 @@ unique_ptr<ParsedExpression> LambdaExpression::Deserialize(ExpressionType type,
129620
131944
 
129621
131945
 
129622
131946
 
129623
-
129624
131947
  namespace duckdb {
129625
131948
 
129626
131949
  OperatorExpression::OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
@@ -129639,21 +131962,7 @@ OperatorExpression::OperatorExpression(ExpressionType type, vector<unique_ptr<Pa
129639
131962
  }
129640
131963
 
129641
131964
  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;
131965
+ return ToString<OperatorExpression, ParsedExpression>(*this);
129657
131966
  }
129658
131967
 
129659
131968
  bool OperatorExpression::Equals(const OperatorExpression *a, const OperatorExpression *b) {
@@ -129785,7 +132094,7 @@ StarExpression::StarExpression(string relation_name_p)
129785
132094
  string StarExpression::ToString() const {
129786
132095
  string result = relation_name.empty() ? "*" : relation_name + ".*";
129787
132096
  if (!exclude_list.empty()) {
129788
- result += " EXCEPT (";
132097
+ result += " EXCLUDE (";
129789
132098
  bool first_entry = true;
129790
132099
  for (auto &entry : exclude_list) {
129791
132100
  if (!first_entry) {
@@ -129803,9 +132112,9 @@ string StarExpression::ToString() const {
129803
132112
  if (!first_entry) {
129804
132113
  result += ", ";
129805
132114
  }
129806
- result += entry.first;
129807
- result += " AS ";
129808
132115
  result += entry.second->ToString();
132116
+ result += " AS ";
132117
+ result += entry.first;
129809
132118
  first_entry = false;
129810
132119
  }
129811
132120
  result += ")";
@@ -129972,125 +132281,8 @@ WindowExpression::WindowExpression(ExpressionType type, string schema, const str
129972
132281
  }
129973
132282
  }
129974
132283
 
129975
- string WindowExpression::GetName() const {
129976
- return !alias.empty() ? alias : function_name;
129977
- }
129978
-
129979
132284
  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;
132285
+ return ToString<WindowExpression, ParsedExpression, OrderByNode>(*this, schema, function_name);
130094
132286
  }
130095
132287
 
130096
132288
  bool WindowExpression::Equals(const WindowExpression *a, const WindowExpression *b) {
@@ -131171,7 +133363,7 @@ void ParsedExpressionIterator::EnumerateQueryNodeChildren(
131171
133363
 
131172
133364
 
131173
133365
  // LICENSE_CHANGE_BEGIN
131174
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133366
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131175
133367
  // See the end of this file for a list
131176
133368
 
131177
133369
  // 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 +133475,7 @@ typedef enum PGPostgresAttributIdentityTypes {
131283
133475
 
131284
133476
 
131285
133477
  // LICENSE_CHANGE_BEGIN
131286
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133478
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131287
133479
  // See the end of this file for a list
131288
133480
 
131289
133481
  /*-------------------------------------------------------------------------
@@ -131312,7 +133504,7 @@ typedef enum PGPostgresAttributIdentityTypes {
131312
133504
 
131313
133505
 
131314
133506
  // LICENSE_CHANGE_BEGIN
131315
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133507
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131316
133508
  // See the end of this file for a list
131317
133509
 
131318
133510
  /*-------------------------------------------------------------------------
@@ -131423,7 +133615,7 @@ uint32_t bms_hash_value(const PGBitmapset *a);
131423
133615
 
131424
133616
 
131425
133617
  // LICENSE_CHANGE_BEGIN
131426
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133618
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131427
133619
  // See the end of this file for a list
131428
133620
 
131429
133621
  /*-------------------------------------------------------------------------
@@ -131476,7 +133668,7 @@ typedef enum PGLockWaitPolicy {
131476
133668
 
131477
133669
 
131478
133670
  // LICENSE_CHANGE_BEGIN
131479
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133671
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131480
133672
  // See the end of this file for a list
131481
133673
 
131482
133674
  /*-------------------------------------------------------------------------
@@ -131500,7 +133692,7 @@ typedef enum PGLockWaitPolicy {
131500
133692
 
131501
133693
 
131502
133694
  // LICENSE_CHANGE_BEGIN
131503
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133695
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131504
133696
  // See the end of this file for a list
131505
133697
 
131506
133698
  /*-------------------------------------------------------------------------
@@ -131573,7 +133765,7 @@ typedef int16_t PGAttrNumber;
131573
133765
 
131574
133766
 
131575
133767
  // LICENSE_CHANGE_BEGIN
131576
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133768
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131577
133769
  // See the end of this file for a list
131578
133770
 
131579
133771
  /*-------------------------------------------------------------------------
@@ -131617,7 +133809,7 @@ typedef int16_t PGAttrNumber;
131617
133809
 
131618
133810
 
131619
133811
  // LICENSE_CHANGE_BEGIN
131620
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
133812
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
131621
133813
  // See the end of this file for a list
131622
133814
 
131623
133815
  /*-------------------------------------------------------------------------
@@ -134074,7 +136266,7 @@ typedef struct PGOnConflictExpr {
134074
136266
 
134075
136267
 
134076
136268
  // LICENSE_CHANGE_BEGIN
134077
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
136269
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
134078
136270
  // See the end of this file for a list
134079
136271
 
134080
136272
  /*-------------------------------------------------------------------------
@@ -136414,7 +138606,7 @@ private:
136414
138606
 
136415
138607
 
136416
138608
  // LICENSE_CHANGE_BEGIN
136417
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
138609
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
136418
138610
  // See the end of this file for a list
136419
138611
 
136420
138612
  //===----------------------------------------------------------------------===//
@@ -136433,7 +138625,7 @@ private:
136433
138625
 
136434
138626
 
136435
138627
  // LICENSE_CHANGE_BEGIN
136436
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
138628
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
136437
138629
  // See the end of this file for a list
136438
138630
 
136439
138631
 
@@ -136505,7 +138697,7 @@ public:
136505
138697
 
136506
138698
 
136507
138699
  // LICENSE_CHANGE_BEGIN
136508
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
138700
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
136509
138701
  // See the end of this file for a list
136510
138702
 
136511
138703
  /*-------------------------------------------------------------------------
@@ -139033,7 +141225,6 @@ unique_ptr<ParsedExpression> Transformer::TransformFuncCall(duckdb_libpgquery::P
139033
141225
  function_name = reinterpret_cast<duckdb_libpgquery::PGValue *>(name->head->next->data.ptr_value)->val.str;
139034
141226
  } else {
139035
141227
  // unqualified name
139036
- // schema = DEFAULT_SCHEMA;
139037
141228
  schema = INVALID_SCHEMA;
139038
141229
  function_name = reinterpret_cast<duckdb_libpgquery::PGValue *>(name->head->data.ptr_value)->val.str;
139039
141230
  }
@@ -142150,6 +144341,7 @@ unique_ptr<LoadStatement> Transformer::TransformLoad(duckdb_libpgquery::PGNode *
142150
144341
 
142151
144342
 
142152
144343
 
144344
+
142153
144345
  namespace duckdb {
142154
144346
 
142155
144347
  unique_ptr<SQLStatement> Transformer::TransformPragma(duckdb_libpgquery::PGNode *node) {
@@ -142167,7 +144359,15 @@ unique_ptr<SQLStatement> Transformer::TransformPragma(duckdb_libpgquery::PGNode
142167
144359
 
142168
144360
  if (expr->type == ExpressionType::COMPARE_EQUAL) {
142169
144361
  auto &comp = (ComparisonExpression &)*expr;
142170
- info.named_parameters[comp.left->ToString()] = Value(comp.right->ToString());
144362
+ if (comp.right->type != ExpressionType::VALUE_CONSTANT) {
144363
+ throw ParserException("Named parameter requires a constant on the RHS");
144364
+ }
144365
+ if (comp.left->type != ExpressionType::COLUMN_REF) {
144366
+ throw ParserException("Named parameter requires a column reference on the LHS");
144367
+ }
144368
+ auto &columnref = (ColumnRefExpression &)*comp.left;
144369
+ auto &constant = (ConstantExpression &)*comp.right;
144370
+ info.named_parameters[columnref.GetName()] = constant.value;
142171
144371
  } else if (node->type == duckdb_libpgquery::T_PGAConst) {
142172
144372
  auto constant = TransformConstant((duckdb_libpgquery::PGAConst *)node);
142173
144373
  info.parameters.push_back(((ConstantExpression &)*constant).value);
@@ -145156,6 +147356,8 @@ static LogicalType BindRangeExpression(ClientContext &context, const string &nam
145156
147356
  }
145157
147357
 
145158
147358
  BindResult SelectBinder::BindWindow(WindowExpression &window, idx_t depth) {
147359
+ auto name = window.GetName();
147360
+
145159
147361
  QueryErrorContext error_context(binder.root_statement, window.query_location);
145160
147362
  if (inside_window) {
145161
147363
  throw BinderException(error_context.FormatError("window function calls cannot be nested"));
@@ -145323,7 +147525,7 @@ BindResult SelectBinder::BindWindow(WindowExpression &window, idx_t depth) {
145323
147525
  result->end = window.end;
145324
147526
 
145325
147527
  // create a BoundColumnRef that references this entry
145326
- auto colref = make_unique<BoundColumnRefExpression>(window.GetName(), result->return_type,
147528
+ auto colref = make_unique<BoundColumnRefExpression>(move(name), result->return_type,
145327
147529
  ColumnBinding(node.window_index, node.windows.size()), depth);
145328
147530
  // move the WINDOW expression into the set of bound windows
145329
147531
  node.windows.push_back(move(result));
@@ -150301,7 +152503,70 @@ string Binder::FormatErrorRecursive(idx_t query_location, const string &message,
150301
152503
  } // namespace duckdb
150302
152504
 
150303
152505
 
152506
+ namespace duckdb {
150304
152507
 
152508
+ BoundResultModifier::BoundResultModifier(ResultModifierType type) : type(type) {
152509
+ }
152510
+
152511
+ BoundResultModifier::~BoundResultModifier() {
152512
+ }
152513
+
152514
+ BoundOrderByNode::BoundOrderByNode(OrderType type, OrderByNullType null_order, unique_ptr<Expression> expression)
152515
+ : type(type), null_order(null_order), expression(move(expression)) {
152516
+ }
152517
+ BoundOrderByNode::BoundOrderByNode(OrderType type, OrderByNullType null_order, unique_ptr<Expression> expression,
152518
+ unique_ptr<BaseStatistics> stats)
152519
+ : type(type), null_order(null_order), expression(move(expression)), stats(move(stats)) {
152520
+ }
152521
+
152522
+ BoundOrderByNode BoundOrderByNode::Copy() const {
152523
+ if (stats) {
152524
+ return BoundOrderByNode(type, null_order, expression->Copy(), stats->Copy());
152525
+ } else {
152526
+ return BoundOrderByNode(type, null_order, expression->Copy());
152527
+ }
152528
+ }
152529
+
152530
+ string BoundOrderByNode::ToString() const {
152531
+ auto str = expression->ToString();
152532
+ switch (type) {
152533
+ case OrderType::ASCENDING:
152534
+ str += " ASC";
152535
+ break;
152536
+ case OrderType::DESCENDING:
152537
+ str += " DESC";
152538
+ break;
152539
+ default:
152540
+ break;
152541
+ }
152542
+
152543
+ switch (null_order) {
152544
+ case OrderByNullType::NULLS_FIRST:
152545
+ str += " NULLS FIRST";
152546
+ break;
152547
+ case OrderByNullType::NULLS_LAST:
152548
+ str += " NULLS LAST";
152549
+ break;
152550
+ default:
152551
+ break;
152552
+ }
152553
+ return str;
152554
+ }
152555
+
152556
+ BoundLimitModifier::BoundLimitModifier() : BoundResultModifier(ResultModifierType::LIMIT_MODIFIER) {
152557
+ }
152558
+
152559
+ BoundOrderModifier::BoundOrderModifier() : BoundResultModifier(ResultModifierType::ORDER_MODIFIER) {
152560
+ }
152561
+
152562
+ BoundDistinctModifier::BoundDistinctModifier() : BoundResultModifier(ResultModifierType::DISTINCT_MODIFIER) {
152563
+ }
152564
+
152565
+ BoundLimitPercentModifier::BoundLimitPercentModifier()
152566
+ : BoundResultModifier(ResultModifierType::LIMIT_PERCENT_MODIFIER) {
152567
+ }
152568
+
152569
+ } // namespace duckdb
150305
152570
 
150306
152571
 
150307
152572
 
@@ -150317,17 +152582,12 @@ BoundAggregateExpression::BoundAggregateExpression(AggregateFunction function, v
150317
152582
  : Expression(ExpressionType::BOUND_AGGREGATE, ExpressionClass::BOUND_AGGREGATE, function.return_type),
150318
152583
  function(move(function)), children(move(children)), bind_info(move(bind_info)), distinct(distinct),
150319
152584
  filter(move(filter)) {
152585
+ D_ASSERT(!function.name.empty());
150320
152586
  }
150321
152587
 
150322
152588
  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;
152589
+ return FunctionExpression::ToString<BoundAggregateExpression, Expression>(*this, string(), function.name, false,
152590
+ distinct, filter.get());
150331
152591
  }
150332
152592
 
150333
152593
  hash_t BoundAggregateExpression::Hash() const {
@@ -150381,6 +152641,7 @@ unique_ptr<Expression> BoundAggregateExpression::Copy() {
150381
152641
  } // namespace duckdb
150382
152642
 
150383
152643
 
152644
+
150384
152645
  namespace duckdb {
150385
152646
 
150386
152647
  BoundBetweenExpression::BoundBetweenExpression(unique_ptr<Expression> input, unique_ptr<Expression> lower,
@@ -150391,7 +152652,7 @@ BoundBetweenExpression::BoundBetweenExpression(unique_ptr<Expression> input, uni
150391
152652
  }
150392
152653
 
150393
152654
  string BoundBetweenExpression::ToString() const {
150394
- return input->ToString() + " BETWEEN " + lower->ToString() + " AND " + upper->ToString();
152655
+ return BetweenExpression::ToString<BoundBetweenExpression, Expression>(*this);
150395
152656
  }
150396
152657
 
150397
152658
  bool BoundBetweenExpression::Equals(const BaseExpression *other_p) const {
@@ -150421,6 +152682,7 @@ unique_ptr<Expression> BoundBetweenExpression::Copy() {
150421
152682
  } // namespace duckdb
150422
152683
 
150423
152684
 
152685
+
150424
152686
  namespace duckdb {
150425
152687
 
150426
152688
  BoundCaseExpression::BoundCaseExpression(LogicalType type)
@@ -150438,13 +152700,7 @@ BoundCaseExpression::BoundCaseExpression(unique_ptr<Expression> when_expr, uniqu
150438
152700
  }
150439
152701
 
150440
152702
  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;
152703
+ return CaseExpression::ToString<BoundCaseExpression, Expression>(*this);
150448
152704
  }
150449
152705
 
150450
152706
  bool BoundCaseExpression::Equals(const BaseExpression *other_p) const {
@@ -150618,10 +152874,10 @@ unique_ptr<Expression> BoundCastExpression::Copy() {
150618
152874
 
150619
152875
  namespace duckdb {
150620
152876
 
150621
- BoundColumnRefExpression::BoundColumnRefExpression(string alias, LogicalType type, ColumnBinding binding, idx_t depth)
152877
+ BoundColumnRefExpression::BoundColumnRefExpression(string alias_p, LogicalType type, ColumnBinding binding, idx_t depth)
150622
152878
  : Expression(ExpressionType::BOUND_COLUMN_REF, ExpressionClass::BOUND_COLUMN_REF, move(type)), binding(binding),
150623
152879
  depth(depth) {
150624
- this->alias = move(alias);
152880
+ this->alias = move(alias_p);
150625
152881
  }
150626
152882
 
150627
152883
  BoundColumnRefExpression::BoundColumnRefExpression(LogicalType type, ColumnBinding binding, idx_t depth)
@@ -150648,12 +152904,16 @@ bool BoundColumnRefExpression::Equals(const BaseExpression *other_p) const {
150648
152904
  }
150649
152905
 
150650
152906
  string BoundColumnRefExpression::ToString() const {
152907
+ if (!alias.empty()) {
152908
+ return alias;
152909
+ }
150651
152910
  return "#[" + to_string(binding.table_index) + "." + to_string(binding.column_index) + "]";
150652
152911
  }
150653
152912
 
150654
152913
  } // namespace duckdb
150655
152914
 
150656
152915
 
152916
+
150657
152917
  namespace duckdb {
150658
152918
 
150659
152919
  BoundComparisonExpression::BoundComparisonExpression(ExpressionType type, unique_ptr<Expression> left,
@@ -150662,7 +152922,7 @@ BoundComparisonExpression::BoundComparisonExpression(ExpressionType type, unique
150662
152922
  }
150663
152923
 
150664
152924
  string BoundComparisonExpression::ToString() const {
150665
- return left->GetName() + ExpressionTypeToOperator(type) + right->GetName();
152925
+ return ComparisonExpression::ToString<BoundComparisonExpression, Expression>(*this);
150666
152926
  }
150667
152927
 
150668
152928
  bool BoundComparisonExpression::Equals(const BaseExpression *other_p) const {
@@ -150689,6 +152949,7 @@ unique_ptr<Expression> BoundComparisonExpression::Copy() {
150689
152949
 
150690
152950
 
150691
152951
 
152952
+
150692
152953
  namespace duckdb {
150693
152954
 
150694
152955
  BoundConjunctionExpression::BoundConjunctionExpression(ExpressionType type)
@@ -150703,11 +152964,7 @@ BoundConjunctionExpression::BoundConjunctionExpression(ExpressionType type, uniq
150703
152964
  }
150704
152965
 
150705
152966
  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 + ")";
152967
+ return ConjunctionExpression::ToString<BoundConjunctionExpression, Expression>(*this);
150711
152968
  }
150712
152969
 
150713
152970
  bool BoundConjunctionExpression::Equals(const BaseExpression *other_p) const {
@@ -150741,7 +152998,7 @@ BoundConstantExpression::BoundConstantExpression(Value value_p)
150741
152998
  }
150742
152999
 
150743
153000
  string BoundConstantExpression::ToString() const {
150744
- return value.ToString();
153001
+ return value.ToSQLString();
150745
153002
  }
150746
153003
 
150747
153004
  bool BoundConstantExpression::Equals(const BaseExpression *other_p) const {
@@ -150770,7 +153027,6 @@ unique_ptr<Expression> BoundConstantExpression::Copy() {
150770
153027
 
150771
153028
 
150772
153029
 
150773
-
150774
153030
  namespace duckdb {
150775
153031
 
150776
153032
  BoundFunctionExpression::BoundFunctionExpression(LogicalType return_type, ScalarFunction bound_function,
@@ -150778,6 +153034,7 @@ BoundFunctionExpression::BoundFunctionExpression(LogicalType return_type, Scalar
150778
153034
  unique_ptr<FunctionData> bind_info, bool is_operator)
150779
153035
  : Expression(ExpressionType::BOUND_FUNCTION, ExpressionClass::BOUND_FUNCTION, move(return_type)),
150780
153036
  function(move(bound_function)), children(move(arguments)), bind_info(move(bind_info)), is_operator(is_operator) {
153037
+ D_ASSERT(!function.name.empty());
150781
153038
  }
150782
153039
 
150783
153040
  bool BoundFunctionExpression::HasSideEffects() const {
@@ -150790,11 +153047,8 @@ bool BoundFunctionExpression::IsFoldable() const {
150790
153047
  }
150791
153048
 
150792
153049
  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;
153050
+ return FunctionExpression::ToString<BoundFunctionExpression, Expression>(*this, string(), function.name,
153051
+ is_operator);
150798
153052
  }
150799
153053
 
150800
153054
  hash_t BoundFunctionExpression::Hash() const {
@@ -150832,11 +153086,16 @@ unique_ptr<Expression> BoundFunctionExpression::Copy() {
150832
153086
  return move(copy);
150833
153087
  }
150834
153088
 
153089
+ void BoundFunctionExpression::Verify() const {
153090
+ D_ASSERT(!function.name.empty());
153091
+ }
153092
+
150835
153093
  } // namespace duckdb
150836
153094
 
150837
153095
 
150838
153096
 
150839
153097
 
153098
+
150840
153099
  namespace duckdb {
150841
153100
 
150842
153101
  BoundOperatorExpression::BoundOperatorExpression(ExpressionType type, LogicalType return_type)
@@ -150844,21 +153103,7 @@ BoundOperatorExpression::BoundOperatorExpression(ExpressionType type, LogicalTyp
150844
153103
  }
150845
153104
 
150846
153105
  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;
153106
+ return OperatorExpression::ToString<BoundOperatorExpression, Expression>(*this);
150862
153107
  }
150863
153108
 
150864
153109
  bool BoundOperatorExpression::Equals(const BaseExpression *other_p) const {
@@ -150948,6 +153193,9 @@ BoundReferenceExpression::BoundReferenceExpression(LogicalType type, idx_t index
150948
153193
  }
150949
153194
 
150950
153195
  string BoundReferenceExpression::ToString() const {
153196
+ if (!alias.empty()) {
153197
+ return alias;
153198
+ }
150951
153199
  return "#" + to_string(index);
150952
153200
  }
150953
153201
 
@@ -151039,6 +153287,7 @@ unique_ptr<Expression> BoundUnnestExpression::Copy() {
151039
153287
 
151040
153288
 
151041
153289
 
153290
+
151042
153291
  namespace duckdb {
151043
153292
 
151044
153293
  BoundWindowExpression::BoundWindowExpression(ExpressionType type, LogicalType return_type,
@@ -151049,134 +153298,9 @@ BoundWindowExpression::BoundWindowExpression(ExpressionType type, LogicalType re
151049
153298
  }
151050
153299
 
151051
153300
  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;
153301
+ string function_name = aggregate.get() ? aggregate->name : ExpressionTypeToString(type);
153302
+ return WindowExpression::ToString<BoundWindowExpression, Expression, BoundOrderByNode>(*this, string(),
153303
+ function_name);
151180
153304
  }
151181
153305
 
151182
153306
  bool BoundWindowExpression::Equals(const BaseExpression *other_p) const {
@@ -151770,7 +153894,13 @@ OrderBinder::OrderBinder(vector<Binder *> binders, idx_t projection_index, Selec
151770
153894
  }
151771
153895
 
151772
153896
  unique_ptr<Expression> OrderBinder::CreateProjectionReference(ParsedExpression &expr, idx_t index) {
151773
- return make_unique<BoundColumnRefExpression>(expr.GetName(), LogicalType::INVALID,
153897
+ string alias;
153898
+ if (extra_list && index < extra_list->size()) {
153899
+ alias = extra_list->at(index)->ToString();
153900
+ } else {
153901
+ alias = expr.GetName();
153902
+ }
153903
+ return make_unique<BoundColumnRefExpression>(move(alias), LogicalType::INVALID,
151774
153904
  ColumnBinding(projection_index, index));
151775
153905
  }
151776
153906
 
@@ -152879,6 +155009,7 @@ JoinSide JoinSide::GetJoinSide(const unordered_set<idx_t> &bindings, unordered_s
152879
155009
 
152880
155010
 
152881
155011
 
155012
+
152882
155013
  namespace duckdb {
152883
155014
 
152884
155015
  string LogicalOperator::GetName() const {
@@ -152955,6 +155086,7 @@ void LogicalOperator::Verify() {
152955
155086
  #ifdef DEBUG
152956
155087
  // verify expressions
152957
155088
  for (idx_t expr_idx = 0; expr_idx < expressions.size(); expr_idx++) {
155089
+ auto str = expressions[expr_idx]->ToString();
152958
155090
  // verify that we can (correctly) copy this expression
152959
155091
  auto copy = expressions[expr_idx]->Copy();
152960
155092
  auto original_hash = expressions[expr_idx]->Hash();
@@ -152974,6 +155106,7 @@ void LogicalOperator::Verify() {
152974
155106
  D_ASSERT(!expr_equal);
152975
155107
  }
152976
155108
  }
155109
+ D_ASSERT(!str.empty());
152977
155110
  }
152978
155111
  D_ASSERT(!ToString().empty());
152979
155112
  for (auto &child : children) {
@@ -156230,7 +158363,7 @@ void PartialBlock::FlushToDisk(DatabaseInstance &db) {
156230
158363
 
156231
158364
 
156232
158365
  // LICENSE_CHANGE_BEGIN
156233
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
158366
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #11
156234
158367
  // See the end of this file for a list
156235
158368
 
156236
158369
  /**
@@ -156243,7 +158376,7 @@ void PartialBlock::FlushToDisk(DatabaseInstance &db) {
156243
158376
 
156244
158377
 
156245
158378
  // LICENSE_CHANGE_BEGIN
156246
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
158379
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #11
156247
158380
  // See the end of this file for a list
156248
158381
 
156249
158382
  /**
@@ -179681,7 +181814,7 @@ mz_bool mz_zip_end(mz_zip_archive *pZip)
179681
181814
 
179682
181815
 
179683
181816
  // LICENSE_CHANGE_BEGIN
179684
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
181817
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179685
181818
  // See the end of this file for a list
179686
181819
 
179687
181820
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -179712,7 +181845,7 @@ mz_bool mz_zip_end(mz_zip_archive *pZip)
179712
181845
 
179713
181846
 
179714
181847
  // LICENSE_CHANGE_BEGIN
179715
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
181848
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179716
181849
  // See the end of this file for a list
179717
181850
 
179718
181851
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -179733,7 +181866,7 @@ mz_bool mz_zip_end(mz_zip_archive *pZip)
179733
181866
 
179734
181867
 
179735
181868
  // LICENSE_CHANGE_BEGIN
179736
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
181869
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179737
181870
  // See the end of this file for a list
179738
181871
 
179739
181872
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -179880,7 +182013,7 @@ class LogMessageFatal : public LogMessage {
179880
182013
 
179881
182014
 
179882
182015
  // LICENSE_CHANGE_BEGIN
179883
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
182016
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179884
182017
  // See the end of this file for a list
179885
182018
 
179886
182019
  // Copyright 2018 The RE2 Authors. All Rights Reserved.
@@ -179945,7 +182078,7 @@ class PODArray {
179945
182078
 
179946
182079
 
179947
182080
  // LICENSE_CHANGE_BEGIN
179948
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
182081
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179949
182082
  // See the end of this file for a list
179950
182083
 
179951
182084
  // Copyright 2007 The RE2 Authors. All Rights Reserved.
@@ -179972,7 +182105,7 @@ class PODArray {
179972
182105
 
179973
182106
 
179974
182107
  // LICENSE_CHANGE_BEGIN
179975
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
182108
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
179976
182109
  // See the end of this file for a list
179977
182110
 
179978
182111
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -180374,7 +182507,7 @@ template<typename Value> bool SparseArray<Value>::less(const IndexValue& a,
180374
182507
 
180375
182508
 
180376
182509
  // LICENSE_CHANGE_BEGIN
180377
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
182510
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
180378
182511
  // See the end of this file for a list
180379
182512
 
180380
182513
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -181063,7 +183196,7 @@ class Prog {
181063
183196
 
181064
183197
 
181065
183198
  // LICENSE_CHANGE_BEGIN
181066
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
183199
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
181067
183200
  // See the end of this file for a list
181068
183201
 
181069
183202
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -181164,7 +183297,7 @@ class Prog {
181164
183297
 
181165
183298
 
181166
183299
  // LICENSE_CHANGE_BEGIN
181167
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
183300
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
181168
183301
  // See the end of this file for a list
181169
183302
 
181170
183303
  /*
@@ -182138,7 +184271,7 @@ bool Prog::SearchBitState(const StringPiece& text,
182138
184271
 
182139
184272
 
182140
184273
  // LICENSE_CHANGE_BEGIN
182141
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
184274
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
182142
184275
  // See the end of this file for a list
182143
184276
 
182144
184277
  // Copyright 2007 The RE2 Authors. All Rights Reserved.
@@ -182165,7 +184298,7 @@ bool Prog::SearchBitState(const StringPiece& text,
182165
184298
 
182166
184299
 
182167
184300
  // LICENSE_CHANGE_BEGIN
182168
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
184301
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
182169
184302
  // See the end of this file for a list
182170
184303
 
182171
184304
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -183681,7 +185814,7 @@ Prog* Prog::CompileSet(Regexp* re, RE2::Anchor anchor, int64_t max_mem) {
183681
185814
 
183682
185815
 
183683
185816
  // LICENSE_CHANGE_BEGIN
183684
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
185817
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
183685
185818
  // See the end of this file for a list
183686
185819
 
183687
185820
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -183726,7 +185859,7 @@ Prog* Prog::CompileSet(Regexp* re, RE2::Anchor anchor, int64_t max_mem) {
183726
185859
 
183727
185860
 
183728
185861
  // LICENSE_CHANGE_BEGIN
183729
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
185862
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
183730
185863
  // See the end of this file for a list
183731
185864
 
183732
185865
  // Copyright 2016 The RE2 Authors. All Rights Reserved.
@@ -183777,7 +185910,7 @@ class HashMix {
183777
185910
 
183778
185911
 
183779
185912
  // LICENSE_CHANGE_BEGIN
183780
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
185913
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
183781
185914
  // See the end of this file for a list
183782
185915
 
183783
185916
  // Copyright 2007 The RE2 Authors. All Rights Reserved.
@@ -183921,7 +186054,7 @@ class WriterMutexLock {
183921
186054
 
183922
186055
 
183923
186056
  // LICENSE_CHANGE_BEGIN
183924
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
186057
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
183925
186058
  // See the end of this file for a list
183926
186059
 
183927
186060
  // Copyright 2016 The RE2 Authors. All Rights Reserved.
@@ -185997,7 +188130,7 @@ bool Prog::PossibleMatchRange(std::string* min, std::string* max, int maxlen) {
185997
188130
 
185998
188131
 
185999
188132
  // LICENSE_CHANGE_BEGIN
186000
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188133
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186001
188134
  // See the end of this file for a list
186002
188135
 
186003
188136
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -186007,7 +188140,7 @@ bool Prog::PossibleMatchRange(std::string* min, std::string* max, int maxlen) {
186007
188140
 
186008
188141
 
186009
188142
  // LICENSE_CHANGE_BEGIN
186010
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188143
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186011
188144
  // See the end of this file for a list
186012
188145
 
186013
188146
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -186133,7 +188266,7 @@ class FilteredRE2 {
186133
188266
 
186134
188267
 
186135
188268
  // LICENSE_CHANGE_BEGIN
186136
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188269
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186137
188270
  // See the end of this file for a list
186138
188271
 
186139
188272
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -186251,7 +188384,7 @@ class Prefilter {
186251
188384
 
186252
188385
 
186253
188386
  // LICENSE_CHANGE_BEGIN
186254
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188387
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186255
188388
  // See the end of this file for a list
186256
188389
 
186257
188390
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -186511,7 +188644,7 @@ void FilteredRE2::PrintPrefilter(int regexpid) {
186511
188644
 
186512
188645
 
186513
188646
  // LICENSE_CHANGE_BEGIN
186514
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188647
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186515
188648
  // See the end of this file for a list
186516
188649
 
186517
188650
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -186707,7 +188840,7 @@ static bool CanBeEmptyString(Regexp* re) {
186707
188840
 
186708
188841
 
186709
188842
  // LICENSE_CHANGE_BEGIN
186710
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
188843
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
186711
188844
  // See the end of this file for a list
186712
188845
 
186713
188846
  // Copyright 2006-2007 The RE2 Authors. All Rights Reserved.
@@ -187430,7 +189563,7 @@ void Prog::Fanout(SparseArray<int>* fanout) {
187430
189563
 
187431
189564
 
187432
189565
  // LICENSE_CHANGE_BEGIN
187433
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
189566
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
187434
189567
  // See the end of this file for a list
187435
189568
 
187436
189569
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -188014,7 +190147,7 @@ fail:
188014
190147
 
188015
190148
 
188016
190149
  // LICENSE_CHANGE_BEGIN
188017
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
190150
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
188018
190151
  // See the end of this file for a list
188019
190152
 
188020
190153
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -188054,7 +190187,7 @@ fail:
188054
190187
 
188055
190188
 
188056
190189
  // LICENSE_CHANGE_BEGIN
188057
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
190190
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
188058
190191
  // See the end of this file for a list
188059
190192
 
188060
190193
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -188142,7 +190275,7 @@ extern Rune ApplyFold(const CaseFold *f, Rune r);
188142
190275
 
188143
190276
 
188144
190277
  // LICENSE_CHANGE_BEGIN
188145
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
190278
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
188146
190279
  // See the end of this file for a list
188147
190280
 
188148
190281
  // Copyright 2008 The RE2 Authors. All Rights Reserved.
@@ -190650,7 +192783,7 @@ Regexp* Regexp::Parse(const StringPiece& s, ParseFlags global_flags,
190650
192783
 
190651
192784
 
190652
192785
  // LICENSE_CHANGE_BEGIN
190653
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
192786
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
190654
192787
  // See the end of this file for a list
190655
192788
 
190656
192789
  // GENERATED BY make_perl_groups.pl; DO NOT EDIT.
@@ -190778,7 +192911,7 @@ const int num_posix_groups = 28;
190778
192911
 
190779
192912
 
190780
192913
  // LICENSE_CHANGE_BEGIN
190781
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
192914
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
190782
192915
  // See the end of this file for a list
190783
192916
 
190784
192917
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -191479,7 +193612,7 @@ Prefilter* Prefilter::FromRE2(const RE2* re2) {
191479
193612
 
191480
193613
 
191481
193614
  // LICENSE_CHANGE_BEGIN
191482
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
193615
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
191483
193616
  // See the end of this file for a list
191484
193617
 
191485
193618
  // Copyright 2009 The RE2 Authors. All Rights Reserved.
@@ -191890,7 +194023,7 @@ std::string PrefilterTree::DebugNodeString(Prefilter* node) const {
191890
194023
 
191891
194024
 
191892
194025
  // LICENSE_CHANGE_BEGIN
191893
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
194026
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
191894
194027
  // See the end of this file for a list
191895
194028
 
191896
194029
  // Copyright 2007 The RE2 Authors. All Rights Reserved.
@@ -191914,7 +194047,7 @@ std::string PrefilterTree::DebugNodeString(Prefilter* node) const {
191914
194047
 
191915
194048
 
191916
194049
  // LICENSE_CHANGE_BEGIN
191917
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
194050
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
191918
194051
  // See the end of this file for a list
191919
194052
 
191920
194053
  // Copyright 2016 The RE2 Authors. All Rights Reserved.
@@ -192940,7 +195073,7 @@ void Prog::ComputeHints(std::vector<Inst>* flat, int begin, int end) {
192940
195073
 
192941
195074
 
192942
195075
  // LICENSE_CHANGE_BEGIN
192943
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
195076
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
192944
195077
  // See the end of this file for a list
192945
195078
 
192946
195079
  // Copyright 2003-2009 The RE2 Authors. All Rights Reserved.
@@ -194184,7 +196317,7 @@ DEFINE_INTEGER_PARSER(ulonglong)
194184
196317
 
194185
196318
 
194186
196319
  // LICENSE_CHANGE_BEGIN
194187
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
196320
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
194188
196321
  // See the end of this file for a list
194189
196322
 
194190
196323
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -195164,7 +197297,7 @@ CharClass* CharClassBuilder::GetCharClass() {
195164
197297
 
195165
197298
 
195166
197299
  // LICENSE_CHANGE_BEGIN
195167
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
197300
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
195168
197301
  // See the end of this file for a list
195169
197302
 
195170
197303
  // Copyright 2010 The RE2 Authors. All Rights Reserved.
@@ -195174,7 +197307,7 @@ CharClass* CharClassBuilder::GetCharClass() {
195174
197307
 
195175
197308
 
195176
197309
  // LICENSE_CHANGE_BEGIN
195177
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
197310
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
195178
197311
  // See the end of this file for a list
195179
197312
 
195180
197313
  // Copyright 2010 The RE2 Authors. All Rights Reserved.
@@ -195415,7 +197548,7 @@ bool RE2::Set::Match(const StringPiece& text, std::vector<int>* v,
195415
197548
 
195416
197549
 
195417
197550
  // LICENSE_CHANGE_BEGIN
195418
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
197551
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
195419
197552
  // See the end of this file for a list
195420
197553
 
195421
197554
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -196080,7 +198213,7 @@ Regexp* SimplifyWalker::SimplifyCharClass(Regexp* re) {
196080
198213
 
196081
198214
 
196082
198215
  // LICENSE_CHANGE_BEGIN
196083
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
198216
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
196084
198217
  // See the end of this file for a list
196085
198218
 
196086
198219
  // Copyright 2004 The RE2 Authors. All Rights Reserved.
@@ -196154,7 +198287,7 @@ std::ostream& operator<<(std::ostream& o, const StringPiece& p) {
196154
198287
 
196155
198288
 
196156
198289
  // LICENSE_CHANGE_BEGIN
196157
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
198290
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
196158
198291
  // See the end of this file for a list
196159
198292
 
196160
198293
  // Copyright 2006 The RE2 Authors. All Rights Reserved.
@@ -196512,7 +198645,7 @@ static void AppendCCRange(std::string* t, Rune lo, Rune hi) {
196512
198645
 
196513
198646
 
196514
198647
  // LICENSE_CHANGE_BEGIN
196515
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
198648
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
196516
198649
  // See the end of this file for a list
196517
198650
 
196518
198651
 
@@ -197088,7 +199221,7 @@ const int num_unicode_tolower = 194;
197088
199221
 
197089
199222
 
197090
199223
  // LICENSE_CHANGE_BEGIN
197091
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
199224
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
197092
199225
  // See the end of this file for a list
197093
199226
 
197094
199227
 
@@ -203156,7 +205289,7 @@ const int num_unicode_groups = 184;
203156
205289
 
203157
205290
 
203158
205291
  // LICENSE_CHANGE_BEGIN
203159
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
205292
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
203160
205293
  // See the end of this file for a list
203161
205294
 
203162
205295
  /*
@@ -203425,7 +205558,7 @@ utfrune(const char *s, Rune c)
203425
205558
 
203426
205559
 
203427
205560
  // LICENSE_CHANGE_BEGIN
203428
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6
205561
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7
203429
205562
  // See the end of this file for a list
203430
205563
 
203431
205564
  // Copyright 1999-2005 The RE2 Authors. All Rights Reserved.
@@ -203598,7 +205731,7 @@ void StringAppendF(std::string* dst, const char* format, ...) {
203598
205731
 
203599
205732
 
203600
205733
  // LICENSE_CHANGE_BEGIN
203601
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4
205734
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5
203602
205735
  // See the end of this file for a list
203603
205736
 
203604
205737
  /* hyperloglog.c - Redis HyperLogLog probabilistic cardinality approximation.
@@ -203636,7 +205769,7 @@ void StringAppendF(std::string* dst, const char* format, ...) {
203636
205769
 
203637
205770
 
203638
205771
  // LICENSE_CHANGE_BEGIN
203639
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4
205772
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5
203640
205773
  // See the end of this file for a list
203641
205774
 
203642
205775
  /* SDSLib 2.0 -- A C dynamic strings library
@@ -205140,7 +207273,7 @@ robj *hll_merge(robj **hlls, size_t hll_count) {
205140
207273
 
205141
207274
 
205142
207275
  // LICENSE_CHANGE_BEGIN
205143
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4
207276
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5
205144
207277
  // See the end of this file for a list
205145
207278
 
205146
207279
  /* SDSLib 2.0 -- A C dynamic strings library
@@ -206263,7 +208396,7 @@ void sdfree(void *ptr) { free(ptr); }
206263
208396
 
206264
208397
 
206265
208398
  // LICENSE_CHANGE_BEGIN
206266
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
208399
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #11
206267
208400
  // See the end of this file for a list
206268
208401
 
206269
208402
 
@@ -223402,7 +225535,7 @@ size_t Utf8Proc::RenderWidth(const char *s, size_t len, size_t pos) {
223402
225535
 
223403
225536
 
223404
225537
  // LICENSE_CHANGE_BEGIN
223405
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
225538
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223406
225539
  // See the end of this file for a list
223407
225540
 
223408
225541
  #include <stdexcept>
@@ -223412,7 +225545,7 @@ size_t Utf8Proc::RenderWidth(const char *s, size_t len, size_t pos) {
223412
225545
 
223413
225546
 
223414
225547
  // LICENSE_CHANGE_BEGIN
223415
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
225548
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223416
225549
  // See the end of this file for a list
223417
225550
 
223418
225551
 
@@ -223740,7 +225873,7 @@ PGNode *newNode(size_t size, PGNodeTag type) {
223740
225873
 
223741
225874
 
223742
225875
  // LICENSE_CHANGE_BEGIN
223743
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
225876
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223744
225877
  // See the end of this file for a list
223745
225878
 
223746
225879
 
@@ -223750,7 +225883,7 @@ PGNode *newNode(size_t size, PGNodeTag type) {
223750
225883
 
223751
225884
 
223752
225885
  // LICENSE_CHANGE_BEGIN
223753
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
225886
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223754
225887
  // See the end of this file for a list
223755
225888
 
223756
225889
  /*-------------------------------------------------------------------------
@@ -223789,7 +225922,7 @@ bool get_preserve_identifier_case();
223789
225922
 
223790
225923
 
223791
225924
  // LICENSE_CHANGE_BEGIN
223792
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
225925
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223793
225926
  // See the end of this file for a list
223794
225927
 
223795
225928
  /*-------------------------------------------------------------------------
@@ -223837,7 +225970,7 @@ PostgresParser::PostgresParser() : success(false), parse_tree(nullptr), error_me
223837
225970
 
223838
225971
  void PostgresParser::Parse(const string &query) {
223839
225972
  duckdb_libpgquery::pg_parser_init();
223840
- duckdb_libpgquery::parse_result res;
225973
+ duckdb_libpgquery::parse_result res;
223841
225974
  pg_parser_parse(query.c_str(), &res);
223842
225975
  success = res.success;
223843
225976
 
@@ -223879,7 +226012,7 @@ void PostgresParser::SetPreserveIdentifierCase(bool preserve) {
223879
226012
 
223880
226013
 
223881
226014
  // LICENSE_CHANGE_BEGIN
223882
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
226015
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
223883
226016
  // See the end of this file for a list
223884
226017
 
223885
226018
  /*--------------------------------------------------------------------
@@ -224427,7 +226560,7 @@ int length(const PGList *list);
224427
226560
 
224428
226561
 
224429
226562
  // LICENSE_CHANGE_BEGIN
224430
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
226563
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
224431
226564
  // See the end of this file for a list
224432
226565
 
224433
226566
  /*--------------------------------------------------------------------
@@ -224468,7 +226601,7 @@ int length(const PGList *list);
224468
226601
 
224469
226602
 
224470
226603
  // LICENSE_CHANGE_BEGIN
224471
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
226604
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
224472
226605
  // See the end of this file for a list
224473
226606
 
224474
226607
  /*-------------------------------------------------------------------------
@@ -224503,7 +226636,7 @@ typedef struct PGFunctionCallInfoData *PGFunctionCallInfo;
224503
226636
 
224504
226637
 
224505
226638
  // LICENSE_CHANGE_BEGIN
224506
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
226639
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
224507
226640
  // See the end of this file for a list
224508
226641
 
224509
226642
  /*-------------------------------------------------------------------------
@@ -224581,7 +226714,7 @@ PGGroupingSet *makeGroupingSet(GroupingSetKind kind, PGList *content, int locati
224581
226714
 
224582
226715
 
224583
226716
  // LICENSE_CHANGE_BEGIN
224584
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
226717
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
224585
226718
  // See the end of this file for a list
224586
226719
 
224587
226720
  /*-------------------------------------------------------------------------
@@ -224928,7 +227061,7 @@ PGGroupingSet *makeGroupingSet(GroupingSetKind kind, PGList *content, int locati
224928
227061
 
224929
227062
 
224930
227063
  // LICENSE_CHANGE_BEGIN
224931
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
227064
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
224932
227065
  // See the end of this file for a list
224933
227066
 
224934
227067
  /*--------------------------------------------------------------------
@@ -225010,7 +227143,7 @@ PGValue *makeString(const char *str) {
225010
227143
 
225011
227144
 
225012
227145
  // LICENSE_CHANGE_BEGIN
225013
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
227146
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
225014
227147
  // See the end of this file for a list
225015
227148
 
225016
227149
  /* A Bison parser, made by GNU Bison 2.3. */
@@ -226114,7 +228247,7 @@ PGValue *makeString(const char *str) {
226114
228247
 
226115
228248
 
226116
228249
  // LICENSE_CHANGE_BEGIN
226117
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
228250
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
226118
228251
  // See the end of this file for a list
226119
228252
 
226120
228253
  /*-------------------------------------------------------------------------
@@ -226141,7 +228274,7 @@ PGValue *makeString(const char *str) {
226141
228274
 
226142
228275
 
226143
228276
  // LICENSE_CHANGE_BEGIN
226144
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
228277
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
226145
228278
  // See the end of this file for a list
226146
228279
 
226147
228280
  /*-------------------------------------------------------------------------
@@ -226279,7 +228412,7 @@ namespace duckdb_libpgquery {
226279
228412
 
226280
228413
 
226281
228414
  // LICENSE_CHANGE_BEGIN
226282
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
228415
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
226283
228416
  // See the end of this file for a list
226284
228417
 
226285
228418
  /* A Bison parser, made by GNU Bison 2.3. */
@@ -227414,7 +229547,7 @@ int base_yyparse(core_yyscan_t yyscanner);
227414
229547
 
227415
229548
 
227416
229549
  // LICENSE_CHANGE_BEGIN
227417
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
229550
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
227418
229551
  // See the end of this file for a list
227419
229552
 
227420
229553
  /*-------------------------------------------------------------------------
@@ -227438,7 +229571,7 @@ int base_yyparse(core_yyscan_t yyscanner);
227438
229571
 
227439
229572
 
227440
229573
  // LICENSE_CHANGE_BEGIN
227441
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
229574
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
227442
229575
  // See the end of this file for a list
227443
229576
 
227444
229577
  /*-------------------------------------------------------------------------
@@ -227458,7 +229591,7 @@ int base_yyparse(core_yyscan_t yyscanner);
227458
229591
 
227459
229592
 
227460
229593
  // LICENSE_CHANGE_BEGIN
227461
- // 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
227462
229595
  // See the end of this file for a list
227463
229596
 
227464
229597
  /*-------------------------------------------------------------------------
@@ -227519,7 +229652,7 @@ typedef struct {
227519
229652
 
227520
229653
 
227521
229654
  // LICENSE_CHANGE_BEGIN
227522
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
229655
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
227523
229656
  // See the end of this file for a list
227524
229657
 
227525
229658
  /*-------------------------------------------------------------------------
@@ -252437,7 +254570,7 @@ parser_init(base_yy_extra_type *yyext)
252437
254570
 
252438
254571
 
252439
254572
  // LICENSE_CHANGE_BEGIN
252440
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
254573
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
252441
254574
  // See the end of this file for a list
252442
254575
 
252443
254576
  /*--------------------------------------------------------------------
@@ -252476,7 +254609,7 @@ parser_init(base_yy_extra_type *yyext)
252476
254609
 
252477
254610
 
252478
254611
  // LICENSE_CHANGE_BEGIN
252479
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
254612
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
252480
254613
  // See the end of this file for a list
252481
254614
 
252482
254615
 
@@ -253208,7 +255341,7 @@ int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner) {
253208
255341
 
253209
255342
 
253210
255343
  // LICENSE_CHANGE_BEGIN
253211
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
255344
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
253212
255345
  // See the end of this file for a list
253213
255346
 
253214
255347
  #line 2 "third_party/libpg_query/src_backend_parser_scan.cpp"
@@ -253253,7 +255386,7 @@ int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner) {
253253
255386
 
253254
255387
 
253255
255388
  // LICENSE_CHANGE_BEGIN
253256
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
255389
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
253257
255390
  // See the end of this file for a list
253258
255391
 
253259
255392
  /*-------------------------------------------------------------------------
@@ -257345,7 +259478,7 @@ core_yyfree(void *ptr, core_yyscan_t yyscanner)
257345
259478
 
257346
259479
 
257347
259480
  // LICENSE_CHANGE_BEGIN
257348
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
259481
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
257349
259482
  // See the end of this file for a list
257350
259483
 
257351
259484
  /*--------------------------------------------------------------------
@@ -257477,7 +259610,7 @@ bool scanner_isspace(char ch) {
257477
259610
 
257478
259611
 
257479
259612
  // LICENSE_CHANGE_BEGIN
257480
- // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9
259613
+ // The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10
257481
259614
  // See the end of this file for a list
257482
259615
 
257483
259616
  /*--------------------------------------------------------------------
@@ -257741,6 +259874,34 @@ THE SOFTWARE.
257741
259874
 
257742
259875
  ### THIRD PARTY LICENSE #4 ###
257743
259876
 
259877
+ Permission is hereby granted, free of charge, to any
259878
+ person obtaining a copy of this software and associated
259879
+ documentation files (the "Software"), to deal in the
259880
+ Software without restriction, including without
259881
+ limitation the rights to use, copy, modify, merge,
259882
+ publish, distribute, sublicense, and/or sell copies of
259883
+ the Software, and to permit persons to whom the Software
259884
+ is furnished to do so, subject to the following
259885
+ conditions:
259886
+
259887
+ The above copyright notice and this permission notice
259888
+ shall be included in all copies or substantial portions
259889
+ of the Software.
259890
+
259891
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
259892
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
259893
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
259894
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
259895
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
259896
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
259897
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
259898
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
259899
+ DEALINGS IN THE SOFTWARE.
259900
+
259901
+
259902
+
259903
+ ### THIRD PARTY LICENSE #5 ###
259904
+
257744
259905
  Copyright (c) 2012 Art.sy, Inc.
257745
259906
 
257746
259907
  Permission is hereby granted, free of charge, to any person obtaining a copy of
@@ -257762,7 +259923,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
257762
259923
  SOFTWARE.
257763
259924
 
257764
259925
 
257765
- ### THIRD PARTY LICENSE #5 ###
259926
+ ### THIRD PARTY LICENSE #6 ###
257766
259927
 
257767
259928
  Apache License
257768
259929
  Version 2.0, January 2004
@@ -257967,7 +260128,7 @@ SOFTWARE.
257967
260128
  limitations under the License.
257968
260129
 
257969
260130
 
257970
- ### THIRD PARTY LICENSE #6 ###
260131
+ ### THIRD PARTY LICENSE #7 ###
257971
260132
 
257972
260133
  // Copyright (c) 2009 The RE2 Authors. All rights reserved.
257973
260134
  //
@@ -257999,7 +260160,7 @@ SOFTWARE.
257999
260160
 
258000
260161
 
258001
260162
 
258002
- ### THIRD PARTY LICENSE #7 ###
260163
+ ### THIRD PARTY LICENSE #8 ###
258003
260164
 
258004
260165
  The MIT License (MIT)
258005
260166
 
@@ -258026,7 +260187,7 @@ SOFTWARE.
258026
260187
 
258027
260188
 
258028
260189
 
258029
- ### THIRD PARTY LICENSE #8 ###
260190
+ ### THIRD PARTY LICENSE #9 ###
258030
260191
 
258031
260192
  This license file applies to everything in this repository except that which
258032
260193
  is explicitly annotated as being written by other authors, i.e. the Boost
@@ -258092,7 +260253,7 @@ DEALINGS IN THE SOFTWARE.
258092
260253
 
258093
260254
 
258094
260255
 
258095
- ### THIRD PARTY LICENSE #9 ###
260256
+ ### THIRD PARTY LICENSE #10 ###
258096
260257
 
258097
260258
  Copyright (c) 2015, Lukas Fittl <lukas@fittl.com>
258098
260259
  All rights reserved.
@@ -258124,7 +260285,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
258124
260285
  POSSIBILITY OF SUCH DAMAGE.
258125
260286
 
258126
260287
 
258127
- ### THIRD PARTY LICENSE #10 ###
260288
+ ### THIRD PARTY LICENSE #11 ###
258128
260289
 
258129
260290
  Apache License
258130
260291
  Version 2.0, January 2004