duckdb 0.4.1-dev68.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 +33 -7
- package/src/duckdb.hpp +3 -2
- package/src/parquet-amalgamation.cpp +30120 -30120
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -5514,6 +5514,7 @@ vector<string> DefaultSchemaGenerator::GetDefaultEntries() {
|
|
|
5514
5514
|
|
|
5515
5515
|
|
|
5516
5516
|
|
|
5517
|
+
|
|
5517
5518
|
namespace duckdb {
|
|
5518
5519
|
|
|
5519
5520
|
struct DefaultType {
|
|
@@ -5574,6 +5575,7 @@ static DefaultType internal_types[] = {{"int", LogicalTypeId::INTEGER},
|
|
|
5574
5575
|
{"guid", LogicalTypeId::UUID},
|
|
5575
5576
|
{"struct", LogicalTypeId::STRUCT},
|
|
5576
5577
|
{"row", LogicalTypeId::STRUCT},
|
|
5578
|
+
{"list", LogicalTypeId::LIST},
|
|
5577
5579
|
{"map", LogicalTypeId::MAP},
|
|
5578
5580
|
{"utinyint", LogicalTypeId::UTINYINT},
|
|
5579
5581
|
{"uint8", LogicalTypeId::UTINYINT},
|
|
@@ -47742,7 +47744,7 @@ PhysicalType LogicalType::GetInternalType() {
|
|
|
47742
47744
|
} else if (width <= Decimal::MAX_WIDTH_INT128) {
|
|
47743
47745
|
return PhysicalType::INT128;
|
|
47744
47746
|
} else {
|
|
47745
|
-
throw InternalException("Widths bigger than
|
|
47747
|
+
throw InternalException("Widths bigger than %d are not supported", DecimalType::MaxWidth());
|
|
47746
47748
|
}
|
|
47747
47749
|
}
|
|
47748
47750
|
case LogicalTypeId::VARCHAR:
|
|
@@ -48292,9 +48294,20 @@ LogicalType LogicalType::MaxLogicalType(const LogicalType &left, const LogicalTy
|
|
|
48292
48294
|
return right;
|
|
48293
48295
|
}
|
|
48294
48296
|
} else if (type_id == LogicalTypeId::DECIMAL) {
|
|
48295
|
-
//
|
|
48296
|
-
|
|
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);
|
|
48297
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
|
+
}
|
|
48298
48311
|
return LogicalType::DECIMAL(width, scale);
|
|
48299
48312
|
} else if (type_id == LogicalTypeId::LIST) {
|
|
48300
48313
|
// list: perform max recursively on child type
|
|
@@ -48491,6 +48504,10 @@ uint8_t DecimalType::GetScale(const LogicalType &type) {
|
|
|
48491
48504
|
return ((DecimalTypeInfo &)*info).scale;
|
|
48492
48505
|
}
|
|
48493
48506
|
|
|
48507
|
+
uint8_t DecimalType::MaxWidth() {
|
|
48508
|
+
return 38;
|
|
48509
|
+
}
|
|
48510
|
+
|
|
48494
48511
|
LogicalType LogicalType::DECIMAL(int width, int scale) {
|
|
48495
48512
|
auto type_info = make_shared<DecimalTypeInfo>(width, scale);
|
|
48496
48513
|
return LogicalType(LogicalTypeId::DECIMAL, move(type_info));
|
|
@@ -126562,19 +126579,26 @@ void ExtensionHelper::InstallExtension(DatabaseInstance &db, const string &exten
|
|
|
126562
126579
|
return;
|
|
126563
126580
|
}
|
|
126564
126581
|
|
|
126582
|
+
string temp_path = local_extension_path + ".tmp";
|
|
126583
|
+
if (fs.FileExists(temp_path)) {
|
|
126584
|
+
fs.RemoveFile(temp_path);
|
|
126585
|
+
}
|
|
126565
126586
|
auto is_http_url = StringUtil::Contains(extension, "http://");
|
|
126566
126587
|
if (fs.FileExists(extension)) {
|
|
126588
|
+
|
|
126567
126589
|
std::ifstream in(extension, std::ios::binary);
|
|
126568
126590
|
if (in.bad()) {
|
|
126569
126591
|
throw IOException("Failed to read extension from \"%s\"", extension);
|
|
126570
126592
|
}
|
|
126571
|
-
std::ofstream out(
|
|
126593
|
+
std::ofstream out(temp_path, std::ios::binary);
|
|
126572
126594
|
out << in.rdbuf();
|
|
126573
126595
|
if (out.bad()) {
|
|
126574
|
-
throw IOException("Failed to write extension to \"%s\"",
|
|
126596
|
+
throw IOException("Failed to write extension to \"%s\"", temp_path);
|
|
126575
126597
|
}
|
|
126576
126598
|
in.close();
|
|
126577
126599
|
out.close();
|
|
126600
|
+
|
|
126601
|
+
fs.MoveFile(temp_path, local_extension_path);
|
|
126578
126602
|
return;
|
|
126579
126603
|
} else if (StringUtil::Contains(extension, "/") && !is_http_url) {
|
|
126580
126604
|
throw IOException("Failed to read extension from \"%s\": no such file", extension);
|
|
@@ -126616,11 +126640,13 @@ void ExtensionHelper::InstallExtension(DatabaseInstance &db, const string &exten
|
|
|
126616
126640
|
throw IOException("Failed to download extension %s%s", url_base, url_local_part);
|
|
126617
126641
|
}
|
|
126618
126642
|
auto decompressed_body = GZipFileSystem::UncompressGZIPString(res->body);
|
|
126619
|
-
std::ofstream out(
|
|
126643
|
+
std::ofstream out(temp_path, std::ios::binary);
|
|
126620
126644
|
out.write(decompressed_body.data(), decompressed_body.size());
|
|
126621
126645
|
if (out.bad()) {
|
|
126622
|
-
throw IOException("Failed to write extension to %s",
|
|
126646
|
+
throw IOException("Failed to write extension to %s", temp_path);
|
|
126623
126647
|
}
|
|
126648
|
+
out.close();
|
|
126649
|
+
fs.MoveFile(temp_path, local_extension_path);
|
|
126624
126650
|
#endif
|
|
126625
126651
|
}
|
|
126626
126652
|
|
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 {
|