duckdb 0.3.3-dev1425.0 → 0.3.3-dev1434.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.3.3-dev1425.0",
4
+ "version": "0.3.3-dev1434.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -12780,6 +12780,7 @@ FMT_END_NAMESPACE
12780
12780
  // LICENSE_CHANGE_END
12781
12781
 
12782
12782
 
12783
+
12783
12784
  namespace duckdb {
12784
12785
 
12785
12786
  ExceptionFormatValue::ExceptionFormatValue(double dbl_val)
@@ -12788,6 +12789,9 @@ ExceptionFormatValue::ExceptionFormatValue(double dbl_val)
12788
12789
  ExceptionFormatValue::ExceptionFormatValue(int64_t int_val)
12789
12790
  : type(ExceptionFormatValueType::FORMAT_VALUE_TYPE_INTEGER), int_val(int_val) {
12790
12791
  }
12792
+ ExceptionFormatValue::ExceptionFormatValue(hugeint_t huge_val)
12793
+ : type(ExceptionFormatValueType::FORMAT_VALUE_TYPE_STRING), str_val(Hugeint::ToString(huge_val)) {
12794
+ }
12791
12795
  ExceptionFormatValue::ExceptionFormatValue(string str_val)
12792
12796
  : type(ExceptionFormatValueType::FORMAT_VALUE_TYPE_STRING), str_val(move(str_val)) {
12793
12797
  }
@@ -12821,6 +12825,10 @@ template <>
12821
12825
  ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(char *value) {
12822
12826
  return ExceptionFormatValue(string(value));
12823
12827
  }
12828
+ template <>
12829
+ ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(hugeint_t value) {
12830
+ return ExceptionFormatValue(value);
12831
+ }
12824
12832
 
12825
12833
  string ExceptionFormatValue::Format(const string &msg, vector<ExceptionFormatValue> &values) {
12826
12834
  std::vector<duckdb_fmt::basic_format_arg<duckdb_fmt::printf_context>> format_args;
@@ -19136,6 +19144,11 @@ public:
19136
19144
  result.Finalize();
19137
19145
  return result;
19138
19146
  }
19147
+
19148
+ template <class T>
19149
+ static std::string ToString(T value) {
19150
+ return std::to_string(value);
19151
+ }
19139
19152
  };
19140
19153
 
19141
19154
  template <>
@@ -19147,6 +19160,9 @@ int NumericHelper::UnsignedLength(uint32_t value);
19147
19160
  template <>
19148
19161
  int NumericHelper::UnsignedLength(uint64_t value);
19149
19162
 
19163
+ template <>
19164
+ std::string NumericHelper::ToString(hugeint_t value);
19165
+
19150
19166
  struct DecimalToString {
19151
19167
  template <class SIGNED, class UNSIGNED>
19152
19168
  static int DecimalLength(SIGNED value, uint8_t scale) {
@@ -32653,6 +32669,7 @@ void Blob::FromBase64(string_t str, data_ptr_t output, idx_t output_size) {
32653
32669
  } // namespace duckdb
32654
32670
 
32655
32671
 
32672
+
32656
32673
  namespace duckdb {
32657
32674
 
32658
32675
  const int64_t NumericHelper::POWERS_OF_TEN[] {1,
@@ -32754,6 +32771,11 @@ int NumericHelper::UnsignedLength(uint64_t value) {
32754
32771
  }
32755
32772
  }
32756
32773
 
32774
+ template <>
32775
+ std::string NumericHelper::ToString(hugeint_t value) {
32776
+ return Hugeint::ToString(value);
32777
+ }
32778
+
32757
32779
  } // namespace duckdb
32758
32780
 
32759
32781
 
@@ -90501,6 +90523,7 @@ void ModFun::RegisterFunction(BuiltinFunctions &set) {
90501
90523
 
90502
90524
 
90503
90525
 
90526
+
90504
90527
  namespace duckdb {
90505
90528
 
90506
90529
  template <class OP>
@@ -90637,15 +90660,32 @@ void BitwiseXorFun::RegisterFunction(BuiltinFunctions &set) {
90637
90660
  //===--------------------------------------------------------------------===//
90638
90661
  // << [bitwise_left_shift]
90639
90662
  //===--------------------------------------------------------------------===//
90640
- template <class T>
90641
- bool ShiftInRange(T shift) {
90642
- return shift >= 0 && shift < T(sizeof(T) * 8);
90643
- }
90644
90663
 
90645
90664
  struct BitwiseShiftLeftOperator {
90646
90665
  template <class TA, class TB, class TR>
90647
90666
  static inline TR Operation(TA input, TB shift) {
90648
- return ShiftInRange(shift) ? input << shift : 0;
90667
+ TA max_shift = TA(sizeof(TA) * 8);
90668
+ if (input < 0) {
90669
+ throw OutOfRangeException("Cannot left-shift negative number %s", NumericHelper::ToString(input));
90670
+ }
90671
+ if (shift < 0) {
90672
+ throw OutOfRangeException("Cannot left-shift by negative number %s", NumericHelper::ToString(shift));
90673
+ }
90674
+ if (shift >= max_shift) {
90675
+ if (input == 0) {
90676
+ return 0;
90677
+ }
90678
+ throw OutOfRangeException("Left-shift value %s is out of range", NumericHelper::ToString(shift));
90679
+ }
90680
+ if (shift == 0) {
90681
+ return input;
90682
+ }
90683
+ TA max_value = (TA(1) << (max_shift - shift - 1));
90684
+ if (input >= max_value) {
90685
+ throw OutOfRangeException("Overflow in left shift (%s << %s)", NumericHelper::ToString(input),
90686
+ NumericHelper::ToString(shift));
90687
+ }
90688
+ return input << shift;
90649
90689
  }
90650
90690
  };
90651
90691
 
@@ -90661,10 +90701,15 @@ void LeftShiftFun::RegisterFunction(BuiltinFunctions &set) {
90661
90701
  //===--------------------------------------------------------------------===//
90662
90702
  // >> [bitwise_right_shift]
90663
90703
  //===--------------------------------------------------------------------===//
90704
+ template <class T>
90705
+ bool RightShiftInRange(T shift) {
90706
+ return shift >= 0 && shift < T(sizeof(T) * 8);
90707
+ }
90708
+
90664
90709
  struct BitwiseShiftRightOperator {
90665
90710
  template <class TA, class TB, class TR>
90666
90711
  static inline TR Operation(TA input, TB shift) {
90667
- return ShiftInRange(shift) ? input >> shift : 0;
90712
+ return RightShiftInRange(shift) ? input >> shift : 0;
90668
90713
  }
90669
90714
  };
90670
90715