duckdb 0.8.2-dev1182.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/binding.gyp +7 -7
- package/package.json +1 -1
- package/src/duckdb/extension/parquet/parquet_extension.cpp +1 -1
- package/src/duckdb/extension/parquet/parquet_reader.cpp +1 -1
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +0 -1
- package/src/duckdb/src/common/exception.cpp +2 -2
- 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/local_file_system.cpp +1 -1
- 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/re2_regex.cpp +1 -1
- package/src/duckdb/src/common/types/bit.cpp +51 -0
- package/src/duckdb/src/common/types/uuid.cpp +2 -2
- package/src/duckdb/src/common/virtual_file_system.cpp +138 -1
- package/src/duckdb/src/core_functions/aggregate/holistic/reservoir_quantile.cpp +2 -0
- 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/expression_executor.cpp +1 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/csv_file_handle.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +1 -1
- 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/execution/window_segment_tree.cpp +1 -1
- 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/function.cpp +1 -1
- 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/persistent/base_csv_reader.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +5 -1
- package/src/duckdb/src/include/duckdb/main/connection.hpp +1 -2
- 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/optimizer/join_order/cardinality_estimator.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_unique_constraint.hpp +3 -3
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +4 -0
- package/src/duckdb/src/main/capi/duckdb_value-c.cpp +1 -1
- package/src/duckdb/src/main/config.cpp +1 -0
- package/src/duckdb/src/main/database.cpp +1 -1
- 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/expression/bound_aggregate_expression.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_get.cpp +9 -4
- package/src/duckdb/src/storage/compression/rle.cpp +0 -1
- package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +6 -6
- package/src/statement.cpp +2 -1
@@ -37,7 +37,7 @@ class BaseCSVReader {
|
|
37
37
|
public:
|
38
38
|
BaseCSVReader(ClientContext &context, BufferedCSVReaderOptions options,
|
39
39
|
const vector<LogicalType> &requested_types = vector<LogicalType>());
|
40
|
-
~BaseCSVReader();
|
40
|
+
virtual ~BaseCSVReader();
|
41
41
|
|
42
42
|
ClientContext &context;
|
43
43
|
FileSystem &fs;
|
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "duckdb/function/table_function.hpp"
|
13
13
|
#include "duckdb/planner/table_filter.hpp"
|
14
14
|
#include "duckdb/storage/data_table.hpp"
|
15
|
+
#include "duckdb/common/extra_operator_info.hpp"
|
15
16
|
|
16
17
|
namespace duckdb {
|
17
18
|
|
@@ -28,7 +29,8 @@ public:
|
|
28
29
|
//! Table scan that immediately projects out filter columns that are unused in the remainder of the query plan
|
29
30
|
PhysicalTableScan(vector<LogicalType> types, TableFunction function, unique_ptr<FunctionData> bind_data,
|
30
31
|
vector<LogicalType> returned_types, vector<column_t> column_ids, vector<idx_t> projection_ids,
|
31
|
-
vector<string> names, unique_ptr<TableFilterSet> table_filters, idx_t estimated_cardinality
|
32
|
+
vector<string> names, unique_ptr<TableFilterSet> table_filters, idx_t estimated_cardinality,
|
33
|
+
ExtraOperatorInfo extra_info);
|
32
34
|
|
33
35
|
//! The table function
|
34
36
|
TableFunction function;
|
@@ -44,6 +46,8 @@ public:
|
|
44
46
|
vector<string> names;
|
45
47
|
//! The table filters
|
46
48
|
unique_ptr<TableFilterSet> table_filters;
|
49
|
+
//! Currently stores any filters applied to file names (as strings)
|
50
|
+
ExtraOperatorInfo extra_info;
|
47
51
|
|
48
52
|
public:
|
49
53
|
string GetName() const override;
|
@@ -169,8 +169,7 @@ public:
|
|
169
169
|
template <typename TR, typename... Args>
|
170
170
|
void CreateScalarFunction(const string &name, vector<LogicalType> args, LogicalType ret_type,
|
171
171
|
TR (*udf_func)(Args...)) {
|
172
|
-
scalar_function_t function =
|
173
|
-
UDFWrapper::CreateScalarFunction<TR, Args...>(name, args, std::move(ret_type), udf_func);
|
172
|
+
scalar_function_t function = UDFWrapper::CreateScalarFunction<TR, Args...>(name, args, ret_type, udf_func);
|
174
173
|
UDFWrapper::RegisterFunction(name, args, ret_type, function, *context);
|
175
174
|
}
|
176
175
|
|
@@ -9,15 +9,18 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/main/relation.hpp"
|
12
|
+
#include "duckdb/common/enums/joinref_type.hpp"
|
12
13
|
|
13
14
|
namespace duckdb {
|
14
15
|
|
15
16
|
class CrossProductRelation : public Relation {
|
16
17
|
public:
|
17
|
-
DUCKDB_API CrossProductRelation(shared_ptr<Relation> left, shared_ptr<Relation> right
|
18
|
+
DUCKDB_API CrossProductRelation(shared_ptr<Relation> left, shared_ptr<Relation> right,
|
19
|
+
JoinRefType join_ref_type = JoinRefType::CROSS);
|
18
20
|
|
19
21
|
shared_ptr<Relation> left;
|
20
22
|
shared_ptr<Relation> right;
|
23
|
+
JoinRefType ref_type;
|
21
24
|
vector<ColumnDefinition> columns;
|
22
25
|
|
23
26
|
public:
|
@@ -9,21 +9,24 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/main/relation.hpp"
|
12
|
+
#include "duckdb/common/enums/joinref_type.hpp"
|
12
13
|
|
13
14
|
namespace duckdb {
|
14
15
|
|
15
16
|
class JoinRelation : public Relation {
|
16
17
|
public:
|
17
18
|
DUCKDB_API JoinRelation(shared_ptr<Relation> left, shared_ptr<Relation> right,
|
18
|
-
unique_ptr<ParsedExpression> condition, JoinType type
|
19
|
+
unique_ptr<ParsedExpression> condition, JoinType type,
|
20
|
+
JoinRefType join_ref_type = JoinRefType::REGULAR);
|
19
21
|
DUCKDB_API JoinRelation(shared_ptr<Relation> left, shared_ptr<Relation> right, vector<string> using_columns,
|
20
|
-
JoinType type);
|
22
|
+
JoinType type, JoinRefType join_ref_type = JoinRefType::REGULAR);
|
21
23
|
|
22
24
|
shared_ptr<Relation> left;
|
23
25
|
shared_ptr<Relation> right;
|
24
26
|
unique_ptr<ParsedExpression> condition;
|
25
27
|
vector<string> using_columns;
|
26
28
|
JoinType join_type;
|
29
|
+
JoinRefType join_ref_type;
|
27
30
|
vector<ColumnDefinition> columns;
|
28
31
|
|
29
32
|
public:
|
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "duckdb/common/enums/join_type.hpp"
|
13
13
|
#include "duckdb/common/enums/relation_type.hpp"
|
14
14
|
#include "duckdb/common/winapi.hpp"
|
15
|
+
#include "duckdb/common/enums/joinref_type.hpp"
|
15
16
|
#include "duckdb/main/query_result.hpp"
|
16
17
|
#include "duckdb/parser/column_definition.hpp"
|
17
18
|
#include "duckdb/common/named_parameter_map.hpp"
|
@@ -94,10 +95,11 @@ public:
|
|
94
95
|
|
95
96
|
// JOIN operation
|
96
97
|
DUCKDB_API shared_ptr<Relation> Join(const shared_ptr<Relation> &other, const string &condition,
|
97
|
-
JoinType type = JoinType::INNER);
|
98
|
+
JoinType type = JoinType::INNER, JoinRefType ref_type = JoinRefType::REGULAR);
|
98
99
|
|
99
100
|
// CROSS PRODUCT operation
|
100
|
-
DUCKDB_API shared_ptr<Relation> CrossProduct(const shared_ptr<Relation> &other
|
101
|
+
DUCKDB_API shared_ptr<Relation> CrossProduct(const shared_ptr<Relation> &other,
|
102
|
+
JoinRefType join_ref_type = JoinRefType::CROSS);
|
101
103
|
|
102
104
|
// SET operations
|
103
105
|
DUCKDB_API shared_ptr<Relation> Union(const shared_ptr<Relation> &other);
|
@@ -122,6 +122,15 @@ struct DefaultNullOrderSetting {
|
|
122
122
|
static Value GetSetting(ClientContext &context);
|
123
123
|
};
|
124
124
|
|
125
|
+
struct DisabledFileSystemsSetting {
|
126
|
+
static constexpr const char *Name = "disabled_filesystems";
|
127
|
+
static constexpr const char *Description = "Disable specific file systems preventing access (e.g. LocalFileSystem)";
|
128
|
+
static constexpr const LogicalTypeId InputType = LogicalTypeId::VARCHAR;
|
129
|
+
static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter);
|
130
|
+
static void ResetGlobal(DatabaseInstance *db, DBConfig &config);
|
131
|
+
static Value GetSetting(ClientContext &context);
|
132
|
+
};
|
133
|
+
|
125
134
|
struct DisabledOptimizersSetting {
|
126
135
|
static constexpr const char *Name = "disabled_optimizers";
|
127
136
|
static constexpr const char *Description = "DEBUG SETTING: disable a specific set of optimizers (comma separated)";
|
@@ -34,7 +34,7 @@ struct RelationsToTDom {
|
|
34
34
|
bool has_tdom_hll;
|
35
35
|
vector<FilterInfo *> filters;
|
36
36
|
|
37
|
-
RelationsToTDom(column_binding_set_t column_binding_set)
|
37
|
+
RelationsToTDom(const column_binding_set_t &column_binding_set)
|
38
38
|
: equivalent_relations(column_binding_set), tdom_hll(0), tdom_no_hll(NumericLimits<idx_t>::Maximum()),
|
39
39
|
has_tdom_hll(false) {};
|
40
40
|
};
|
@@ -23,9 +23,9 @@ public:
|
|
23
23
|
: BoundConstraint(ConstraintType::UNIQUE), keys(std::move(keys)), key_set(std::move(key_set)),
|
24
24
|
is_primary_key(is_primary_key) {
|
25
25
|
#ifdef DEBUG
|
26
|
-
D_ASSERT(keys.size() == key_set.size());
|
27
|
-
for (auto &key : keys) {
|
28
|
-
D_ASSERT(key_set.find(key) != key_set.end());
|
26
|
+
D_ASSERT(this->keys.size() == this->key_set.size());
|
27
|
+
for (auto &key : this->keys) {
|
28
|
+
D_ASSERT(this->key_set.find(key) != this->key_set.end());
|
29
29
|
}
|
30
30
|
#endif
|
31
31
|
}
|
@@ -11,6 +11,7 @@
|
|
11
11
|
#include "duckdb/function/table_function.hpp"
|
12
12
|
#include "duckdb/planner/logical_operator.hpp"
|
13
13
|
#include "duckdb/planner/table_filter.hpp"
|
14
|
+
#include "duckdb/common/extra_operator_info.hpp"
|
14
15
|
|
15
16
|
namespace duckdb {
|
16
17
|
|
@@ -49,6 +50,9 @@ public:
|
|
49
50
|
vector<string> input_table_names;
|
50
51
|
//! For a table-in-out function, the set of projected input columns
|
51
52
|
vector<column_t> projected_input;
|
53
|
+
//! Currently stores File Filters (as strings) applied by hive partitioning/complex filter pushdown
|
54
|
+
//! Stored so the can be included in explain output
|
55
|
+
ExtraOperatorInfo extra_info;
|
52
56
|
|
53
57
|
string GetName() const override;
|
54
58
|
string ParamsToString() const override;
|
@@ -26,7 +26,7 @@ char *duckdb_get_varchar(duckdb_value value) {
|
|
26
26
|
auto str_val = val->DefaultCastAs(duckdb::LogicalType::VARCHAR);
|
27
27
|
auto &str = duckdb::StringValue::Get(str_val);
|
28
28
|
|
29
|
-
auto result = reinterpret_cast<char *>(malloc(sizeof(char
|
29
|
+
auto result = reinterpret_cast<char *>(malloc(sizeof(char) * (str.size() + 1)));
|
30
30
|
memcpy(result, str.c_str(), str.size());
|
31
31
|
result[str.size()] = '\0';
|
32
32
|
return result;
|
@@ -63,6 +63,7 @@ static ConfigurationOption internal_options[] = {DUCKDB_GLOBAL(AccessModeSetting
|
|
63
63
|
DUCKDB_GLOBAL_LOCAL(DefaultCollationSetting),
|
64
64
|
DUCKDB_GLOBAL(DefaultOrderSetting),
|
65
65
|
DUCKDB_GLOBAL(DefaultNullOrderSetting),
|
66
|
+
DUCKDB_GLOBAL(DisabledFileSystemsSetting),
|
66
67
|
DUCKDB_GLOBAL(DisabledOptimizersSetting),
|
67
68
|
DUCKDB_GLOBAL(EnableExternalAccessSetting),
|
68
69
|
DUCKDB_GLOBAL(EnableFSSTVectors),
|
@@ -178,7 +178,7 @@ void DatabaseInstance::CreateMainDatabase() {
|
|
178
178
|
void ThrowExtensionSetUnrecognizedOptions(const unordered_map<string, Value> &unrecognized_options) {
|
179
179
|
auto unrecognized_options_iter = unrecognized_options.begin();
|
180
180
|
string unrecognized_option_keys = unrecognized_options_iter->first;
|
181
|
-
|
181
|
+
while (++unrecognized_options_iter != unrecognized_options.end()) {
|
182
182
|
unrecognized_option_keys = "," + unrecognized_options_iter->first;
|
183
183
|
}
|
184
184
|
throw InvalidInputException("Unrecognized configuration property \"%s\"", unrecognized_option_keys);
|
@@ -4,8 +4,10 @@
|
|
4
4
|
#include "duckdb/common/string_util.hpp"
|
5
5
|
|
6
6
|
#ifndef DISABLE_DUCKDB_REMOTE_INSTALL
|
7
|
+
#ifndef DUCKDB_DISABLE_EXTENSION_LOAD
|
7
8
|
#include "httplib.hpp"
|
8
9
|
#endif
|
10
|
+
#endif
|
9
11
|
#include "duckdb/common/windows_undefs.hpp"
|
10
12
|
|
11
13
|
#include <fstream>
|
@@ -152,6 +154,9 @@ void WriteExtensionFileToDisk(FileSystem &fs, const string &path, void *data, id
|
|
152
154
|
|
153
155
|
void ExtensionHelper::InstallExtensionInternal(DBConfig &config, ClientConfig *client_config, FileSystem &fs,
|
154
156
|
const string &local_path, const string &extension, bool force_install) {
|
157
|
+
#ifdef DUCKDB_DISABLE_EXTENSION_LOAD
|
158
|
+
throw PermissionException("Installing external extensions is disabled through a compile time flag");
|
159
|
+
#else
|
155
160
|
if (!config.options.enable_external_access) {
|
156
161
|
throw PermissionException("Installing extensions is disabled through configuration");
|
157
162
|
}
|
@@ -237,6 +242,7 @@ void ExtensionHelper::InstallExtensionInternal(DBConfig &config, ClientConfig *c
|
|
237
242
|
WriteExtensionFileToDisk(fs, temp_path, (void *)decompressed_body.data(), decompressed_body.size());
|
238
243
|
fs.MoveFile(temp_path, local_extension_path);
|
239
244
|
#endif
|
245
|
+
#endif
|
240
246
|
}
|
241
247
|
|
242
248
|
} // namespace duckdb
|
@@ -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
|
}
|
@@ -15,7 +15,7 @@ BoundAggregateExpression::BoundAggregateExpression(AggregateFunction function, v
|
|
15
15
|
: Expression(ExpressionType::BOUND_AGGREGATE, ExpressionClass::BOUND_AGGREGATE, function.return_type),
|
16
16
|
function(std::move(function)), children(std::move(children)), bind_info(std::move(bind_info)),
|
17
17
|
aggr_type(aggr_type), filter(std::move(filter)) {
|
18
|
-
D_ASSERT(!function.name.empty());
|
18
|
+
D_ASSERT(!this->function.name.empty());
|
19
19
|
}
|
20
20
|
|
21
21
|
string BoundAggregateExpression::ToString() const {
|
@@ -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() {
|
@@ -348,17 +348,17 @@
|
|
348
348
|
|
349
349
|
#include "extension/icu/third_party/icu/i18n/wintzimpl.cpp"
|
350
350
|
|
351
|
-
#include "extension/icu/third_party/icu/i18n/double-conversion-
|
352
|
-
|
353
|
-
#include "extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp"
|
354
|
-
|
355
|
-
#include "extension/icu/third_party/icu/i18n/double-conversion-cached-powers.cpp"
|
351
|
+
#include "extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp"
|
356
352
|
|
357
353
|
#include "extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp"
|
358
354
|
|
355
|
+
#include "extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp"
|
356
|
+
|
359
357
|
#include "extension/icu/third_party/icu/i18n/double-conversion-bignum.cpp"
|
360
358
|
|
359
|
+
#include "extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp"
|
360
|
+
|
361
361
|
#include "extension/icu/third_party/icu/i18n/double-conversion-bignum-dtoa.cpp"
|
362
362
|
|
363
|
-
#include "extension/icu/third_party/icu/i18n/double-conversion-
|
363
|
+
#include "extension/icu/third_party/icu/i18n/double-conversion-cached-powers.cpp"
|
364
364
|
|
package/src/statement.cpp
CHANGED
@@ -173,7 +173,8 @@ static Napi::Value convert_col_val(Napi::Env &env, duckdb::Value dval, duckdb::L
|
|
173
173
|
if (negative) {
|
174
174
|
duckdb::Hugeint::NegateInPlace(val); // remove signing bit
|
175
175
|
}
|
176
|
-
|
176
|
+
D_ASSERT(val.upper >= 0);
|
177
|
+
const uint64_t words[] = {val.lower, (uint64_t)val.upper};
|
177
178
|
value = Napi::BigInt::New(env, negative, 2, words);
|
178
179
|
} break;
|
179
180
|
case duckdb::LogicalTypeId::DECIMAL: {
|