duckdb 0.4.1-dev68.0 → 0.4.1-dev85.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 +38 -41
- package/src/duckdb.hpp +3 -2
- package/src/parquet-amalgamation.cpp +31418 -31418
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},
|
|
@@ -17289,12 +17291,12 @@ public:
|
|
|
17289
17291
|
|
|
17290
17292
|
#include <cstdint>
|
|
17291
17293
|
#include <cstdio>
|
|
17294
|
+
#include <sys/stat.h>
|
|
17292
17295
|
|
|
17293
17296
|
#ifndef _WIN32
|
|
17294
17297
|
#include <dirent.h>
|
|
17295
17298
|
#include <fcntl.h>
|
|
17296
17299
|
#include <string.h>
|
|
17297
|
-
#include <sys/stat.h>
|
|
17298
17300
|
#include <sys/types.h>
|
|
17299
17301
|
#include <unistd.h>
|
|
17300
17302
|
#else
|
|
@@ -17333,7 +17335,6 @@ public:
|
|
|
17333
17335
|
#include <string>
|
|
17334
17336
|
|
|
17335
17337
|
#ifdef __MINGW32__
|
|
17336
|
-
#include <sys/stat.h>
|
|
17337
17338
|
// need to manually define this for mingw
|
|
17338
17339
|
extern "C" WINBASEAPI BOOL WINAPI GetPhysicallyInstalledSystemMemory(PULONGLONG);
|
|
17339
17340
|
#endif
|
|
@@ -17358,33 +17359,6 @@ static void AssertValidFileFlags(uint8_t flags) {
|
|
|
17358
17359
|
#endif
|
|
17359
17360
|
}
|
|
17360
17361
|
|
|
17361
|
-
#ifdef __MINGW32__
|
|
17362
|
-
bool LocalFileSystem::FileExists(const string &filename) {
|
|
17363
|
-
auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str());
|
|
17364
|
-
const wchar_t *wpath = unicode_path.c_str();
|
|
17365
|
-
if (_waccess(wpath, 0) == 0) {
|
|
17366
|
-
struct _stat64i32 status;
|
|
17367
|
-
_wstat64i32(wpath, &status);
|
|
17368
|
-
if (status.st_size > 0) {
|
|
17369
|
-
return true;
|
|
17370
|
-
}
|
|
17371
|
-
}
|
|
17372
|
-
return false;
|
|
17373
|
-
}
|
|
17374
|
-
bool LocalFileSystem::IsPipe(const string &filename) {
|
|
17375
|
-
auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str());
|
|
17376
|
-
const wchar_t *wpath = unicode_path.c_str();
|
|
17377
|
-
if (_waccess(wpath, 0) == 0) {
|
|
17378
|
-
struct _stat64i32 status;
|
|
17379
|
-
_wstat64i32(wpath, &status);
|
|
17380
|
-
if (status.st_size == 0) {
|
|
17381
|
-
return true;
|
|
17382
|
-
}
|
|
17383
|
-
}
|
|
17384
|
-
return false;
|
|
17385
|
-
}
|
|
17386
|
-
|
|
17387
|
-
#else
|
|
17388
17362
|
#ifndef _WIN32
|
|
17389
17363
|
bool LocalFileSystem::FileExists(const string &filename) {
|
|
17390
17364
|
if (!filename.empty()) {
|
|
@@ -17419,8 +17393,8 @@ bool LocalFileSystem::FileExists(const string &filename) {
|
|
|
17419
17393
|
auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str());
|
|
17420
17394
|
const wchar_t *wpath = unicode_path.c_str();
|
|
17421
17395
|
if (_waccess(wpath, 0) == 0) {
|
|
17422
|
-
struct
|
|
17423
|
-
|
|
17396
|
+
struct _stati64 status;
|
|
17397
|
+
_wstati64(wpath, &status);
|
|
17424
17398
|
if (status.st_mode & S_IFREG) {
|
|
17425
17399
|
return true;
|
|
17426
17400
|
}
|
|
@@ -17431,8 +17405,8 @@ bool LocalFileSystem::IsPipe(const string &filename) {
|
|
|
17431
17405
|
auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str());
|
|
17432
17406
|
const wchar_t *wpath = unicode_path.c_str();
|
|
17433
17407
|
if (_waccess(wpath, 0) == 0) {
|
|
17434
|
-
struct
|
|
17435
|
-
|
|
17408
|
+
struct _stati64 status;
|
|
17409
|
+
_wstati64(wpath, &status);
|
|
17436
17410
|
if (status.st_mode & _S_IFCHR) {
|
|
17437
17411
|
return true;
|
|
17438
17412
|
}
|
|
@@ -17440,7 +17414,6 @@ bool LocalFileSystem::IsPipe(const string &filename) {
|
|
|
17440
17414
|
return false;
|
|
17441
17415
|
}
|
|
17442
17416
|
#endif
|
|
17443
|
-
#endif
|
|
17444
17417
|
|
|
17445
17418
|
#ifndef _WIN32
|
|
17446
17419
|
// somehow sometimes this is missing
|
|
@@ -47742,7 +47715,7 @@ PhysicalType LogicalType::GetInternalType() {
|
|
|
47742
47715
|
} else if (width <= Decimal::MAX_WIDTH_INT128) {
|
|
47743
47716
|
return PhysicalType::INT128;
|
|
47744
47717
|
} else {
|
|
47745
|
-
throw InternalException("Widths bigger than
|
|
47718
|
+
throw InternalException("Widths bigger than %d are not supported", DecimalType::MaxWidth());
|
|
47746
47719
|
}
|
|
47747
47720
|
}
|
|
47748
47721
|
case LogicalTypeId::VARCHAR:
|
|
@@ -48292,9 +48265,20 @@ LogicalType LogicalType::MaxLogicalType(const LogicalType &left, const LogicalTy
|
|
|
48292
48265
|
return right;
|
|
48293
48266
|
}
|
|
48294
48267
|
} else if (type_id == LogicalTypeId::DECIMAL) {
|
|
48295
|
-
//
|
|
48296
|
-
|
|
48268
|
+
// unify the width/scale so that the resulting decimal always fits
|
|
48269
|
+
// "width - scale" gives us the number of digits on the left side of the decimal point
|
|
48270
|
+
// "scale" gives us the number of digits allowed on the right of the deciaml point
|
|
48271
|
+
// using the max of these of the two types gives us the new decimal size
|
|
48272
|
+
auto extra_width_left = DecimalType::GetWidth(left) - DecimalType::GetScale(left);
|
|
48273
|
+
auto extra_width_right = DecimalType::GetWidth(right) - DecimalType::GetScale(right);
|
|
48274
|
+
auto extra_width = MaxValue<uint8_t>(extra_width_left, extra_width_right);
|
|
48297
48275
|
auto scale = MaxValue<uint8_t>(DecimalType::GetScale(left), DecimalType::GetScale(right));
|
|
48276
|
+
auto width = extra_width + scale;
|
|
48277
|
+
if (width > DecimalType::MaxWidth()) {
|
|
48278
|
+
// if the resulting decimal does not fit, we truncate the scale
|
|
48279
|
+
width = DecimalType::MaxWidth();
|
|
48280
|
+
scale = width - extra_width;
|
|
48281
|
+
}
|
|
48298
48282
|
return LogicalType::DECIMAL(width, scale);
|
|
48299
48283
|
} else if (type_id == LogicalTypeId::LIST) {
|
|
48300
48284
|
// list: perform max recursively on child type
|
|
@@ -48491,6 +48475,10 @@ uint8_t DecimalType::GetScale(const LogicalType &type) {
|
|
|
48491
48475
|
return ((DecimalTypeInfo &)*info).scale;
|
|
48492
48476
|
}
|
|
48493
48477
|
|
|
48478
|
+
uint8_t DecimalType::MaxWidth() {
|
|
48479
|
+
return 38;
|
|
48480
|
+
}
|
|
48481
|
+
|
|
48494
48482
|
LogicalType LogicalType::DECIMAL(int width, int scale) {
|
|
48495
48483
|
auto type_info = make_shared<DecimalTypeInfo>(width, scale);
|
|
48496
48484
|
return LogicalType(LogicalTypeId::DECIMAL, move(type_info));
|
|
@@ -126562,19 +126550,26 @@ void ExtensionHelper::InstallExtension(DatabaseInstance &db, const string &exten
|
|
|
126562
126550
|
return;
|
|
126563
126551
|
}
|
|
126564
126552
|
|
|
126553
|
+
string temp_path = local_extension_path + ".tmp";
|
|
126554
|
+
if (fs.FileExists(temp_path)) {
|
|
126555
|
+
fs.RemoveFile(temp_path);
|
|
126556
|
+
}
|
|
126565
126557
|
auto is_http_url = StringUtil::Contains(extension, "http://");
|
|
126566
126558
|
if (fs.FileExists(extension)) {
|
|
126559
|
+
|
|
126567
126560
|
std::ifstream in(extension, std::ios::binary);
|
|
126568
126561
|
if (in.bad()) {
|
|
126569
126562
|
throw IOException("Failed to read extension from \"%s\"", extension);
|
|
126570
126563
|
}
|
|
126571
|
-
std::ofstream out(
|
|
126564
|
+
std::ofstream out(temp_path, std::ios::binary);
|
|
126572
126565
|
out << in.rdbuf();
|
|
126573
126566
|
if (out.bad()) {
|
|
126574
|
-
throw IOException("Failed to write extension to \"%s\"",
|
|
126567
|
+
throw IOException("Failed to write extension to \"%s\"", temp_path);
|
|
126575
126568
|
}
|
|
126576
126569
|
in.close();
|
|
126577
126570
|
out.close();
|
|
126571
|
+
|
|
126572
|
+
fs.MoveFile(temp_path, local_extension_path);
|
|
126578
126573
|
return;
|
|
126579
126574
|
} else if (StringUtil::Contains(extension, "/") && !is_http_url) {
|
|
126580
126575
|
throw IOException("Failed to read extension from \"%s\": no such file", extension);
|
|
@@ -126616,11 +126611,13 @@ void ExtensionHelper::InstallExtension(DatabaseInstance &db, const string &exten
|
|
|
126616
126611
|
throw IOException("Failed to download extension %s%s", url_base, url_local_part);
|
|
126617
126612
|
}
|
|
126618
126613
|
auto decompressed_body = GZipFileSystem::UncompressGZIPString(res->body);
|
|
126619
|
-
std::ofstream out(
|
|
126614
|
+
std::ofstream out(temp_path, std::ios::binary);
|
|
126620
126615
|
out.write(decompressed_body.data(), decompressed_body.size());
|
|
126621
126616
|
if (out.bad()) {
|
|
126622
|
-
throw IOException("Failed to write extension to %s",
|
|
126617
|
+
throw IOException("Failed to write extension to %s", temp_path);
|
|
126623
126618
|
}
|
|
126619
|
+
out.close();
|
|
126620
|
+
fs.MoveFile(temp_path, local_extension_path);
|
|
126624
126621
|
#endif
|
|
126625
126622
|
}
|
|
126626
126623
|
|
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 "4565d24b7"
|
|
15
|
+
#define DUCKDB_VERSION "v0.4.1-dev85"
|
|
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 {
|