duckdb 0.3.2-dev123.0 → 0.3.2-dev151.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 +208 -99
- package/src/duckdb.hpp +11 -3
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -20607,6 +20607,36 @@ private:
|
|
|
20607
20607
|
#include <sys/types.h>
|
|
20608
20608
|
#include <unistd.h>
|
|
20609
20609
|
#else
|
|
20610
|
+
//===----------------------------------------------------------------------===//
|
|
20611
|
+
// DuckDB
|
|
20612
|
+
//
|
|
20613
|
+
// duckdb/common/windows_util.hpp
|
|
20614
|
+
//
|
|
20615
|
+
//
|
|
20616
|
+
//===----------------------------------------------------------------------===//
|
|
20617
|
+
|
|
20618
|
+
|
|
20619
|
+
|
|
20620
|
+
|
|
20621
|
+
|
|
20622
|
+
|
|
20623
|
+
|
|
20624
|
+
|
|
20625
|
+
|
|
20626
|
+
namespace duckdb {
|
|
20627
|
+
|
|
20628
|
+
#ifdef DUCKDB_WINDOWS
|
|
20629
|
+
class WindowsUtil {
|
|
20630
|
+
public:
|
|
20631
|
+
//! Windows helper functions
|
|
20632
|
+
static std::wstring UTF8ToUnicode(const char *input);
|
|
20633
|
+
static string UnicodeToUTF8(LPCWSTR input);
|
|
20634
|
+
static string UTF8ToMBCS(const char *input, bool use_ansi = false);
|
|
20635
|
+
};
|
|
20636
|
+
#endif
|
|
20637
|
+
|
|
20638
|
+
} // namespace duckdb
|
|
20639
|
+
|
|
20610
20640
|
#include <string>
|
|
20611
20641
|
|
|
20612
20642
|
#ifdef __MINGW32__
|
|
@@ -21077,8 +21107,9 @@ unique_ptr<FileHandle> LocalFileSystem::OpenFile(const string &path, uint8_t fla
|
|
|
21077
21107
|
if (flags & FileFlags::FILE_FLAGS_DIRECT_IO) {
|
|
21078
21108
|
flags_and_attributes |= FILE_FLAG_NO_BUFFERING;
|
|
21079
21109
|
}
|
|
21080
|
-
|
|
21081
|
-
|
|
21110
|
+
auto unicode_path = WindowsUtil::UTF8ToUnicode(path.c_str());
|
|
21111
|
+
HANDLE hFile = CreateFileW(unicode_path.c_str(), desired_access, share_mode, NULL, creation_disposition,
|
|
21112
|
+
flags_and_attributes, NULL);
|
|
21082
21113
|
if (hFile == INVALID_HANDLE_VALUE) {
|
|
21083
21114
|
auto error = GetLastErrorAsString();
|
|
21084
21115
|
throw IOException("Cannot open file \"%s\": %s", path.c_str(), error);
|
|
@@ -21228,13 +21259,18 @@ void LocalFileSystem::Truncate(FileHandle &handle, int64_t new_size) {
|
|
|
21228
21259
|
}
|
|
21229
21260
|
}
|
|
21230
21261
|
|
|
21262
|
+
static DWORD WindowsGetFileAttributes(const string &filename) {
|
|
21263
|
+
auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str());
|
|
21264
|
+
return GetFileAttributesW(unicode_path.c_str());
|
|
21265
|
+
}
|
|
21266
|
+
|
|
21231
21267
|
bool LocalFileSystem::DirectoryExists(const string &directory) {
|
|
21232
|
-
DWORD attrs =
|
|
21268
|
+
DWORD attrs = WindowsGetFileAttributes(directory);
|
|
21233
21269
|
return (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY));
|
|
21234
21270
|
}
|
|
21235
21271
|
|
|
21236
21272
|
bool LocalFileSystem::FileExists(const string &filename) {
|
|
21237
|
-
DWORD attrs =
|
|
21273
|
+
DWORD attrs = WindowsGetFileAttributes(filename);
|
|
21238
21274
|
return (attrs != INVALID_FILE_ATTRIBUTES && !(attrs & FILE_ATTRIBUTE_DIRECTORY));
|
|
21239
21275
|
}
|
|
21240
21276
|
|
|
@@ -21242,79 +21278,58 @@ void LocalFileSystem::CreateDirectory(const string &directory) {
|
|
|
21242
21278
|
if (DirectoryExists(directory)) {
|
|
21243
21279
|
return;
|
|
21244
21280
|
}
|
|
21245
|
-
|
|
21281
|
+
auto unicode_path = WindowsUtil::UTF8ToUnicode(directory.c_str());
|
|
21282
|
+
if (directory.empty() || !CreateDirectoryW(unicode_path.c_str(), NULL) || !DirectoryExists(directory)) {
|
|
21246
21283
|
throw IOException("Could not create directory!");
|
|
21247
21284
|
}
|
|
21248
21285
|
}
|
|
21249
21286
|
|
|
21250
|
-
static void
|
|
21251
|
-
|
|
21252
|
-
|
|
21253
|
-
|
|
21254
|
-
// create search pattern
|
|
21255
|
-
TCHAR szDir[MAX_PATH];
|
|
21256
|
-
snprintf(szDir, MAX_PATH, "%s\\*", directory.c_str());
|
|
21257
|
-
|
|
21258
|
-
WIN32_FIND_DATA ffd;
|
|
21259
|
-
HANDLE hFind = FindFirstFile(szDir, &ffd);
|
|
21260
|
-
if (hFind == INVALID_HANDLE_VALUE) {
|
|
21261
|
-
return;
|
|
21262
|
-
}
|
|
21263
|
-
|
|
21264
|
-
do {
|
|
21265
|
-
if (string(ffd.cFileName) == "." || string(ffd.cFileName) == "..") {
|
|
21266
|
-
continue;
|
|
21267
|
-
}
|
|
21268
|
-
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
|
21269
|
-
// recurse to zap directory contents
|
|
21270
|
-
delete_dir_special_snowflake_windows(fs, fs.JoinPath(directory, ffd.cFileName));
|
|
21287
|
+
static void DeleteDirectoryRecursive(FileSystem &fs, string directory) {
|
|
21288
|
+
fs.ListFiles(directory, [&](const string &fname, bool is_directory) {
|
|
21289
|
+
if (is_directory) {
|
|
21290
|
+
DeleteDirectoryRecursive(fs, fs.JoinPath(directory, fname));
|
|
21271
21291
|
} else {
|
|
21272
|
-
|
|
21273
|
-
throw IOException("Pathname too long");
|
|
21274
|
-
}
|
|
21275
|
-
// create search pattern
|
|
21276
|
-
TCHAR del_path[MAX_PATH];
|
|
21277
|
-
snprintf(del_path, MAX_PATH, "%s\\%s", directory.c_str(), ffd.cFileName);
|
|
21278
|
-
if (!DeleteFileA(del_path)) {
|
|
21279
|
-
throw IOException("Failed to delete directory entry");
|
|
21280
|
-
}
|
|
21292
|
+
fs.RemoveFile(fs.JoinPath(directory, fname));
|
|
21281
21293
|
}
|
|
21282
|
-
}
|
|
21283
|
-
|
|
21284
|
-
|
|
21285
|
-
if (dwError != ERROR_NO_MORE_FILES) {
|
|
21286
|
-
throw IOException("Something went wrong");
|
|
21287
|
-
}
|
|
21288
|
-
FindClose(hFind);
|
|
21289
|
-
|
|
21290
|
-
if (!RemoveDirectoryA(directory.c_str())) {
|
|
21294
|
+
});
|
|
21295
|
+
auto unicode_path = WindowsUtil::UTF8ToUnicode(directory.c_str());
|
|
21296
|
+
if (!RemoveDirectoryW(unicode_path.c_str())) {
|
|
21291
21297
|
throw IOException("Failed to delete directory");
|
|
21292
21298
|
}
|
|
21293
21299
|
}
|
|
21294
21300
|
|
|
21295
21301
|
void LocalFileSystem::RemoveDirectory(const string &directory) {
|
|
21296
|
-
|
|
21302
|
+
if (FileExists(directory)) {
|
|
21303
|
+
throw IOException("Attempting to delete directory \"%s\", but it is a file and not a directory!", directory);
|
|
21304
|
+
}
|
|
21305
|
+
if (!DirectoryExists(directory)) {
|
|
21306
|
+
return;
|
|
21307
|
+
}
|
|
21308
|
+
DeleteDirectoryRecursive(*this, directory.c_str());
|
|
21297
21309
|
}
|
|
21298
21310
|
|
|
21299
21311
|
void LocalFileSystem::RemoveFile(const string &filename) {
|
|
21300
|
-
|
|
21312
|
+
auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str());
|
|
21313
|
+
DeleteFileW(unicode_path.c_str());
|
|
21301
21314
|
}
|
|
21302
21315
|
|
|
21303
21316
|
bool LocalFileSystem::ListFiles(const string &directory, const std::function<void(string, bool)> &callback) {
|
|
21304
21317
|
string search_dir = JoinPath(directory, "*");
|
|
21305
21318
|
|
|
21306
|
-
|
|
21307
|
-
|
|
21319
|
+
auto unicode_path = WindowsUtil::UTF8ToUnicode(search_dir.c_str());
|
|
21320
|
+
|
|
21321
|
+
WIN32_FIND_DATAW ffd;
|
|
21322
|
+
HANDLE hFind = FindFirstFileW(unicode_path.c_str(), &ffd);
|
|
21308
21323
|
if (hFind == INVALID_HANDLE_VALUE) {
|
|
21309
21324
|
return false;
|
|
21310
21325
|
}
|
|
21311
21326
|
do {
|
|
21312
|
-
string cFileName =
|
|
21327
|
+
string cFileName = WindowsUtil::UnicodeToUTF8(ffd.cFileName);
|
|
21313
21328
|
if (cFileName == "." || cFileName == "..") {
|
|
21314
21329
|
continue;
|
|
21315
21330
|
}
|
|
21316
21331
|
callback(cFileName, ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
|
|
21317
|
-
} while (
|
|
21332
|
+
} while (FindNextFileW(hFind, &ffd) != 0);
|
|
21318
21333
|
|
|
21319
21334
|
DWORD dwError = GetLastError();
|
|
21320
21335
|
if (dwError != ERROR_NO_MORE_FILES) {
|
|
@@ -21334,7 +21349,9 @@ void LocalFileSystem::FileSync(FileHandle &handle) {
|
|
|
21334
21349
|
}
|
|
21335
21350
|
|
|
21336
21351
|
void LocalFileSystem::MoveFile(const string &source, const string &target) {
|
|
21337
|
-
|
|
21352
|
+
auto source_unicode = WindowsUtil::UTF8ToUnicode(source.c_str());
|
|
21353
|
+
auto target_unicode = WindowsUtil::UTF8ToUnicode(target.c_str());
|
|
21354
|
+
if (!MoveFileW(source_unicode.c_str(), target_unicode.c_str())) {
|
|
21338
21355
|
throw IOException("Could not move file");
|
|
21339
21356
|
}
|
|
21340
21357
|
}
|
|
@@ -21345,7 +21362,7 @@ FileType LocalFileSystem::GetFileType(FileHandle &handle) {
|
|
|
21345
21362
|
if (strncmp(path.c_str(), PIPE_PREFIX, strlen(PIPE_PREFIX)) == 0) {
|
|
21346
21363
|
return FileType::FILE_TYPE_FIFO;
|
|
21347
21364
|
}
|
|
21348
|
-
DWORD attrs =
|
|
21365
|
+
DWORD attrs = WindowsGetFileAttributes(path.c_str());
|
|
21349
21366
|
if (attrs != INVALID_FILE_ATTRIBUTES) {
|
|
21350
21367
|
if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
|
|
21351
21368
|
return FileType::FILE_TYPE_DIR;
|
|
@@ -26256,13 +26273,29 @@ unique_ptr<FileHandle> PipeFileSystem::OpenPipe(unique_ptr<FileHandle> handle) {
|
|
|
26256
26273
|
} // namespace duckdb
|
|
26257
26274
|
|
|
26258
26275
|
|
|
26276
|
+
|
|
26277
|
+
|
|
26259
26278
|
#include <stdio.h>
|
|
26260
26279
|
|
|
26280
|
+
#ifndef DUCKDB_DISABLE_PRINT
|
|
26281
|
+
#ifdef DUCKDB_WINDOWS
|
|
26282
|
+
#include <io.h>
|
|
26283
|
+
#endif
|
|
26284
|
+
#endif
|
|
26285
|
+
|
|
26261
26286
|
namespace duckdb {
|
|
26262
26287
|
|
|
26263
26288
|
// LCOV_EXCL_START
|
|
26264
26289
|
void Printer::Print(const string &str) {
|
|
26265
26290
|
#ifndef DUCKDB_DISABLE_PRINT
|
|
26291
|
+
#ifdef DUCKDB_WINDOWS
|
|
26292
|
+
if (IsTerminal()) {
|
|
26293
|
+
// print utf8 to terminal
|
|
26294
|
+
auto unicode = WindowsUtil::UTF8ToMBCS(str.c_str());
|
|
26295
|
+
fprintf(stderr, "%s\n", unicode.c_str());
|
|
26296
|
+
return;
|
|
26297
|
+
}
|
|
26298
|
+
#endif
|
|
26266
26299
|
fprintf(stderr, "%s\n", str.c_str());
|
|
26267
26300
|
#endif
|
|
26268
26301
|
}
|
|
@@ -26283,6 +26316,17 @@ void Printer::FinishProgressBarPrint(const char *pbstr, int pbwidth) {
|
|
|
26283
26316
|
fflush(stdout);
|
|
26284
26317
|
#endif
|
|
26285
26318
|
}
|
|
26319
|
+
|
|
26320
|
+
bool Printer::IsTerminal() {
|
|
26321
|
+
#ifndef DUCKDB_DISABLE_PRINT
|
|
26322
|
+
#ifdef DUCKDB_WINDOWS
|
|
26323
|
+
return GetFileType(stderr) == FILE_TYPE_CHAR;
|
|
26324
|
+
#else
|
|
26325
|
+
throw InternalException("IsTerminal is only implemented for Windows");
|
|
26326
|
+
#endif
|
|
26327
|
+
#endif
|
|
26328
|
+
return false;
|
|
26329
|
+
}
|
|
26286
26330
|
// LCOV_EXCL_STOP
|
|
26287
26331
|
|
|
26288
26332
|
} // namespace duckdb
|
|
@@ -32284,19 +32328,19 @@ struct TreeRendererConfig {
|
|
|
32284
32328
|
bool detailed = false;
|
|
32285
32329
|
|
|
32286
32330
|
#ifndef DUCKDB_ASCII_TREE_RENDERER
|
|
32287
|
-
const char *LTCORNER = "┌";
|
|
32288
|
-
const char *RTCORNER = "┐";
|
|
32289
|
-
const char *LDCORNER = "└";
|
|
32290
|
-
const char *RDCORNER = "┘";
|
|
32291
|
-
|
|
32292
|
-
const char *MIDDLE = "┼";
|
|
32293
|
-
const char *TMIDDLE = "┬";
|
|
32294
|
-
const char *LMIDDLE = "├";
|
|
32295
|
-
const char *RMIDDLE = "┤";
|
|
32296
|
-
const char *DMIDDLE = "┴";
|
|
32297
|
-
|
|
32298
|
-
const char *VERTICAL = "│";
|
|
32299
|
-
const char *HORIZONTAL = "─";
|
|
32331
|
+
const char *LTCORNER = "\342\224\214"; // "┌";
|
|
32332
|
+
const char *RTCORNER = "\342\224\220"; // "┐";
|
|
32333
|
+
const char *LDCORNER = "\342\224\224"; // "└";
|
|
32334
|
+
const char *RDCORNER = "\342\224\230"; // "┘";
|
|
32335
|
+
|
|
32336
|
+
const char *MIDDLE = "\342\224\274"; // "┼";
|
|
32337
|
+
const char *TMIDDLE = "\342\224\254"; // "┬";
|
|
32338
|
+
const char *LMIDDLE = "\342\224\234"; // "├";
|
|
32339
|
+
const char *RMIDDLE = "\342\224\244"; // "┤";
|
|
32340
|
+
const char *DMIDDLE = "\342\224\264"; // "┴";
|
|
32341
|
+
|
|
32342
|
+
const char *VERTICAL = "\342\224\202"; // "│";
|
|
32343
|
+
const char *HORIZONTAL = "\342\224\200"; // "─";
|
|
32300
32344
|
#else
|
|
32301
32345
|
// ASCII version
|
|
32302
32346
|
const char *LTCORNER = "<";
|
|
@@ -43059,6 +43103,7 @@ struct EnumTypeInfo : public ExtraTypeInfo {
|
|
|
43059
43103
|
TypeCatalogEntry *catalog_entry = nullptr;
|
|
43060
43104
|
|
|
43061
43105
|
public:
|
|
43106
|
+
// Equalities are only used in enums with different catalog entries
|
|
43062
43107
|
bool Equals(ExtraTypeInfo *other_p) override {
|
|
43063
43108
|
if (!other_p) {
|
|
43064
43109
|
return false;
|
|
@@ -43067,9 +43112,12 @@ public:
|
|
|
43067
43112
|
return false;
|
|
43068
43113
|
}
|
|
43069
43114
|
auto &other = (EnumTypeInfo &)*other_p;
|
|
43070
|
-
|
|
43115
|
+
// We must check if all elements are equal
|
|
43116
|
+
if (other.values_insert_order == values_insert_order) {
|
|
43117
|
+
return true;
|
|
43118
|
+
}
|
|
43119
|
+
return false;
|
|
43071
43120
|
}
|
|
43072
|
-
|
|
43073
43121
|
void Serialize(Serializer &serializer) const override {
|
|
43074
43122
|
serializer.Write<uint32_t>(values_insert_order.size());
|
|
43075
43123
|
serializer.WriteString(enum_name);
|
|
@@ -47350,6 +47398,59 @@ unique_ptr<FileHandle> VirtualFileSystem::OpenFile(const string &path, uint8_t f
|
|
|
47350
47398
|
} // namespace duckdb
|
|
47351
47399
|
|
|
47352
47400
|
|
|
47401
|
+
namespace duckdb {
|
|
47402
|
+
|
|
47403
|
+
#ifdef DUCKDB_WINDOWS
|
|
47404
|
+
|
|
47405
|
+
std::wstring WindowsUtil::UTF8ToUnicode(const char *input) {
|
|
47406
|
+
idx_t result_size;
|
|
47407
|
+
|
|
47408
|
+
result_size = MultiByteToWideChar(CP_UTF8, 0, input, -1, nullptr, 0);
|
|
47409
|
+
if (result_size == 0) {
|
|
47410
|
+
throw IOException("Failure in MultiByteToWideChar");
|
|
47411
|
+
}
|
|
47412
|
+
auto buffer = unique_ptr<wchar_t[]>(new wchar_t[result_size]);
|
|
47413
|
+
result_size = MultiByteToWideChar(CP_UTF8, 0, input, -1, buffer.get(), result_size);
|
|
47414
|
+
if (result_size == 0) {
|
|
47415
|
+
throw IOException("Failure in MultiByteToWideChar");
|
|
47416
|
+
}
|
|
47417
|
+
return std::wstring(buffer.get(), result_size);
|
|
47418
|
+
}
|
|
47419
|
+
|
|
47420
|
+
static string WideCharToMultiByteWrapper(LPCWSTR input, uint32_t code_page) {
|
|
47421
|
+
idx_t result_size;
|
|
47422
|
+
|
|
47423
|
+
result_size = WideCharToMultiByte(code_page, 0, input, -1, 0, 0, 0, 0);
|
|
47424
|
+
if (result_size == 0) {
|
|
47425
|
+
throw IOException("Failure in WideCharToMultiByte");
|
|
47426
|
+
}
|
|
47427
|
+
auto buffer = unique_ptr<char[]>(new char[result_size]);
|
|
47428
|
+
result_size = WideCharToMultiByte(code_page, 0, input, -1, buffer.get(), result_size, 0, 0);
|
|
47429
|
+
if (result_size == 0) {
|
|
47430
|
+
throw IOException("Failure in WideCharToMultiByte");
|
|
47431
|
+
}
|
|
47432
|
+
return string(buffer.get(), result_size - 1);
|
|
47433
|
+
}
|
|
47434
|
+
|
|
47435
|
+
string WindowsUtil::UnicodeToUTF8(LPCWSTR input) {
|
|
47436
|
+
return WideCharToMultiByteWrapper(input, CP_UTF8);
|
|
47437
|
+
}
|
|
47438
|
+
|
|
47439
|
+
static string WindowsUnicodeToMBCS(LPCWSTR unicode_text, int use_ansi) {
|
|
47440
|
+
uint32_t code_page = use_ansi ? CP_ACP : CP_OEMCP;
|
|
47441
|
+
return WideCharToMultiByteWrapper(unicode_text, code_page);
|
|
47442
|
+
}
|
|
47443
|
+
|
|
47444
|
+
string WindowsUtil::UTF8ToMBCS(const char *input, bool use_ansi) {
|
|
47445
|
+
auto unicode = WindowsUtil::UTF8ToUnicode(input);
|
|
47446
|
+
return WindowsUnicodeToMBCS(unicode.c_str(), use_ansi);
|
|
47447
|
+
}
|
|
47448
|
+
|
|
47449
|
+
#endif
|
|
47450
|
+
|
|
47451
|
+
} // namespace duckdb
|
|
47452
|
+
|
|
47453
|
+
|
|
47353
47454
|
//===----------------------------------------------------------------------===//
|
|
47354
47455
|
// DuckDB
|
|
47355
47456
|
//
|
|
@@ -92554,6 +92655,7 @@ public:
|
|
|
92554
92655
|
} // namespace duckdb
|
|
92555
92656
|
|
|
92556
92657
|
|
|
92658
|
+
|
|
92557
92659
|
namespace duckdb {
|
|
92558
92660
|
|
|
92559
92661
|
struct StructExtractBindData : public FunctionData {
|
|
@@ -92617,12 +92719,12 @@ static unique_ptr<FunctionData> StructExtractBind(ClientContext &context, Scalar
|
|
|
92617
92719
|
|
|
92618
92720
|
if (key_child->return_type.id() != LogicalTypeId::VARCHAR ||
|
|
92619
92721
|
key_child->return_type.id() != LogicalTypeId::VARCHAR || !key_child->IsFoldable()) {
|
|
92620
|
-
throw
|
|
92722
|
+
throw BinderException("Key name for struct_extract needs to be a constant string");
|
|
92621
92723
|
}
|
|
92622
92724
|
Value key_val = ExpressionExecutor::EvaluateScalar(*key_child.get());
|
|
92623
92725
|
D_ASSERT(key_val.type().id() == LogicalTypeId::VARCHAR);
|
|
92624
92726
|
if (key_val.is_null || key_val.str_value.length() < 1) {
|
|
92625
|
-
throw
|
|
92727
|
+
throw BinderException("Key name for struct_extract needs to be neither NULL nor empty");
|
|
92626
92728
|
}
|
|
92627
92729
|
string key = StringUtil::Lower(key_val.str_value);
|
|
92628
92730
|
|
|
@@ -92632,15 +92734,23 @@ static unique_ptr<FunctionData> StructExtractBind(ClientContext &context, Scalar
|
|
|
92632
92734
|
|
|
92633
92735
|
for (size_t i = 0; i < struct_children.size(); i++) {
|
|
92634
92736
|
auto &child = struct_children[i];
|
|
92635
|
-
if (child.first == key) {
|
|
92737
|
+
if (StringUtil::Lower(child.first) == key) {
|
|
92636
92738
|
found_key = true;
|
|
92637
92739
|
key_index = i;
|
|
92638
92740
|
return_type = child.second;
|
|
92639
92741
|
break;
|
|
92640
92742
|
}
|
|
92641
92743
|
}
|
|
92744
|
+
|
|
92642
92745
|
if (!found_key) {
|
|
92643
|
-
|
|
92746
|
+
vector<string> candidates;
|
|
92747
|
+
candidates.reserve(struct_children.size());
|
|
92748
|
+
for (auto &struct_child : struct_children) {
|
|
92749
|
+
candidates.push_back(struct_child.first);
|
|
92750
|
+
}
|
|
92751
|
+
auto closest_settings = StringUtil::TopNLevenshtein(candidates, key);
|
|
92752
|
+
auto message = StringUtil::CandidatesMessage(closest_settings, "Candidate Entries");
|
|
92753
|
+
throw BinderException("Could not find key \"%s\" in struct\n%s", key, message);
|
|
92644
92754
|
}
|
|
92645
92755
|
|
|
92646
92756
|
bound_function.return_type = return_type;
|
|
@@ -92707,7 +92817,7 @@ static void StructPackFunction(DataChunk &args, ExpressionState &state, Vector &
|
|
|
92707
92817
|
|
|
92708
92818
|
static unique_ptr<FunctionData> StructPackBind(ClientContext &context, ScalarFunction &bound_function,
|
|
92709
92819
|
vector<unique_ptr<Expression>> &arguments) {
|
|
92710
|
-
|
|
92820
|
+
case_insensitive_set_t name_collision_set;
|
|
92711
92821
|
|
|
92712
92822
|
// collect names and deconflict, construct return type
|
|
92713
92823
|
if (arguments.empty()) {
|
|
@@ -138926,6 +139036,11 @@ void Binder::BindModifiers(OrderBinder &order_binder, QueryNode &statement, Boun
|
|
|
138926
139036
|
case ResultModifierType::DISTINCT_MODIFIER: {
|
|
138927
139037
|
auto &distinct = (DistinctModifier &)*mod;
|
|
138928
139038
|
auto bound_distinct = make_unique<BoundDistinctModifier>();
|
|
139039
|
+
if (distinct.distinct_on_targets.empty()) {
|
|
139040
|
+
for (idx_t i = 0; i < result.names.size(); i++) {
|
|
139041
|
+
distinct.distinct_on_targets.push_back(make_unique<ConstantExpression>(Value::INTEGER(1 + i)));
|
|
139042
|
+
}
|
|
139043
|
+
}
|
|
138929
139044
|
for (auto &distinct_on_target : distinct.distinct_on_targets) {
|
|
138930
139045
|
auto expr = BindOrderExpression(order_binder, move(distinct_on_target));
|
|
138931
139046
|
if (!expr) {
|
|
@@ -145907,7 +146022,7 @@ vector<ColumnBinding> LogicalOperator::MapBindings(const vector<ColumnBinding> &
|
|
|
145907
146022
|
}
|
|
145908
146023
|
}
|
|
145909
146024
|
|
|
145910
|
-
string LogicalOperator::ToString(
|
|
146025
|
+
string LogicalOperator::ToString() const {
|
|
145911
146026
|
TreeRenderer renderer;
|
|
145912
146027
|
return renderer.ToString(*this);
|
|
145913
146028
|
}
|
|
@@ -242576,7 +242691,7 @@ namespace duckdb_libpgquery {
|
|
|
242576
242691
|
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
242577
242692
|
|
|
242578
242693
|
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
|
242579
|
-
* if you want the limit (max/min) macros for int types.
|
|
242694
|
+
* if you want the limit (max/min) macros for int types.
|
|
242580
242695
|
*/
|
|
242581
242696
|
#ifndef __STDC_LIMIT_MACROS
|
|
242582
242697
|
#define __STDC_LIMIT_MACROS 1
|
|
@@ -242594,7 +242709,7 @@ typedef uint64_t flex_uint64_t;
|
|
|
242594
242709
|
typedef signed char flex_int8_t;
|
|
242595
242710
|
typedef short int flex_int16_t;
|
|
242596
242711
|
typedef int flex_int32_t;
|
|
242597
|
-
typedef unsigned char flex_uint8_t;
|
|
242712
|
+
typedef unsigned char flex_uint8_t;
|
|
242598
242713
|
typedef unsigned short int flex_uint16_t;
|
|
242599
242714
|
typedef unsigned int flex_uint32_t;
|
|
242600
242715
|
|
|
@@ -242718,10 +242833,10 @@ typedef size_t yy_size_t;
|
|
|
242718
242833
|
#define EOB_ACT_CONTINUE_SCAN 0
|
|
242719
242834
|
#define EOB_ACT_END_OF_FILE 1
|
|
242720
242835
|
#define EOB_ACT_LAST_MATCH 2
|
|
242721
|
-
|
|
242836
|
+
|
|
242722
242837
|
#define YY_LESS_LINENO(n)
|
|
242723
242838
|
#define YY_LINENO_REWIND_TO(ptr)
|
|
242724
|
-
|
|
242839
|
+
|
|
242725
242840
|
/* Return all but the first "n" matched characters back to the input stream. */
|
|
242726
242841
|
#define yyless(n) \
|
|
242727
242842
|
do \
|
|
@@ -243631,9 +243746,9 @@ static int yy_init_globals ( yyscan_t yyscanner );
|
|
|
243631
243746
|
/* This must go here because YYSTYPE and YYLTYPE are included
|
|
243632
243747
|
* from bison output in section 1.*/
|
|
243633
243748
|
# define yylval yyg->yylval_r
|
|
243634
|
-
|
|
243749
|
+
|
|
243635
243750
|
# define yylloc yyg->yylloc_r
|
|
243636
|
-
|
|
243751
|
+
|
|
243637
243752
|
int yylex_init (yyscan_t* scanner);
|
|
243638
243753
|
|
|
243639
243754
|
int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
|
|
@@ -243676,9 +243791,9 @@ YYSTYPE * yyget_lval ( yyscan_t yyscanner );
|
|
|
243676
243791
|
void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
|
|
243677
243792
|
|
|
243678
243793
|
YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
|
|
243679
|
-
|
|
243794
|
+
|
|
243680
243795
|
void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
|
|
243681
|
-
|
|
243796
|
+
|
|
243682
243797
|
/* Macros after this point can all be overridden by user definitions in
|
|
243683
243798
|
* section 1.
|
|
243684
243799
|
*/
|
|
@@ -243692,7 +243807,7 @@ extern int yywrap ( yyscan_t yyscanner );
|
|
|
243692
243807
|
#endif
|
|
243693
243808
|
|
|
243694
243809
|
#ifndef YY_NO_UNPUT
|
|
243695
|
-
|
|
243810
|
+
|
|
243696
243811
|
#endif
|
|
243697
243812
|
|
|
243698
243813
|
#ifndef yytext_ptr
|
|
@@ -245390,7 +245505,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
|
|
|
245390
245505
|
YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
|
|
245391
245506
|
{
|
|
245392
245507
|
YY_BUFFER_STATE b;
|
|
245393
|
-
|
|
245508
|
+
|
|
245394
245509
|
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
|
|
245395
245510
|
if ( ! b )
|
|
245396
245511
|
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
|
|
@@ -245456,7 +245571,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner)
|
|
|
245456
245571
|
}
|
|
245457
245572
|
|
|
245458
245573
|
b->yy_is_interactive = 0;
|
|
245459
|
-
|
|
245574
|
+
|
|
245460
245575
|
errno = oerrno;
|
|
245461
245576
|
}
|
|
245462
245577
|
|
|
@@ -245598,7 +245713,7 @@ static void yyensure_buffer_stack (yyscan_t yyscanner)
|
|
|
245598
245713
|
YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
|
|
245599
245714
|
{
|
|
245600
245715
|
YY_BUFFER_STATE b;
|
|
245601
|
-
|
|
245716
|
+
|
|
245602
245717
|
if ( size < 2 ||
|
|
245603
245718
|
base[size-2] != YY_END_OF_BUFFER_CHAR ||
|
|
245604
245719
|
base[size-1] != YY_END_OF_BUFFER_CHAR )
|
|
@@ -245634,7 +245749,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
|
|
|
245634
245749
|
*/
|
|
245635
245750
|
YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
|
|
245636
245751
|
{
|
|
245637
|
-
|
|
245752
|
+
|
|
245638
245753
|
return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
|
|
245639
245754
|
}
|
|
245640
245755
|
|
|
@@ -245651,7 +245766,7 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, yy_size_t _yybytes_len ,
|
|
|
245651
245766
|
char *buf;
|
|
245652
245767
|
yy_size_t n;
|
|
245653
245768
|
yy_size_t i;
|
|
245654
|
-
|
|
245769
|
+
|
|
245655
245770
|
/* Get memory for full buffer, including space for trailing EOB's. */
|
|
245656
245771
|
n = (yy_size_t) (_yybytes_len + 2);
|
|
245657
245772
|
buf = (char *) yyalloc( n , yyscanner );
|
|
@@ -245683,7 +245798,6 @@ static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
|
|
|
245683
245798
|
{
|
|
245684
245799
|
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
|
245685
245800
|
(void)yyg;
|
|
245686
|
-
fprintf( stderr, "%s\n", msg );
|
|
245687
245801
|
throw std::runtime_error(msg); // YY_EXIT_FAILURE );
|
|
245688
245802
|
}
|
|
245689
245803
|
|
|
@@ -245724,7 +245838,7 @@ int yyget_lineno (yyscan_t yyscanner)
|
|
|
245724
245838
|
|
|
245725
245839
|
if (! YY_CURRENT_BUFFER)
|
|
245726
245840
|
return 0;
|
|
245727
|
-
|
|
245841
|
+
|
|
245728
245842
|
return yylineno;
|
|
245729
245843
|
}
|
|
245730
245844
|
|
|
@@ -245737,7 +245851,7 @@ int yyget_column (yyscan_t yyscanner)
|
|
|
245737
245851
|
|
|
245738
245852
|
if (! YY_CURRENT_BUFFER)
|
|
245739
245853
|
return 0;
|
|
245740
|
-
|
|
245854
|
+
|
|
245741
245855
|
return yycolumn;
|
|
245742
245856
|
}
|
|
245743
245857
|
|
|
@@ -245799,7 +245913,7 @@ void yyset_lineno (int _line_number , yyscan_t yyscanner)
|
|
|
245799
245913
|
/* lineno is only valid if an input buffer exists. */
|
|
245800
245914
|
if (! YY_CURRENT_BUFFER )
|
|
245801
245915
|
YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
|
|
245802
|
-
|
|
245916
|
+
|
|
245803
245917
|
yylineno = _line_number;
|
|
245804
245918
|
}
|
|
245805
245919
|
|
|
@@ -245814,7 +245928,7 @@ void yyset_column (int _column_no , yyscan_t yyscanner)
|
|
|
245814
245928
|
/* column is only valid if an input buffer exists. */
|
|
245815
245929
|
if (! YY_CURRENT_BUFFER )
|
|
245816
245930
|
YY_FATAL_ERROR( "yyset_column called with no buffer" );
|
|
245817
|
-
|
|
245931
|
+
|
|
245818
245932
|
yycolumn = _column_no;
|
|
245819
245933
|
}
|
|
245820
245934
|
|
|
@@ -245867,13 +245981,13 @@ YYLTYPE *yyget_lloc (yyscan_t yyscanner)
|
|
|
245867
245981
|
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
|
245868
245982
|
return yylloc;
|
|
245869
245983
|
}
|
|
245870
|
-
|
|
245984
|
+
|
|
245871
245985
|
void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
|
|
245872
245986
|
{
|
|
245873
245987
|
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
|
245874
245988
|
yylloc = yylloc_param;
|
|
245875
245989
|
}
|
|
245876
|
-
|
|
245990
|
+
|
|
245877
245991
|
/* User-visible API */
|
|
245878
245992
|
|
|
245879
245993
|
/* yylex_init is special because it creates the scanner itself, so it is
|
|
@@ -245953,13 +246067,8 @@ static int yy_init_globals (yyscan_t yyscanner)
|
|
|
245953
246067
|
yyg->yy_start_stack = NULL;
|
|
245954
246068
|
|
|
245955
246069
|
/* Defined in main.c */
|
|
245956
|
-
#ifdef YY_STDINIT
|
|
245957
|
-
yyin = stdin;
|
|
245958
|
-
yyout = stdout;
|
|
245959
|
-
#else
|
|
245960
246070
|
yyin = NULL;
|
|
245961
246071
|
yyout = NULL;
|
|
245962
|
-
#endif
|
|
245963
246072
|
|
|
245964
246073
|
/* For future reference: Set errno on error, since we are called by
|
|
245965
246074
|
* yylex_init()
|
package/src/duckdb.hpp
CHANGED
|
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
10
10
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
|
-
#define DUCKDB_SOURCE_ID "
|
|
14
|
-
#define DUCKDB_VERSION "0.3.2-
|
|
13
|
+
#define DUCKDB_SOURCE_ID "5e06605e3"
|
|
14
|
+
#define DUCKDB_VERSION "0.3.2-dev151"
|
|
15
15
|
//===----------------------------------------------------------------------===//
|
|
16
16
|
// DuckDB
|
|
17
17
|
//
|
|
@@ -198,6 +198,12 @@ enum class ProfilerPrintFormat : uint8_t { NONE, QUERY_TREE, JSON, QUERY_TREE_OP
|
|
|
198
198
|
#define suint64_t int64_t
|
|
199
199
|
#endif
|
|
200
200
|
|
|
201
|
+
#if defined(_WIN32) || defined(_WIN64)
|
|
202
|
+
#define DUCKDB_WINDOWS
|
|
203
|
+
#elif defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))
|
|
204
|
+
#define DUCKDB_POSIX
|
|
205
|
+
#endif
|
|
206
|
+
|
|
201
207
|
namespace duckdb {
|
|
202
208
|
#if !defined(_MSC_VER) && (__cplusplus < 201402L)
|
|
203
209
|
template <typename T, typename... Args>
|
|
@@ -7983,7 +7989,7 @@ public:
|
|
|
7983
7989
|
|
|
7984
7990
|
virtual string GetName() const;
|
|
7985
7991
|
virtual string ParamsToString() const;
|
|
7986
|
-
virtual string ToString(
|
|
7992
|
+
virtual string ToString() const;
|
|
7987
7993
|
void Print();
|
|
7988
7994
|
//! Debug method: verify that the integrity of expressions & child nodes are maintained
|
|
7989
7995
|
virtual void Verify();
|
|
@@ -9470,6 +9476,8 @@ public:
|
|
|
9470
9476
|
static void PrintProgress(int percentage, const char *pbstr, int pbwidth);
|
|
9471
9477
|
//! Prints an empty line when progress bar is done
|
|
9472
9478
|
static void FinishProgressBarPrint(const char *pbstr, int pbwidth);
|
|
9479
|
+
//! Whether or not we are printing to a terminal
|
|
9480
|
+
static bool IsTerminal();
|
|
9473
9481
|
};
|
|
9474
9482
|
} // namespace duckdb
|
|
9475
9483
|
|