duckdb 0.3.4-dev72.0 → 0.3.4-dev81.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 +30 -43
- package/src/duckdb.hpp +2 -2
- package/src/parquet-amalgamation.cpp +27883 -27883
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -68845,6 +68845,8 @@ template <>
|
|
|
68845
68845
|
bool TrySubtractOperator::Operation(int32_t left, int32_t right, int32_t &result);
|
|
68846
68846
|
template <>
|
|
68847
68847
|
bool TrySubtractOperator::Operation(int64_t left, int64_t right, int64_t &result);
|
|
68848
|
+
template <>
|
|
68849
|
+
bool TrySubtractOperator::Operation(hugeint_t left, hugeint_t right, hugeint_t &result);
|
|
68848
68850
|
|
|
68849
68851
|
struct SubtractOperatorOverflowCheck {
|
|
68850
68852
|
template <class TA, class TB, class TR>
|
|
@@ -92441,6 +92443,12 @@ bool TrySubtractOperator::Operation(int64_t left, int64_t right, int64_t &result
|
|
|
92441
92443
|
return true;
|
|
92442
92444
|
}
|
|
92443
92445
|
|
|
92446
|
+
template <>
|
|
92447
|
+
bool TrySubtractOperator::Operation(hugeint_t left, hugeint_t right, hugeint_t &result) {
|
|
92448
|
+
result = left;
|
|
92449
|
+
return Hugeint::SubtractInPlace(result, right);
|
|
92450
|
+
}
|
|
92451
|
+
|
|
92444
92452
|
//===--------------------------------------------------------------------===//
|
|
92445
92453
|
// subtract decimal with overflow check
|
|
92446
92454
|
//===--------------------------------------------------------------------===//
|
|
@@ -129643,28 +129651,25 @@ unique_ptr<BaseStatistics> StatisticsPropagator::PropagateExpression(BoundAggreg
|
|
|
129643
129651
|
|
|
129644
129652
|
namespace duckdb {
|
|
129645
129653
|
|
|
129646
|
-
|
|
129647
|
-
|
|
129648
|
-
|
|
129649
|
-
return expr;
|
|
129650
|
-
}
|
|
129651
|
-
|
|
129652
|
-
auto min_val = num_stats.min.GetValue<hugeint_t>();
|
|
129653
|
-
auto max_val = num_stats.max.GetValue<hugeint_t>();
|
|
129654
|
-
if (max_val < min_val) {
|
|
129655
|
-
return expr;
|
|
129656
|
-
}
|
|
129654
|
+
template <class T>
|
|
129655
|
+
bool GetCastType(T signed_range, LogicalType &cast_type) {
|
|
129656
|
+
auto range = static_cast<typename std::make_unsigned<decltype(signed_range)>::type>(signed_range);
|
|
129657
129657
|
|
|
129658
|
-
//
|
|
129659
|
-
if (
|
|
129660
|
-
|
|
129658
|
+
// Check if this range fits in a smaller type
|
|
129659
|
+
if (range < NumericLimits<uint8_t>::Maximum()) {
|
|
129660
|
+
cast_type = LogicalType::UTINYINT;
|
|
129661
|
+
} else if (sizeof(T) > sizeof(uint16_t) && range < NumericLimits<uint16_t>::Maximum()) {
|
|
129662
|
+
cast_type = LogicalType::USMALLINT;
|
|
129663
|
+
} else if (sizeof(T) > sizeof(uint32_t) && range < NumericLimits<uint32_t>::Maximum()) {
|
|
129664
|
+
cast_type = LogicalType::UINTEGER;
|
|
129665
|
+
} else {
|
|
129666
|
+
return false;
|
|
129661
129667
|
}
|
|
129668
|
+
return true;
|
|
129669
|
+
}
|
|
129662
129670
|
|
|
129663
|
-
|
|
129664
|
-
|
|
129665
|
-
|
|
129666
|
-
// Check if this range fits in a smaller type
|
|
129667
|
-
LogicalType cast_type;
|
|
129671
|
+
template <>
|
|
129672
|
+
bool GetCastType(hugeint_t range, LogicalType &cast_type) {
|
|
129668
129673
|
if (range < NumericLimits<uint8_t>().Maximum()) {
|
|
129669
129674
|
cast_type = LogicalType::UTINYINT;
|
|
129670
129675
|
} else if (range < NumericLimits<uint16_t>().Maximum()) {
|
|
@@ -129672,22 +129677,11 @@ unique_ptr<Expression> CastHugeintToSmallestType(unique_ptr<Expression> expr, Nu
|
|
|
129672
129677
|
} else if (range < NumericLimits<uint32_t>().Maximum()) {
|
|
129673
129678
|
cast_type = LogicalType::UINTEGER;
|
|
129674
129679
|
} else if (range < NumericLimits<uint64_t>().Maximum()) {
|
|
129675
|
-
cast_type =
|
|
129680
|
+
cast_type = LogicalType::UBIGINT;
|
|
129676
129681
|
} else {
|
|
129677
|
-
return
|
|
129682
|
+
return false;
|
|
129678
129683
|
}
|
|
129679
|
-
|
|
129680
|
-
// Create expression to map to a smaller range
|
|
129681
|
-
auto input_type = expr->return_type;
|
|
129682
|
-
auto minimum_expr = make_unique<BoundConstantExpression>(Value::CreateValue(min_val));
|
|
129683
|
-
vector<unique_ptr<Expression>> arguments;
|
|
129684
|
-
arguments.push_back(move(expr));
|
|
129685
|
-
arguments.push_back(move(minimum_expr));
|
|
129686
|
-
auto minus_expr = make_unique<BoundFunctionExpression>(input_type, SubtractFun::GetFunction(input_type, input_type),
|
|
129687
|
-
move(arguments), nullptr, true);
|
|
129688
|
-
|
|
129689
|
-
// Cast to smaller type
|
|
129690
|
-
return make_unique<BoundCastExpression>(move(minus_expr), cast_type);
|
|
129684
|
+
return true;
|
|
129691
129685
|
}
|
|
129692
129686
|
|
|
129693
129687
|
template <class T>
|
|
@@ -129705,21 +129699,14 @@ unique_ptr<Expression> TemplatedCastToSmallestType(unique_ptr<Expression> expr,
|
|
|
129705
129699
|
|
|
129706
129700
|
// Compute range, cast to unsigned to prevent comparing signed with unsigned
|
|
129707
129701
|
T signed_range;
|
|
129708
|
-
if (!TrySubtractOperator::Operation(
|
|
129702
|
+
if (!TrySubtractOperator::Operation(signed_max_val, signed_min_val, signed_range)) {
|
|
129709
129703
|
// overflow in subtraction: cannot do any simplification
|
|
129710
129704
|
return expr;
|
|
129711
129705
|
}
|
|
129712
|
-
auto range = static_cast<typename std::make_unsigned<decltype(signed_range)>::type>(signed_range);
|
|
129713
129706
|
|
|
129714
129707
|
// Check if this range fits in a smaller type
|
|
129715
129708
|
LogicalType cast_type;
|
|
129716
|
-
if (
|
|
129717
|
-
cast_type = LogicalType::UTINYINT;
|
|
129718
|
-
} else if (sizeof(T) > sizeof(uint16_t) && range < NumericLimits<uint16_t>::Maximum()) {
|
|
129719
|
-
cast_type = LogicalType::USMALLINT;
|
|
129720
|
-
} else if (sizeof(T) > sizeof(uint32_t) && range < NumericLimits<uint32_t>::Maximum()) {
|
|
129721
|
-
cast_type = LogicalType::UINTEGER;
|
|
129722
|
-
} else {
|
|
129709
|
+
if (!GetCastType(signed_range, cast_type)) {
|
|
129723
129710
|
return expr;
|
|
129724
129711
|
}
|
|
129725
129712
|
|
|
@@ -129755,7 +129742,7 @@ unique_ptr<Expression> CastToSmallestType(unique_ptr<Expression> expr, NumericSt
|
|
|
129755
129742
|
case PhysicalType::INT64:
|
|
129756
129743
|
return TemplatedCastToSmallestType<int64_t>(move(expr), num_stats);
|
|
129757
129744
|
case PhysicalType::INT128:
|
|
129758
|
-
return
|
|
129745
|
+
return TemplatedCastToSmallestType<hugeint_t>(move(expr), num_stats);
|
|
129759
129746
|
default:
|
|
129760
129747
|
throw NotImplementedException("Unknown integer type!");
|
|
129761
129748
|
}
|
package/src/duckdb.hpp
CHANGED
|
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
13
|
#define DUCKDB_AMALGAMATION_EXTENDED 1
|
|
14
|
-
#define DUCKDB_SOURCE_ID "
|
|
15
|
-
#define DUCKDB_VERSION "v0.3.4-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "4a1acaf1d"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.4-dev81"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|