duckdb 0.8.2-dev1212.0 → 0.8.2-dev1435.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/extension/parquet/parquet_extension.cpp +1 -1
- package/src/duckdb/src/common/file_system.cpp +4 -0
- package/src/duckdb/src/common/hive_partitioning.cpp +10 -6
- package/src/duckdb/src/common/multi_file_reader.cpp +3 -2
- package/src/duckdb/src/common/operator/cast_operators.cpp +35 -1
- package/src/duckdb/src/common/types/bit.cpp +51 -0
- package/src/duckdb/src/common/virtual_file_system.cpp +138 -1
- package/src/duckdb/src/core_functions/function_list.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/date/epoch.cpp +10 -7
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +7 -2
- package/src/duckdb/src/execution/physical_plan/plan_get.cpp +2 -2
- package/src/duckdb/src/function/cast/bit_cast.cpp +34 -2
- package/src/duckdb/src/function/cast/blob_cast.cpp +3 -0
- package/src/duckdb/src/function/cast/numeric_casts.cpp +2 -0
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/common/extra_operator_info.hpp +27 -0
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/hive_partitioning.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +43 -3
- package/src/duckdb/src/include/duckdb/common/operator/numeric_cast.hpp +10 -0
- package/src/duckdb/src/include/duckdb/common/types/bit.hpp +81 -0
- package/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +38 -97
- package/src/duckdb/src/include/duckdb/core_functions/scalar/date_functions.hpp +11 -11
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +5 -1
- package/src/duckdb/src/include/duckdb/main/relation/cross_product_relation.hpp +4 -1
- package/src/duckdb/src/include/duckdb/main/relation/join_relation.hpp +5 -2
- package/src/duckdb/src/include/duckdb/main/relation.hpp +4 -2
- package/src/duckdb/src/include/duckdb/main/settings.hpp +9 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +4 -0
- package/src/duckdb/src/main/config.cpp +1 -0
- package/src/duckdb/src/main/extension/extension_install.cpp +6 -0
- package/src/duckdb/src/main/extension/extension_load.cpp +10 -1
- package/src/duckdb/src/main/relation/cross_product_relation.cpp +4 -3
- package/src/duckdb/src/main/relation/join_relation.cpp +5 -5
- package/src/duckdb/src/main/relation.cpp +6 -5
- package/src/duckdb/src/main/settings/settings.cpp +24 -0
- package/src/duckdb/src/parser/parser.cpp +8 -2
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +5 -4
- package/src/duckdb/src/planner/operator/logical_get.cpp +9 -4
@@ -17,6 +17,7 @@ namespace duckdb {
|
|
17
17
|
//===--------------------------------------------------------------------===//
|
18
18
|
// Load External Extension
|
19
19
|
//===--------------------------------------------------------------------===//
|
20
|
+
#ifndef DUCKDB_DISABLE_EXTENSION_LOAD
|
20
21
|
typedef void (*ext_init_fun_t)(DatabaseInstance &);
|
21
22
|
typedef const char *(*ext_version_fun_t)(void);
|
22
23
|
typedef bool (*ext_is_storage_t)(void);
|
@@ -43,9 +44,13 @@ static void ComputeSHA256FileSegment(FileHandle *handle, const idx_t start, cons
|
|
43
44
|
|
44
45
|
ComputeSHA256String(file_content, res);
|
45
46
|
}
|
47
|
+
#endif
|
46
48
|
|
47
49
|
bool ExtensionHelper::TryInitialLoad(DBConfig &config, FileSystem &fs, const string &extension,
|
48
50
|
ExtensionInitResult &result, string &error) {
|
51
|
+
#ifdef DUCKDB_DISABLE_EXTENSION_LOAD
|
52
|
+
throw PermissionException("Loading external extensions is disabled through a compile time flag");
|
53
|
+
#else
|
49
54
|
if (!config.options.enable_external_access) {
|
50
55
|
throw PermissionException("Loading external extensions is disabled through configuration");
|
51
56
|
}
|
@@ -197,6 +202,7 @@ bool ExtensionHelper::TryInitialLoad(DBConfig &config, FileSystem &fs, const str
|
|
197
202
|
result.filename = filename;
|
198
203
|
result.lib_hdl = lib_hdl;
|
199
204
|
return true;
|
205
|
+
#endif
|
200
206
|
}
|
201
207
|
|
202
208
|
ExtensionInitResult ExtensionHelper::InitialLoad(DBConfig &config, FileSystem &fs, const string &extension) {
|
@@ -241,7 +247,9 @@ void ExtensionHelper::LoadExternalExtension(DatabaseInstance &db, FileSystem &fs
|
|
241
247
|
if (db.ExtensionIsLoaded(extension)) {
|
242
248
|
return;
|
243
249
|
}
|
244
|
-
|
250
|
+
#ifdef DUCKDB_DISABLE_EXTENSION_LOAD
|
251
|
+
throw PermissionException("Loading external extensions is disabled through a compile time flag");
|
252
|
+
#else
|
245
253
|
auto res = InitialLoad(DBConfig::GetConfig(db), fs, extension);
|
246
254
|
auto init_fun_name = res.basename + "_init";
|
247
255
|
|
@@ -256,6 +264,7 @@ void ExtensionHelper::LoadExternalExtension(DatabaseInstance &db, FileSystem &fs
|
|
256
264
|
}
|
257
265
|
|
258
266
|
db.SetExtensionLoaded(extension);
|
267
|
+
#endif
|
259
268
|
}
|
260
269
|
|
261
270
|
void ExtensionHelper::LoadExternalExtension(ClientContext &context, const string &extension) {
|
@@ -6,9 +6,10 @@
|
|
6
6
|
|
7
7
|
namespace duckdb {
|
8
8
|
|
9
|
-
CrossProductRelation::CrossProductRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> right_p
|
9
|
+
CrossProductRelation::CrossProductRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> right_p,
|
10
|
+
JoinRefType ref_type)
|
10
11
|
: Relation(left_p->context, RelationType::CROSS_PRODUCT_RELATION), left(std::move(left_p)),
|
11
|
-
right(std::move(right_p)) {
|
12
|
+
right(std::move(right_p)), ref_type(ref_type) {
|
12
13
|
if (left->context.GetContext() != right->context.GetContext()) {
|
13
14
|
throw Exception("Cannot combine LEFT and RIGHT relations of different connections!");
|
14
15
|
}
|
@@ -23,7 +24,7 @@ unique_ptr<QueryNode> CrossProductRelation::GetQueryNode() {
|
|
23
24
|
}
|
24
25
|
|
25
26
|
unique_ptr<TableRef> CrossProductRelation::GetTableRef() {
|
26
|
-
auto cross_product_ref = make_uniq<JoinRef>(
|
27
|
+
auto cross_product_ref = make_uniq<JoinRef>(ref_type);
|
27
28
|
cross_product_ref->left = left->GetTableRef();
|
28
29
|
cross_product_ref->right = right->GetTableRef();
|
29
30
|
return std::move(cross_product_ref);
|
@@ -8,9 +8,9 @@
|
|
8
8
|
namespace duckdb {
|
9
9
|
|
10
10
|
JoinRelation::JoinRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> right_p,
|
11
|
-
unique_ptr<ParsedExpression> condition_p, JoinType type)
|
11
|
+
unique_ptr<ParsedExpression> condition_p, JoinType type, JoinRefType join_ref_type)
|
12
12
|
: Relation(left_p->context, RelationType::JOIN_RELATION), left(std::move(left_p)), right(std::move(right_p)),
|
13
|
-
condition(std::move(condition_p)), join_type(type) {
|
13
|
+
condition(std::move(condition_p)), join_type(type), join_ref_type(join_ref_type) {
|
14
14
|
if (left->context.GetContext() != right->context.GetContext()) {
|
15
15
|
throw Exception("Cannot combine LEFT and RIGHT relations of different connections!");
|
16
16
|
}
|
@@ -18,9 +18,9 @@ JoinRelation::JoinRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> rig
|
|
18
18
|
}
|
19
19
|
|
20
20
|
JoinRelation::JoinRelation(shared_ptr<Relation> left_p, shared_ptr<Relation> right_p, vector<string> using_columns_p,
|
21
|
-
JoinType type)
|
21
|
+
JoinType type, JoinRefType join_ref_type)
|
22
22
|
: Relation(left_p->context, RelationType::JOIN_RELATION), left(std::move(left_p)), right(std::move(right_p)),
|
23
|
-
using_columns(std::move(using_columns_p)), join_type(type) {
|
23
|
+
using_columns(std::move(using_columns_p)), join_type(type), join_ref_type(join_ref_type) {
|
24
24
|
if (left->context.GetContext() != right->context.GetContext()) {
|
25
25
|
throw Exception("Cannot combine LEFT and RIGHT relations of different connections!");
|
26
26
|
}
|
@@ -35,7 +35,7 @@ unique_ptr<QueryNode> JoinRelation::GetQueryNode() {
|
|
35
35
|
}
|
36
36
|
|
37
37
|
unique_ptr<TableRef> JoinRelation::GetTableRef() {
|
38
|
-
auto join_ref = make_uniq<JoinRef>(
|
38
|
+
auto join_ref = make_uniq<JoinRef>(join_ref_type);
|
39
39
|
join_ref->left = left->GetTableRef();
|
40
40
|
join_ref->right = right->GetTableRef();
|
41
41
|
if (condition) {
|
@@ -113,7 +113,8 @@ shared_ptr<Relation> Relation::Order(const vector<string> &expressions) {
|
|
113
113
|
return make_shared<OrderRelation>(shared_from_this(), std::move(order_list));
|
114
114
|
}
|
115
115
|
|
116
|
-
shared_ptr<Relation> Relation::Join(const shared_ptr<Relation> &other, const string &condition, JoinType type
|
116
|
+
shared_ptr<Relation> Relation::Join(const shared_ptr<Relation> &other, const string &condition, JoinType type,
|
117
|
+
JoinRefType ref_type) {
|
117
118
|
auto expression_list = Parser::ParseExpressionList(condition, context.GetContext()->GetParserOptions());
|
118
119
|
D_ASSERT(!expression_list.empty());
|
119
120
|
|
@@ -130,15 +131,15 @@ shared_ptr<Relation> Relation::Join(const shared_ptr<Relation> &other, const str
|
|
130
131
|
}
|
131
132
|
using_columns.push_back(colref.column_names[0]);
|
132
133
|
}
|
133
|
-
return make_shared<JoinRelation>(shared_from_this(), other, std::move(using_columns), type);
|
134
|
+
return make_shared<JoinRelation>(shared_from_this(), other, std::move(using_columns), type, ref_type);
|
134
135
|
} else {
|
135
136
|
// single expression that is not a column reference: use the expression as a join condition
|
136
|
-
return make_shared<JoinRelation>(shared_from_this(), other, std::move(expression_list[0]), type);
|
137
|
+
return make_shared<JoinRelation>(shared_from_this(), other, std::move(expression_list[0]), type, ref_type);
|
137
138
|
}
|
138
139
|
}
|
139
140
|
|
140
|
-
shared_ptr<Relation> Relation::CrossProduct(const shared_ptr<Relation> &other) {
|
141
|
-
return make_shared<CrossProductRelation>(shared_from_this(), other);
|
141
|
+
shared_ptr<Relation> Relation::CrossProduct(const shared_ptr<Relation> &other, JoinRefType join_ref_type) {
|
142
|
+
return make_shared<CrossProductRelation>(shared_from_this(), other, join_ref_type);
|
142
143
|
}
|
143
144
|
|
144
145
|
shared_ptr<Relation> Relation::Union(const shared_ptr<Relation> &other) {
|
@@ -300,6 +300,30 @@ Value DefaultNullOrderSetting::GetSetting(ClientContext &context) {
|
|
300
300
|
}
|
301
301
|
}
|
302
302
|
|
303
|
+
//===--------------------------------------------------------------------===//
|
304
|
+
// Disabled File Systems
|
305
|
+
//===--------------------------------------------------------------------===//
|
306
|
+
void DisabledFileSystemsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) {
|
307
|
+
if (!db) {
|
308
|
+
throw InternalException("disabled_filesystems can only be set in an active database");
|
309
|
+
}
|
310
|
+
auto &fs = FileSystem::GetFileSystem(*db);
|
311
|
+
auto list = StringUtil::Split(input.ToString(), ",");
|
312
|
+
fs.SetDisabledFileSystems(list);
|
313
|
+
}
|
314
|
+
|
315
|
+
void DisabledFileSystemsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) {
|
316
|
+
if (!db) {
|
317
|
+
throw InternalException("disabled_filesystems can only be set in an active database");
|
318
|
+
}
|
319
|
+
auto &fs = FileSystem::GetFileSystem(*db);
|
320
|
+
fs.SetDisabledFileSystems(vector<string>());
|
321
|
+
}
|
322
|
+
|
323
|
+
Value DisabledFileSystemsSetting::GetSetting(ClientContext &context) {
|
324
|
+
return Value("");
|
325
|
+
}
|
326
|
+
|
303
327
|
//===--------------------------------------------------------------------===//
|
304
328
|
// Disabled Optimizer
|
305
329
|
//===--------------------------------------------------------------------===//
|
@@ -191,6 +191,7 @@ void Parser::ParseQuery(const string &query) {
|
|
191
191
|
} else {
|
192
192
|
// split sql string into statements and re-parse using extension
|
193
193
|
auto query_statements = SplitQueryStringIntoStatements(query);
|
194
|
+
auto stmt_loc = 0;
|
194
195
|
for (auto const &query_statement : query_statements) {
|
195
196
|
PostgresParser another_parser;
|
196
197
|
another_parser.Parse(query_statement);
|
@@ -202,6 +203,10 @@ void Parser::ParseQuery(const string &query) {
|
|
202
203
|
continue;
|
203
204
|
}
|
204
205
|
transformer.TransformParseTree(another_parser.parse_tree, statements);
|
206
|
+
// important to set in the case of a mixture of DDB and parser ext statements
|
207
|
+
statements.back()->stmt_length = query_statement.size() - 1;
|
208
|
+
statements.back()->stmt_location = stmt_loc;
|
209
|
+
stmt_loc += query_statement.size();
|
205
210
|
} else {
|
206
211
|
// let extensions parse the statement which DuckDB failed to parse
|
207
212
|
bool parsed_single_statement = false;
|
@@ -211,8 +216,9 @@ void Parser::ParseQuery(const string &query) {
|
|
211
216
|
auto result = ext.parse_function(ext.parser_info.get(), query_statement);
|
212
217
|
if (result.type == ParserExtensionResultType::PARSE_SUCCESSFUL) {
|
213
218
|
auto statement = make_uniq<ExtensionStatement>(ext, std::move(result.parse_data));
|
214
|
-
statement->stmt_length = query_statement.size();
|
215
|
-
statement->stmt_location =
|
219
|
+
statement->stmt_length = query_statement.size() - 1;
|
220
|
+
statement->stmt_location = stmt_loc;
|
221
|
+
stmt_loc += query_statement.size();
|
216
222
|
statements.push_back(std::move(statement));
|
217
223
|
parsed_single_statement = true;
|
218
224
|
break;
|
@@ -297,10 +297,9 @@ unique_ptr<BoundCreateTableInfo> Binder::BindCreateTableInfo(unique_ptr<CreateIn
|
|
297
297
|
|
298
298
|
if (type_dependency) {
|
299
299
|
// Only if the USER comes from a create type
|
300
|
-
if (
|
301
|
-
//
|
302
|
-
|
303
|
-
} else {
|
300
|
+
if (schema.catalog.IsTemporaryCatalog() && column.Type().id() == LogicalTypeId::ENUM) {
|
301
|
+
// for enum types that are used in tables in the temp catalog, we need to
|
302
|
+
// make a copy of the enum type definition that is accessible there
|
304
303
|
auto enum_type = type_dependency->user_type;
|
305
304
|
auto &enum_entries = EnumType::GetValuesInsertOrder(enum_type);
|
306
305
|
auto enum_size = EnumType::GetSize(enum_type);
|
@@ -313,6 +312,8 @@ unique_ptr<BoundCreateTableInfo> Binder::BindCreateTableInfo(unique_ptr<CreateIn
|
|
313
312
|
}
|
314
313
|
auto copy_type = LogicalType::ENUM(EnumType::GetTypeName(enum_type), copy_enum_entries_vec, enum_size);
|
315
314
|
column.SetType(copy_type);
|
315
|
+
} else {
|
316
|
+
result->dependencies.AddDependency(*type_dependency);
|
316
317
|
}
|
317
318
|
}
|
318
319
|
}
|
@@ -14,7 +14,8 @@ namespace duckdb {
|
|
14
14
|
LogicalGet::LogicalGet(idx_t table_index, TableFunction function, unique_ptr<FunctionData> bind_data,
|
15
15
|
vector<LogicalType> returned_types, vector<string> returned_names)
|
16
16
|
: LogicalOperator(LogicalOperatorType::LOGICAL_GET), table_index(table_index), function(std::move(function)),
|
17
|
-
bind_data(std::move(bind_data)), returned_types(std::move(returned_types)), names(std::move(returned_names))
|
17
|
+
bind_data(std::move(bind_data)), returned_types(std::move(returned_types)), names(std::move(returned_names)),
|
18
|
+
extra_info() {
|
18
19
|
}
|
19
20
|
|
20
21
|
optional_ptr<TableCatalogEntry> LogicalGet::GetTable() const {
|
@@ -22,7 +23,7 @@ optional_ptr<TableCatalogEntry> LogicalGet::GetTable() const {
|
|
22
23
|
}
|
23
24
|
|
24
25
|
string LogicalGet::ParamsToString() const {
|
25
|
-
string result;
|
26
|
+
string result = "";
|
26
27
|
for (auto &kv : table_filters.filters) {
|
27
28
|
auto &column_index = kv.first;
|
28
29
|
auto &filter = kv.second;
|
@@ -31,10 +32,14 @@ string LogicalGet::ParamsToString() const {
|
|
31
32
|
}
|
32
33
|
result += "\n";
|
33
34
|
}
|
35
|
+
if (!extra_info.file_filters.empty()) {
|
36
|
+
result += "\n[INFOSEPARATOR]\n";
|
37
|
+
result += "File Filters: " + extra_info.file_filters;
|
38
|
+
}
|
34
39
|
if (!function.to_string) {
|
35
|
-
return
|
40
|
+
return result;
|
36
41
|
}
|
37
|
-
return function.to_string(bind_data.get());
|
42
|
+
return result + "\n" + function.to_string(bind_data.get());
|
38
43
|
}
|
39
44
|
|
40
45
|
vector<ColumnBinding> LogicalGet::GetColumnBindings() {
|