duckdb 0.4.1-dev75.0 → 0.4.1-dev78.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 +18 -3
- package/src/duckdb.hpp +3 -2
- package/src/parquet-amalgamation.cpp +36175 -36175
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -47744,7 +47744,7 @@ PhysicalType LogicalType::GetInternalType() {
|
|
|
47744
47744
|
} else if (width <= Decimal::MAX_WIDTH_INT128) {
|
|
47745
47745
|
return PhysicalType::INT128;
|
|
47746
47746
|
} else {
|
|
47747
|
-
throw InternalException("Widths bigger than
|
|
47747
|
+
throw InternalException("Widths bigger than %d are not supported", DecimalType::MaxWidth());
|
|
47748
47748
|
}
|
|
47749
47749
|
}
|
|
47750
47750
|
case LogicalTypeId::VARCHAR:
|
|
@@ -48294,9 +48294,20 @@ LogicalType LogicalType::MaxLogicalType(const LogicalType &left, const LogicalTy
|
|
|
48294
48294
|
return right;
|
|
48295
48295
|
}
|
|
48296
48296
|
} else if (type_id == LogicalTypeId::DECIMAL) {
|
|
48297
|
-
//
|
|
48298
|
-
|
|
48297
|
+
// unify the width/scale so that the resulting decimal always fits
|
|
48298
|
+
// "width - scale" gives us the number of digits on the left side of the decimal point
|
|
48299
|
+
// "scale" gives us the number of digits allowed on the right of the deciaml point
|
|
48300
|
+
// using the max of these of the two types gives us the new decimal size
|
|
48301
|
+
auto extra_width_left = DecimalType::GetWidth(left) - DecimalType::GetScale(left);
|
|
48302
|
+
auto extra_width_right = DecimalType::GetWidth(right) - DecimalType::GetScale(right);
|
|
48303
|
+
auto extra_width = MaxValue<uint8_t>(extra_width_left, extra_width_right);
|
|
48299
48304
|
auto scale = MaxValue<uint8_t>(DecimalType::GetScale(left), DecimalType::GetScale(right));
|
|
48305
|
+
auto width = extra_width + scale;
|
|
48306
|
+
if (width > DecimalType::MaxWidth()) {
|
|
48307
|
+
// if the resulting decimal does not fit, we truncate the scale
|
|
48308
|
+
width = DecimalType::MaxWidth();
|
|
48309
|
+
scale = width - extra_width;
|
|
48310
|
+
}
|
|
48300
48311
|
return LogicalType::DECIMAL(width, scale);
|
|
48301
48312
|
} else if (type_id == LogicalTypeId::LIST) {
|
|
48302
48313
|
// list: perform max recursively on child type
|
|
@@ -48493,6 +48504,10 @@ uint8_t DecimalType::GetScale(const LogicalType &type) {
|
|
|
48493
48504
|
return ((DecimalTypeInfo &)*info).scale;
|
|
48494
48505
|
}
|
|
48495
48506
|
|
|
48507
|
+
uint8_t DecimalType::MaxWidth() {
|
|
48508
|
+
return 38;
|
|
48509
|
+
}
|
|
48510
|
+
|
|
48496
48511
|
LogicalType LogicalType::DECIMAL(int width, int scale) {
|
|
48497
48512
|
auto type_info = make_shared<DecimalTypeInfo>(width, scale);
|
|
48498
48513
|
return LogicalType(LogicalTypeId::DECIMAL, move(type_info));
|
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.4.1-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "c840a3b30"
|
|
15
|
+
#define DUCKDB_VERSION "v0.4.1-dev78"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -1124,6 +1124,7 @@ public:
|
|
|
1124
1124
|
struct DecimalType {
|
|
1125
1125
|
DUCKDB_API static uint8_t GetWidth(const LogicalType &type);
|
|
1126
1126
|
DUCKDB_API static uint8_t GetScale(const LogicalType &type);
|
|
1127
|
+
DUCKDB_API static uint8_t MaxWidth();
|
|
1127
1128
|
};
|
|
1128
1129
|
|
|
1129
1130
|
struct StringType {
|