duckdb 0.10.3-dev6.0 → 1.0.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/lib/duckdb.js +11 -0
- package/package.json +1 -1
- package/src/duckdb/extension/parquet/parquet_extension.cpp +7 -1
- package/src/duckdb/src/catalog/dependency_manager.cpp +4 -0
- package/src/duckdb/src/common/enum_util.cpp +29 -0
- package/src/duckdb/src/common/error_data.cpp +5 -2
- package/src/duckdb/src/common/local_file_system.cpp +5 -0
- package/src/duckdb/src/common/multi_file_reader.cpp +3 -0
- package/src/duckdb/src/common/printer.cpp +1 -1
- package/src/duckdb/src/common/string_util.cpp +1 -1
- package/src/duckdb/src/core_functions/aggregate/holistic/approximate_quantile.cpp +14 -5
- package/src/duckdb/src/core_functions/aggregate/holistic/quantile.cpp +11 -3
- package/src/duckdb/src/execution/operator/helper/physical_load.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/physical_copy_database.cpp +3 -1
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +13 -10
- package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +2 -3
- package/src/duckdb/src/function/table/version/pragma_version.cpp +5 -5
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/enums/copy_overwrite_mode.hpp +18 -0
- package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/shared_ptr.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +6 -0
- package/src/duckdb/src/include/duckdb/main/config.hpp +4 -0
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +6 -6
- package/src/duckdb/src/include/duckdb/main/settings.hpp +20 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +7 -7
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +7 -0
- package/src/duckdb/src/include/duckdb.h +126 -4
- package/src/duckdb/src/main/attached_database.cpp +7 -6
- package/src/duckdb/src/main/capi/stream-c.cpp +17 -8
- package/src/duckdb/src/main/capi/table_function-c.cpp +11 -7
- package/src/duckdb/src/main/config.cpp +2 -0
- package/src/duckdb/src/main/extension/extension_helper.cpp +3 -25
- package/src/duckdb/src/main/extension/extension_install.cpp +10 -6
- package/src/duckdb/src/main/settings/settings.cpp +32 -0
- package/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/move_constants.cpp +4 -0
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +17 -4
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +26 -15
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +29 -11
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +3 -3
- package/src/duckdb/src/storage/storage_manager.cpp +17 -8
- package/test/query_result.test.ts +9 -0
- package/test/replacement_scan.test.ts +2 -0
- /package/src/duckdb/src/include/duckdb/common/{enable_shared_from_this.ipp → enable_shared_from_this_ipp.hpp} +0 -0
- /package/src/duckdb/src/include/duckdb/common/{shared_ptr.ipp → shared_ptr_ipp.hpp} +0 -0
- /package/src/duckdb/src/include/duckdb/common/{weak_ptr.ipp → weak_ptr_ipp.hpp} +0 -0
package/lib/duckdb.js
CHANGED
@@ -530,6 +530,17 @@ Database.prototype.each = function () {
|
|
530
530
|
return this;
|
531
531
|
}
|
532
532
|
|
533
|
+
|
534
|
+
/**
|
535
|
+
* @arg sql
|
536
|
+
* @param {...*} params
|
537
|
+
* @yields row chunks
|
538
|
+
*/
|
539
|
+
Database.prototype.stream = function() {
|
540
|
+
return default_connection(this).stream.apply(this.default_connection, arguments);
|
541
|
+
}
|
542
|
+
|
543
|
+
|
533
544
|
/**
|
534
545
|
* Convenience method for Connection#apply using a built-in default connection
|
535
546
|
* @arg sql
|
package/package.json
CHANGED
@@ -651,7 +651,13 @@ public:
|
|
651
651
|
bool require_extra_columns =
|
652
652
|
result->multi_file_reader_state && result->multi_file_reader_state->RequiresExtraColumns();
|
653
653
|
if (input.CanRemoveFilterColumns() || require_extra_columns) {
|
654
|
-
|
654
|
+
if (!input.projection_ids.empty()) {
|
655
|
+
result->projection_ids = input.projection_ids;
|
656
|
+
} else {
|
657
|
+
result->projection_ids.resize(input.column_ids.size());
|
658
|
+
iota(begin(result->projection_ids), end(result->projection_ids), 0);
|
659
|
+
}
|
660
|
+
|
655
661
|
const auto table_types = bind_data.types;
|
656
662
|
for (const auto &col_idx : input.column_ids) {
|
657
663
|
if (IsRowIdColumnId(col_idx)) {
|
@@ -18,6 +18,7 @@
|
|
18
18
|
#include "duckdb/common/enums/catalog_lookup_behavior.hpp"
|
19
19
|
#include "duckdb/common/enums/catalog_type.hpp"
|
20
20
|
#include "duckdb/common/enums/compression_type.hpp"
|
21
|
+
#include "duckdb/common/enums/copy_overwrite_mode.hpp"
|
21
22
|
#include "duckdb/common/enums/cte_materialize.hpp"
|
22
23
|
#include "duckdb/common/enums/date_part_specifier.hpp"
|
23
24
|
#include "duckdb/common/enums/debug_initialize.hpp"
|
@@ -1306,6 +1307,34 @@ ConstraintType EnumUtil::FromString<ConstraintType>(const char *value) {
|
|
1306
1307
|
throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented", value));
|
1307
1308
|
}
|
1308
1309
|
|
1310
|
+
template<>
|
1311
|
+
const char* EnumUtil::ToChars<CopyOverwriteMode>(CopyOverwriteMode value) {
|
1312
|
+
switch(value) {
|
1313
|
+
case CopyOverwriteMode::COPY_ERROR_ON_CONFLICT:
|
1314
|
+
return "COPY_ERROR_ON_CONFLICT";
|
1315
|
+
case CopyOverwriteMode::COPY_OVERWRITE:
|
1316
|
+
return "COPY_OVERWRITE";
|
1317
|
+
case CopyOverwriteMode::COPY_OVERWRITE_OR_IGNORE:
|
1318
|
+
return "COPY_OVERWRITE_OR_IGNORE";
|
1319
|
+
default:
|
1320
|
+
throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented", value));
|
1321
|
+
}
|
1322
|
+
}
|
1323
|
+
|
1324
|
+
template<>
|
1325
|
+
CopyOverwriteMode EnumUtil::FromString<CopyOverwriteMode>(const char *value) {
|
1326
|
+
if (StringUtil::Equals(value, "COPY_ERROR_ON_CONFLICT")) {
|
1327
|
+
return CopyOverwriteMode::COPY_ERROR_ON_CONFLICT;
|
1328
|
+
}
|
1329
|
+
if (StringUtil::Equals(value, "COPY_OVERWRITE")) {
|
1330
|
+
return CopyOverwriteMode::COPY_OVERWRITE;
|
1331
|
+
}
|
1332
|
+
if (StringUtil::Equals(value, "COPY_OVERWRITE_OR_IGNORE")) {
|
1333
|
+
return CopyOverwriteMode::COPY_OVERWRITE_OR_IGNORE;
|
1334
|
+
}
|
1335
|
+
throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented", value));
|
1336
|
+
}
|
1337
|
+
|
1309
1338
|
template<>
|
1310
1339
|
const char* EnumUtil::ToChars<DataFileType>(DataFileType value) {
|
1311
1340
|
switch(value) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#include "duckdb/common/error_data.hpp"
|
2
|
-
#include "duckdb/common/exception.hpp"
|
3
2
|
|
3
|
+
#include "duckdb/common/exception.hpp"
|
4
4
|
#include "duckdb/common/string_util.hpp"
|
5
5
|
#include "duckdb/common/to_string.hpp"
|
6
6
|
#include "duckdb/common/types.hpp"
|
@@ -50,7 +50,10 @@ ErrorData::ErrorData(const string &message) : initialized(true), type(ExceptionT
|
|
50
50
|
|
51
51
|
const string &ErrorData::Message() {
|
52
52
|
if (final_message.empty()) {
|
53
|
-
|
53
|
+
if (type != ExceptionType::UNKNOWN_TYPE) {
|
54
|
+
final_message = Exception::ExceptionTypeToString(type) + " ";
|
55
|
+
}
|
56
|
+
final_message += "Error: " + raw_message;
|
54
57
|
if (type == ExceptionType::INTERNAL) {
|
55
58
|
final_message += "\nThis error signals an assertion failure within DuckDB. This usually occurs due to "
|
56
59
|
"unexpected conditions or errors in the program's logic.\nFor more information, see "
|
@@ -485,9 +485,14 @@ int64_t LocalFileSystem::Write(FileHandle &handle, void *buffer, int64_t nr_byte
|
|
485
485
|
|
486
486
|
bool LocalFileSystem::Trim(FileHandle &handle, idx_t offset_bytes, idx_t length_bytes) {
|
487
487
|
#if defined(__linux__)
|
488
|
+
// FALLOC_FL_PUNCH_HOLE requires glibc 2.18 or up
|
489
|
+
#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 18)
|
490
|
+
return false;
|
491
|
+
#else
|
488
492
|
int fd = handle.Cast<UnixFileHandle>().fd;
|
489
493
|
int res = fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, offset_bytes, length_bytes);
|
490
494
|
return res == 0;
|
495
|
+
#endif
|
491
496
|
#else
|
492
497
|
return false;
|
493
498
|
#endif
|
@@ -62,7 +62,7 @@ idx_t Printer::TerminalWidth() {
|
|
62
62
|
#ifndef DUCKDB_DISABLE_PRINT
|
63
63
|
#ifdef DUCKDB_WINDOWS
|
64
64
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
65
|
-
int
|
65
|
+
int rows;
|
66
66
|
|
67
67
|
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
|
68
68
|
rows = csbi.srWindow.Right - csbi.srWindow.Left + 1;
|
@@ -246,7 +246,7 @@ bool StringUtil::CIEquals(const string &l1, const string &l2) {
|
|
246
246
|
bool StringUtil::CILessThan(const string &s1, const string &s2) {
|
247
247
|
const auto charmap = UpperFun::ASCII_TO_UPPER_MAP;
|
248
248
|
|
249
|
-
unsigned char u1, u2;
|
249
|
+
unsigned char u1 {}, u2 {};
|
250
250
|
|
251
251
|
idx_t length = MinValue<idx_t>(s1.length(), s2.length());
|
252
252
|
length += s1.length() != s2.length();
|
@@ -181,16 +181,25 @@ unique_ptr<FunctionData> BindApproxQuantile(ClientContext &context, AggregateFun
|
|
181
181
|
throw BinderException("APPROXIMATE QUANTILE can only take constant quantile parameters");
|
182
182
|
}
|
183
183
|
Value quantile_val = ExpressionExecutor::EvaluateScalar(context, *arguments[1]);
|
184
|
+
if (quantile_val.IsNull()) {
|
185
|
+
throw BinderException("APPROXIMATE QUANTILE parameter list cannot be NULL");
|
186
|
+
}
|
184
187
|
|
185
188
|
vector<float> quantiles;
|
186
|
-
|
187
|
-
|
188
|
-
} else if (quantile_val.IsNull()) {
|
189
|
-
throw BinderException("APPROXIMATE QUANTILE parameter list cannot be NULL");
|
190
|
-
} else {
|
189
|
+
switch (quantile_val.type().id()) {
|
190
|
+
case LogicalTypeId::LIST:
|
191
191
|
for (const auto &element_val : ListValue::GetChildren(quantile_val)) {
|
192
192
|
quantiles.push_back(CheckApproxQuantile(element_val));
|
193
193
|
}
|
194
|
+
break;
|
195
|
+
case LogicalTypeId::ARRAY:
|
196
|
+
for (const auto &element_val : ArrayValue::GetChildren(quantile_val)) {
|
197
|
+
quantiles.push_back(CheckApproxQuantile(element_val));
|
198
|
+
}
|
199
|
+
break;
|
200
|
+
default:
|
201
|
+
quantiles.push_back(CheckApproxQuantile(quantile_val));
|
202
|
+
break;
|
194
203
|
}
|
195
204
|
|
196
205
|
// remove the quantile argument so we can use the unary aggregate
|
@@ -1509,12 +1509,20 @@ unique_ptr<FunctionData> BindQuantile(ClientContext &context, AggregateFunction
|
|
1509
1509
|
throw BinderException("QUANTILE argument must not be NULL");
|
1510
1510
|
}
|
1511
1511
|
vector<Value> quantiles;
|
1512
|
-
|
1513
|
-
|
1514
|
-
} else {
|
1512
|
+
switch (quantile_val.type().id()) {
|
1513
|
+
case LogicalTypeId::LIST:
|
1515
1514
|
for (const auto &element_val : ListValue::GetChildren(quantile_val)) {
|
1516
1515
|
quantiles.push_back(CheckQuantile(element_val));
|
1517
1516
|
}
|
1517
|
+
break;
|
1518
|
+
case LogicalTypeId::ARRAY:
|
1519
|
+
for (const auto &element_val : ArrayValue::GetChildren(quantile_val)) {
|
1520
|
+
quantiles.push_back(CheckQuantile(element_val));
|
1521
|
+
}
|
1522
|
+
break;
|
1523
|
+
default:
|
1524
|
+
quantiles.push_back(CheckQuantile(quantile_val));
|
1525
|
+
break;
|
1518
1526
|
}
|
1519
1527
|
|
1520
1528
|
Function::EraseArgument(function, arguments, arguments.size() - 1);
|
@@ -17,14 +17,14 @@ static void InstallFromRepository(ClientContext &context, const LoadInfo &info)
|
|
17
17
|
}
|
18
18
|
|
19
19
|
ExtensionHelper::InstallExtension(context, info.filename, info.load_type == LoadType::FORCE_INSTALL, repository,
|
20
|
-
info.version);
|
20
|
+
true, info.version);
|
21
21
|
}
|
22
22
|
|
23
23
|
SourceResultType PhysicalLoad::GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const {
|
24
24
|
if (info->load_type == LoadType::INSTALL || info->load_type == LoadType::FORCE_INSTALL) {
|
25
25
|
if (info->repository.empty()) {
|
26
26
|
ExtensionHelper::InstallExtension(context.client, info->filename,
|
27
|
-
info->load_type == LoadType::FORCE_INSTALL, nullptr, info->version);
|
27
|
+
info->load_type == LoadType::FORCE_INSTALL, nullptr, true, info->version);
|
28
28
|
} else {
|
29
29
|
InstallFromRepository(context.client, *info);
|
30
30
|
}
|
@@ -49,8 +49,10 @@ SourceResultType PhysicalCopyDatabase::GetData(ExecutionContext &context, DataCh
|
|
49
49
|
catalog.CreateTable(context.client, *bound_info);
|
50
50
|
break;
|
51
51
|
}
|
52
|
+
case CatalogType::INDEX_ENTRY:
|
52
53
|
default:
|
53
|
-
throw
|
54
|
+
throw NotImplementedException("Entry type %s not supported in PhysicalCopyDatabase",
|
55
|
+
CatalogTypeToString(create_info->type));
|
54
56
|
}
|
55
57
|
}
|
56
58
|
return SourceResultType::FINISHED;
|
@@ -228,12 +228,16 @@ unique_ptr<LocalSinkState> PhysicalCopyToFile::GetLocalSinkState(ExecutionContex
|
|
228
228
|
return std::move(res);
|
229
229
|
}
|
230
230
|
|
231
|
-
void CheckDirectory(FileSystem &fs, const string &file_path,
|
232
|
-
if (
|
233
|
-
// we
|
234
|
-
// as remote file systems (e.g. S3) do not support RemoveFile
|
231
|
+
void CheckDirectory(FileSystem &fs, const string &file_path, CopyOverwriteMode overwrite_mode) {
|
232
|
+
if (overwrite_mode == CopyOverwriteMode::COPY_OVERWRITE_OR_IGNORE) {
|
233
|
+
// with overwrite or ignore we fully ignore the presence of any files instead of erasing them
|
235
234
|
return;
|
236
235
|
}
|
236
|
+
if (fs.IsRemoteFile(file_path) && overwrite_mode == CopyOverwriteMode::COPY_OVERWRITE) {
|
237
|
+
// we can only remove files for local file systems currently
|
238
|
+
// as remote file systems (e.g. S3) do not support RemoveFile
|
239
|
+
throw NotImplementedException("OVERWRITE is not supported for remote file systems");
|
240
|
+
}
|
237
241
|
vector<string> file_list;
|
238
242
|
vector<string> directory_list;
|
239
243
|
directory_list.push_back(file_path);
|
@@ -251,13 +255,12 @@ void CheckDirectory(FileSystem &fs, const string &file_path, bool overwrite) {
|
|
251
255
|
if (file_list.empty()) {
|
252
256
|
return;
|
253
257
|
}
|
254
|
-
if (
|
258
|
+
if (overwrite_mode == CopyOverwriteMode::COPY_OVERWRITE) {
|
255
259
|
for (auto &file : file_list) {
|
256
260
|
fs.RemoveFile(file);
|
257
261
|
}
|
258
262
|
} else {
|
259
|
-
throw IOException("Directory \"%s\" is not empty! Enable
|
260
|
-
file_path);
|
263
|
+
throw IOException("Directory \"%s\" is not empty! Enable OVERWRITE option to overwrite files", file_path);
|
261
264
|
}
|
262
265
|
}
|
263
266
|
|
@@ -272,11 +275,11 @@ unique_ptr<GlobalSinkState> PhysicalCopyToFile::GetGlobalSinkState(ClientContext
|
|
272
275
|
throw IOException("Cannot write to \"%s\" - it exists and is a file, not a directory!", file_path);
|
273
276
|
} else {
|
274
277
|
// for local files we can remove the file if OVERWRITE_OR_IGNORE is enabled
|
275
|
-
if (
|
278
|
+
if (overwrite_mode == CopyOverwriteMode::COPY_OVERWRITE) {
|
276
279
|
fs.RemoveFile(file_path);
|
277
280
|
} else {
|
278
281
|
throw IOException("Cannot write to \"%s\" - it exists and is a file, not a directory! Enable "
|
279
|
-
"
|
282
|
+
"OVERWRITE option to overwrite the file",
|
280
283
|
file_path);
|
281
284
|
}
|
282
285
|
}
|
@@ -285,7 +288,7 @@ unique_ptr<GlobalSinkState> PhysicalCopyToFile::GetGlobalSinkState(ClientContext
|
|
285
288
|
if (!fs.DirectoryExists(file_path)) {
|
286
289
|
fs.CreateDirectory(file_path);
|
287
290
|
} else {
|
288
|
-
CheckDirectory(fs, file_path,
|
291
|
+
CheckDirectory(fs, file_path, overwrite_mode);
|
289
292
|
}
|
290
293
|
|
291
294
|
auto state = make_uniq<CopyToFunctionGlobalState>(nullptr);
|
@@ -17,7 +17,7 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalCopyToFile
|
|
17
17
|
op.file_path = fs.JoinPath(path, "tmp_" + base);
|
18
18
|
}
|
19
19
|
if (op.per_thread_output || op.file_size_bytes.IsValid() || op.partition_output || !op.partition_columns.empty() ||
|
20
|
-
op.
|
20
|
+
op.overwrite_mode != CopyOverwriteMode::COPY_ERROR_ON_CONFLICT) {
|
21
21
|
// hive-partitioning/per-thread output does not care about insertion order, and does not support batch indexes
|
22
22
|
preserve_insertion_order = false;
|
23
23
|
supports_batch_index = false;
|
@@ -42,7 +42,7 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalCopyToFile
|
|
42
42
|
auto copy = make_uniq<PhysicalCopyToFile>(op.types, op.function, std::move(op.bind_data), op.estimated_cardinality);
|
43
43
|
copy->file_path = op.file_path;
|
44
44
|
copy->use_tmp_file = op.use_tmp_file;
|
45
|
-
copy->
|
45
|
+
copy->overwrite_mode = op.overwrite_mode;
|
46
46
|
copy->filename_pattern = op.filename_pattern;
|
47
47
|
copy->file_extension = op.file_extension;
|
48
48
|
copy->per_thread_output = op.per_thread_output;
|
@@ -125,7 +125,7 @@ unique_ptr<GlobalTableFunctionState> DuckDBExtensionsInit(ClientContext &context
|
|
125
125
|
if (entry == installed_extensions.end()) {
|
126
126
|
installed_extensions[info.name] = std::move(info);
|
127
127
|
} else {
|
128
|
-
if (
|
128
|
+
if (entry->second.install_mode != ExtensionInstallMode::STATICALLY_LINKED) {
|
129
129
|
entry->second.file_path = info.file_path;
|
130
130
|
entry->second.install_mode = info.install_mode;
|
131
131
|
entry->second.installed_from = info.installed_from;
|
@@ -144,13 +144,12 @@ unique_ptr<GlobalTableFunctionState> DuckDBExtensionsInit(ClientContext &context
|
|
144
144
|
auto &ext_info = e.second;
|
145
145
|
auto entry = installed_extensions.find(ext_name);
|
146
146
|
if (entry == installed_extensions.end() || !entry->second.installed) {
|
147
|
-
ExtensionInformation info;
|
147
|
+
ExtensionInformation &info = installed_extensions[ext_name];
|
148
148
|
info.name = ext_name;
|
149
149
|
info.loaded = true;
|
150
150
|
info.extension_version = ext_info.version;
|
151
151
|
info.installed = ext_info.mode == ExtensionInstallMode::STATICALLY_LINKED;
|
152
152
|
info.install_mode = ext_info.mode;
|
153
|
-
installed_extensions[ext_name] = std::move(info);
|
154
153
|
} else {
|
155
154
|
entry->second.loaded = true;
|
156
155
|
entry->second.extension_version = ext_info.version;
|
@@ -1,17 +1,17 @@
|
|
1
1
|
#ifndef DUCKDB_PATCH_VERSION
|
2
|
-
#define DUCKDB_PATCH_VERSION "
|
2
|
+
#define DUCKDB_PATCH_VERSION "0"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_MINOR_VERSION
|
5
|
-
#define DUCKDB_MINOR_VERSION
|
5
|
+
#define DUCKDB_MINOR_VERSION 0
|
6
6
|
#endif
|
7
7
|
#ifndef DUCKDB_MAJOR_VERSION
|
8
|
-
#define DUCKDB_MAJOR_VERSION
|
8
|
+
#define DUCKDB_MAJOR_VERSION 1
|
9
9
|
#endif
|
10
10
|
#ifndef DUCKDB_VERSION
|
11
|
-
#define DUCKDB_VERSION "
|
11
|
+
#define DUCKDB_VERSION "v1.0.0"
|
12
12
|
#endif
|
13
13
|
#ifndef DUCKDB_SOURCE_ID
|
14
|
-
#define DUCKDB_SOURCE_ID "
|
14
|
+
#define DUCKDB_SOURCE_ID "1f98600c2c"
|
15
15
|
#endif
|
16
16
|
#include "duckdb/function/table/system_functions.hpp"
|
17
17
|
#include "duckdb/main/database.hpp"
|
@@ -98,6 +98,8 @@ enum class ConflictManagerMode : uint8_t;
|
|
98
98
|
|
99
99
|
enum class ConstraintType : uint8_t;
|
100
100
|
|
101
|
+
enum class CopyOverwriteMode : uint8_t;
|
102
|
+
|
101
103
|
enum class DataFileType : uint8_t;
|
102
104
|
|
103
105
|
enum class DatePartSpecifier : uint8_t;
|
@@ -434,6 +436,9 @@ const char* EnumUtil::ToChars<ConflictManagerMode>(ConflictManagerMode value);
|
|
434
436
|
template<>
|
435
437
|
const char* EnumUtil::ToChars<ConstraintType>(ConstraintType value);
|
436
438
|
|
439
|
+
template<>
|
440
|
+
const char* EnumUtil::ToChars<CopyOverwriteMode>(CopyOverwriteMode value);
|
441
|
+
|
437
442
|
template<>
|
438
443
|
const char* EnumUtil::ToChars<DataFileType>(DataFileType value);
|
439
444
|
|
@@ -888,6 +893,9 @@ ConflictManagerMode EnumUtil::FromString<ConflictManagerMode>(const char *value)
|
|
888
893
|
template<>
|
889
894
|
ConstraintType EnumUtil::FromString<ConstraintType>(const char *value);
|
890
895
|
|
896
|
+
template<>
|
897
|
+
CopyOverwriteMode EnumUtil::FromString<CopyOverwriteMode>(const char *value);
|
898
|
+
|
891
899
|
template<>
|
892
900
|
DataFileType EnumUtil::FromString<DataFileType>(const char *value);
|
893
901
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
2
|
+
// DuckDB
|
3
|
+
//
|
4
|
+
// duckdb/common/enums/copy_overwrite_mode.hpp
|
5
|
+
//
|
6
|
+
//
|
7
|
+
//===----------------------------------------------------------------------===//
|
8
|
+
|
9
|
+
#pragma once
|
10
|
+
|
11
|
+
#include "duckdb/common/constants.hpp"
|
12
|
+
#include "duckdb/common/vector.hpp"
|
13
|
+
|
14
|
+
namespace duckdb {
|
15
|
+
|
16
|
+
enum class CopyOverwriteMode : uint8_t { COPY_ERROR_ON_CONFLICT = 0, COPY_OVERWRITE = 1, COPY_OVERWRITE_OR_IGNORE = 2 };
|
17
|
+
|
18
|
+
} // namespace duckdb
|
@@ -52,6 +52,7 @@ struct MultiFileReaderBindData {
|
|
52
52
|
struct MultiFileReaderGlobalState {
|
53
53
|
MultiFileReaderGlobalState(vector<LogicalType> extra_columns_p, optional_ptr<const MultiFileList> file_list_p)
|
54
54
|
: extra_columns(std::move(extra_columns_p)), file_list(file_list_p) {};
|
55
|
+
virtual ~MultiFileReaderGlobalState();
|
55
56
|
|
56
57
|
//! extra columns that will be produced during scanning
|
57
58
|
const vector<LogicalType> extra_columns;
|
@@ -37,9 +37,9 @@ struct compatible_with_t : std::is_convertible<U *, T *> {}; // NOLINT: invalid
|
|
37
37
|
|
38
38
|
} // namespace duckdb
|
39
39
|
|
40
|
-
#include "duckdb/common/
|
41
|
-
#include "duckdb/common/
|
42
|
-
#include "duckdb/common/
|
40
|
+
#include "duckdb/common/shared_ptr_ipp.hpp"
|
41
|
+
#include "duckdb/common/weak_ptr_ipp.hpp"
|
42
|
+
#include "duckdb/common/enable_shared_from_this_ipp.hpp"
|
43
43
|
|
44
44
|
namespace duckdb {
|
45
45
|
|
package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
#include "duckdb/execution/physical_operator.hpp"
|
14
14
|
#include "duckdb/function/copy_function.hpp"
|
15
15
|
#include "duckdb/parser/parsed_data/copy_info.hpp"
|
16
|
+
#include "duckdb/common/enums/copy_overwrite_mode.hpp"
|
16
17
|
|
17
18
|
namespace duckdb {
|
18
19
|
|
@@ -31,7 +32,7 @@ public:
|
|
31
32
|
bool use_tmp_file;
|
32
33
|
FilenamePattern filename_pattern;
|
33
34
|
string file_extension;
|
34
|
-
|
35
|
+
CopyOverwriteMode overwrite_mode;
|
35
36
|
bool parallel;
|
36
37
|
bool per_thread_output;
|
37
38
|
optional_idx file_size_bytes;
|
@@ -54,6 +54,11 @@ public:
|
|
54
54
|
DatabaseInstance &GetDatabase() {
|
55
55
|
return db;
|
56
56
|
}
|
57
|
+
|
58
|
+
optional_ptr<StorageExtension> GetStorageExtension() {
|
59
|
+
return storage_extension;
|
60
|
+
}
|
61
|
+
|
57
62
|
const string &GetName() const {
|
58
63
|
return name;
|
59
64
|
}
|
@@ -74,6 +79,7 @@ private:
|
|
74
79
|
unique_ptr<TransactionManager> transaction_manager;
|
75
80
|
AttachedDatabaseType type;
|
76
81
|
optional_ptr<Catalog> parent_catalog;
|
82
|
+
optional_ptr<StorageExtension> storage_extension;
|
77
83
|
bool is_initial_database = false;
|
78
84
|
bool is_closed = false;
|
79
85
|
};
|
@@ -208,6 +208,10 @@ struct DBConfigOptions {
|
|
208
208
|
bool allow_extensions_metadata_mismatch = false;
|
209
209
|
//! Enable emitting FSST Vectors
|
210
210
|
bool enable_fsst_vectors = false;
|
211
|
+
//! Enable VIEWs to create dependencies
|
212
|
+
bool enable_view_dependencies = false;
|
213
|
+
//! Enable macros to create dependencies
|
214
|
+
bool enable_macro_dependencies = false;
|
211
215
|
//! Start transactions immediately in all attached databases - instead of lazily when a database is referenced
|
212
216
|
bool immediate_transaction_mode = false;
|
213
217
|
//! Debug setting - how to initialize blocks in the storage layer when allocating
|
@@ -88,10 +88,12 @@ public:
|
|
88
88
|
static unique_ptr<ExtensionInstallInfo> InstallExtension(ClientContext &context, const string &extension,
|
89
89
|
bool force_install,
|
90
90
|
optional_ptr<ExtensionRepository> repository = nullptr,
|
91
|
+
bool throw_on_origin_mismatch = false,
|
91
92
|
const string &version = "");
|
92
93
|
static unique_ptr<ExtensionInstallInfo> InstallExtension(DBConfig &config, FileSystem &fs, const string &extension,
|
93
94
|
bool force_install,
|
94
95
|
optional_ptr<ExtensionRepository> repository = nullptr,
|
96
|
+
bool throw_on_origin_mismatch = false,
|
95
97
|
const string &version = "");
|
96
98
|
//! Load an extension
|
97
99
|
static void LoadExternalExtension(ClientContext &context, const string &extension);
|
@@ -213,12 +215,10 @@ public:
|
|
213
215
|
static bool CreateSuggestions(const string &extension_name, string &message);
|
214
216
|
|
215
217
|
private:
|
216
|
-
static unique_ptr<ExtensionInstallInfo> InstallExtensionInternal(
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
optional_ptr<HTTPLogger> http_logger = nullptr,
|
221
|
-
optional_ptr<ClientContext> context = nullptr);
|
218
|
+
static unique_ptr<ExtensionInstallInfo> InstallExtensionInternal(
|
219
|
+
DBConfig &config, FileSystem &fs, const string &local_path, const string &extension, bool force_install,
|
220
|
+
bool throw_on_origin_mismatch, const string &version, optional_ptr<ExtensionRepository> repository,
|
221
|
+
optional_ptr<HTTPLogger> http_logger = nullptr, optional_ptr<ClientContext> context = nullptr);
|
222
222
|
static const vector<string> PathComponents();
|
223
223
|
static string DefaultExtensionFolder(FileSystem &fs);
|
224
224
|
static bool AllowAutoInstall(const string &extension);
|
@@ -206,6 +206,26 @@ struct EnableExternalAccessSetting {
|
|
206
206
|
static Value GetSetting(const ClientContext &context);
|
207
207
|
};
|
208
208
|
|
209
|
+
struct EnableMacrosDependencies {
|
210
|
+
static constexpr const char *Name = "enable_macro_dependencies";
|
211
|
+
static constexpr const char *Description =
|
212
|
+
"Enable created MACROs to create dependencies on the referenced objects (such as tables)";
|
213
|
+
static constexpr const LogicalTypeId InputType = LogicalTypeId::BOOLEAN;
|
214
|
+
static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter);
|
215
|
+
static void ResetGlobal(DatabaseInstance *db, DBConfig &config);
|
216
|
+
static Value GetSetting(const ClientContext &context);
|
217
|
+
};
|
218
|
+
|
219
|
+
struct EnableViewDependencies {
|
220
|
+
static constexpr const char *Name = "enable_view_dependencies";
|
221
|
+
static constexpr const char *Description =
|
222
|
+
"Enable created VIEWs to create dependencies on the referenced objects (such as tables)";
|
223
|
+
static constexpr const LogicalTypeId InputType = LogicalTypeId::BOOLEAN;
|
224
|
+
static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter);
|
225
|
+
static void ResetGlobal(DatabaseInstance *db, DBConfig &config);
|
226
|
+
static Value GetSetting(const ClientContext &context);
|
227
|
+
};
|
228
|
+
|
209
229
|
struct EnableFSSTVectors {
|
210
230
|
static constexpr const char *Name = "enable_fsst_vectors";
|
211
231
|
static constexpr const char *Description =
|
@@ -51,16 +51,16 @@ public:
|
|
51
51
|
vector<JoinCondition> conditions,
|
52
52
|
vector<unique_ptr<Expression>> arbitrary_expressions);
|
53
53
|
|
54
|
-
static void ExtractJoinConditions(ClientContext &context, JoinType type,
|
55
|
-
unique_ptr<LogicalOperator> &
|
56
|
-
vector<JoinCondition> &conditions,
|
54
|
+
static void ExtractJoinConditions(ClientContext &context, JoinType type, JoinRefType ref_type,
|
55
|
+
unique_ptr<LogicalOperator> &left_child, unique_ptr<LogicalOperator> &right_child,
|
56
|
+
unique_ptr<Expression> condition, vector<JoinCondition> &conditions,
|
57
57
|
vector<unique_ptr<Expression>> &arbitrary_expressions);
|
58
|
-
static void ExtractJoinConditions(ClientContext &context, JoinType type,
|
59
|
-
unique_ptr<LogicalOperator> &right_child,
|
58
|
+
static void ExtractJoinConditions(ClientContext &context, JoinType type, JoinRefType ref_type,
|
59
|
+
unique_ptr<LogicalOperator> &left_child, unique_ptr<LogicalOperator> &right_child,
|
60
60
|
vector<unique_ptr<Expression>> &expressions, vector<JoinCondition> &conditions,
|
61
61
|
vector<unique_ptr<Expression>> &arbitrary_expressions);
|
62
|
-
static void ExtractJoinConditions(ClientContext &context, JoinType type,
|
63
|
-
unique_ptr<LogicalOperator> &right_child,
|
62
|
+
static void ExtractJoinConditions(ClientContext &context, JoinType type, JoinRefType ref_type,
|
63
|
+
unique_ptr<LogicalOperator> &left_child, unique_ptr<LogicalOperator> &right_child,
|
64
64
|
const unordered_set<idx_t> &left_bindings,
|
65
65
|
const unordered_set<idx_t> &right_bindings,
|
66
66
|
vector<unique_ptr<Expression>> &expressions, vector<JoinCondition> &conditions,
|
@@ -13,6 +13,7 @@
|
|
13
13
|
#include "duckdb/common/optional_idx.hpp"
|
14
14
|
#include "duckdb/function/copy_function.hpp"
|
15
15
|
#include "duckdb/planner/logical_operator.hpp"
|
16
|
+
#include "duckdb/common/enums/copy_overwrite_mode.hpp"
|
16
17
|
|
17
18
|
namespace duckdb {
|
18
19
|
|
@@ -33,7 +34,7 @@ public:
|
|
33
34
|
bool use_tmp_file;
|
34
35
|
FilenamePattern filename_pattern;
|
35
36
|
string file_extension;
|
36
|
-
|
37
|
+
CopyOverwriteMode overwrite_mode;
|
37
38
|
bool per_thread_output;
|
38
39
|
optional_idx file_size_bytes;
|
39
40
|
|
@@ -11,6 +11,7 @@
|
|
11
11
|
#include "duckdb/common/common.hpp"
|
12
12
|
#include "duckdb/common/enums/access_mode.hpp"
|
13
13
|
#include "duckdb/parser/tableref/table_function_ref.hpp"
|
14
|
+
#include "duckdb/storage/storage_manager.hpp"
|
14
15
|
|
15
16
|
namespace duckdb {
|
16
17
|
class AttachedDatabase;
|
@@ -40,6 +41,12 @@ public:
|
|
40
41
|
|
41
42
|
virtual ~StorageExtension() {
|
42
43
|
}
|
44
|
+
|
45
|
+
virtual void OnCheckpointStart(AttachedDatabase &db, CheckpointOptions checkpoint_options) {
|
46
|
+
}
|
47
|
+
|
48
|
+
virtual void OnCheckpointEnd(AttachedDatabase &db, CheckpointOptions checkpoint_options) {
|
49
|
+
}
|
43
50
|
};
|
44
51
|
|
45
52
|
} // namespace duckdb
|