duckdb 0.3.3-dev1422.0 → 0.3.3-dev1432.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/duckdb.cpp +59 -15
- package/src/duckdb.hpp +616 -613
- package/src/parquet-amalgamation.cpp +36786 -36786
package/package.json
CHANGED
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
|
-
|
|
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
|
|
90712
|
+
return RightShiftInRange(shift) ? input >> shift : 0;
|
|
90668
90713
|
}
|
|
90669
90714
|
};
|
|
90670
90715
|
|
|
@@ -129455,6 +129500,7 @@ unique_ptr<BaseStatistics> StatisticsPropagator::PropagateExpression(BoundAggreg
|
|
|
129455
129500
|
|
|
129456
129501
|
|
|
129457
129502
|
|
|
129503
|
+
|
|
129458
129504
|
namespace duckdb {
|
|
129459
129505
|
|
|
129460
129506
|
unique_ptr<Expression> CastHugeintToSmallestType(unique_ptr<Expression> expr, NumericStatistics &num_stats) {
|
|
@@ -129517,23 +129563,21 @@ unique_ptr<Expression> TemplatedCastToSmallestType(unique_ptr<Expression> expr,
|
|
|
129517
129563
|
return expr;
|
|
129518
129564
|
}
|
|
129519
129565
|
|
|
129520
|
-
//
|
|
129521
|
-
|
|
129522
|
-
|
|
129566
|
+
// Compute range, cast to unsigned to prevent comparing signed with unsigned
|
|
129567
|
+
T signed_range;
|
|
129568
|
+
if (!TrySubtractOperator::Operation(signed_min_val, signed_max_val, signed_range)) {
|
|
129569
|
+
// overflow in subtraction: cannot do any simplification
|
|
129523
129570
|
return expr;
|
|
129524
129571
|
}
|
|
129525
|
-
|
|
129526
|
-
// Compute range, cast to unsigned to prevent comparing signed with unsigned
|
|
129527
|
-
auto signed_range = signed_max_val - signed_min_val;
|
|
129528
129572
|
auto range = static_cast<typename std::make_unsigned<decltype(signed_range)>::type>(signed_range);
|
|
129529
129573
|
|
|
129530
129574
|
// Check if this range fits in a smaller type
|
|
129531
129575
|
LogicalType cast_type;
|
|
129532
|
-
if (range < NumericLimits<uint8_t
|
|
129576
|
+
if (range < NumericLimits<uint8_t>::Maximum()) {
|
|
129533
129577
|
cast_type = LogicalType::UTINYINT;
|
|
129534
|
-
} else if (sizeof(T) > sizeof(uint16_t) && range < NumericLimits<uint16_t
|
|
129578
|
+
} else if (sizeof(T) > sizeof(uint16_t) && range < NumericLimits<uint16_t>::Maximum()) {
|
|
129535
129579
|
cast_type = LogicalType::USMALLINT;
|
|
129536
|
-
} else if (sizeof(T) > sizeof(uint32_t) && range < NumericLimits<uint32_t
|
|
129580
|
+
} else if (sizeof(T) > sizeof(uint32_t) && range < NumericLimits<uint32_t>::Maximum()) {
|
|
129537
129581
|
cast_type = LogicalType::UINTEGER;
|
|
129538
129582
|
} else {
|
|
129539
129583
|
return expr;
|