duckdb 0.8.2-dev2133.0 → 0.8.2-dev2208.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/json/json_functions.cpp +2 -1
- package/src/duckdb/extension/parquet/parquet_extension.cpp +2 -1
- package/src/duckdb/src/catalog/catalog.cpp +2 -6
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +1 -4
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +0 -4
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +7 -26
- package/src/duckdb/src/catalog/catalog_set.cpp +0 -63
- package/src/duckdb/src/catalog/dependency_manager.cpp +0 -36
- package/src/duckdb/src/common/extra_type_info.cpp +24 -46
- package/src/duckdb/src/common/field_writer.cpp +0 -1
- package/src/duckdb/src/common/file_system.cpp +6 -6
- package/src/duckdb/src/common/filename_pattern.cpp +1 -1
- package/src/duckdb/src/common/gzip_file_system.cpp +7 -12
- package/src/duckdb/src/common/multi_file_reader.cpp +8 -5
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +0 -9
- package/src/duckdb/src/common/types.cpp +12 -56
- package/src/duckdb/src/common/virtual_file_system.cpp +4 -0
- package/src/duckdb/src/core_functions/scalar/union/union_tag.cpp +1 -1
- package/src/duckdb/src/execution/column_binding_resolver.cpp +3 -7
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +1 -1
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +0 -10
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +2 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +2 -6
- package/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp +1 -2
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +14 -1
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +3 -17
- package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +2 -5
- package/src/duckdb/src/execution/physical_plan_generator.cpp +1 -5
- package/src/duckdb/src/function/cast/string_cast.cpp +0 -1
- package/src/duckdb/src/function/scalar_function.cpp +3 -19
- package/src/duckdb/src/function/table/read_csv.cpp +2 -1
- package/src/duckdb/src/function/table/system/test_all_types.cpp +4 -4
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +0 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +1 -4
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +0 -6
- package/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +2 -6
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +0 -4
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +8 -8
- package/src/duckdb/src/include/duckdb/common/filename_pattern.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/opener_file_system.hpp +4 -0
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +0 -4
- package/src/duckdb/src/include/duckdb/common/serializer.hpp +0 -7
- package/src/duckdb/src/include/duckdb/common/types/timestamp.hpp +14 -10
- package/src/duckdb/src/include/duckdb/common/types.hpp +5 -10
- package/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +2 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +0 -4
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +3 -2
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +0 -3
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/deliminator.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/logical_tokens.hpp +0 -2
- package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +1 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +10 -7
- package/src/duckdb/src/include/duckdb/planner/operator/logical_extension_operator.hpp +5 -0
- package/src/duckdb/src/include/duckdb/planner/operator_extension.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/meta_block_reader.hpp +0 -3
- package/src/duckdb/src/main/attached_database.cpp +2 -2
- package/src/duckdb/src/main/database.cpp +1 -1
- package/src/duckdb/src/main/db_instance_cache.cpp +14 -6
- package/src/duckdb/src/main/extension/extension_install.cpp +1 -1
- package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +1 -2
- package/src/duckdb/src/optimizer/compressed_materialization.cpp +0 -1
- package/src/duckdb/src/optimizer/deliminator.cpp +7 -7
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +3 -5
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +16 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_type.cpp +1 -1
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +3 -3
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +7 -23
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +0 -24
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +3 -5
- package/src/duckdb/src/planner/logical_operator.cpp +1 -6
- package/src/duckdb/src/planner/logical_operator_visitor.cpp +3 -6
- package/src/duckdb/src/planner/operator/logical_comparison_join.cpp +2 -14
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +21 -12
- package/src/duckdb/src/planner/operator/logical_extension_operator.cpp +24 -0
- package/src/duckdb/src/planner/planner.cpp +0 -1
- package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -5
- package/src/duckdb/src/storage/meta_block_reader.cpp +0 -9
- package/src/duckdb/src/storage/serialization/serialize_create_info.cpp +2 -0
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +27 -0
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/src/storage/wal_replay.cpp +1 -3
- package/src/duckdb/ub_src_planner_operator.cpp +0 -4
- package/src/statement.cpp +0 -2
- package/test/columns.test.ts +1 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_asof_join.hpp +0 -27
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_join.hpp +0 -32
- package/src/duckdb/src/planner/operator/logical_asof_join.cpp +0 -14
- package/src/duckdb/src/planner/operator/logical_delim_join.cpp +0 -25
@@ -39,7 +39,7 @@ static unique_ptr<FunctionData> UnionTagBind(ClientContext &context, ScalarFunct
|
|
39
39
|
FlatVector::GetData<string_t>(varchar_vector)[i] =
|
40
40
|
str.IsInlined() ? str : StringVector::AddString(varchar_vector, str);
|
41
41
|
}
|
42
|
-
auto enum_type = LogicalType::ENUM(
|
42
|
+
auto enum_type = LogicalType::ENUM(varchar_vector, member_count);
|
43
43
|
bound_function.return_type = enum_type;
|
44
44
|
|
45
45
|
return nullptr;
|
@@ -3,7 +3,6 @@
|
|
3
3
|
#include "duckdb/planner/operator/logical_comparison_join.hpp"
|
4
4
|
#include "duckdb/planner/operator/logical_any_join.hpp"
|
5
5
|
#include "duckdb/planner/operator/logical_create_index.hpp"
|
6
|
-
#include "duckdb/planner/operator/logical_delim_join.hpp"
|
7
6
|
#include "duckdb/planner/operator/logical_insert.hpp"
|
8
7
|
|
9
8
|
#include "duckdb/planner/expression/bound_columnref_expression.hpp"
|
@@ -29,12 +28,9 @@ void ColumnBindingResolver::VisitOperator(LogicalOperator &op) {
|
|
29
28
|
for (auto &cond : comp_join.conditions) {
|
30
29
|
VisitExpression(&cond.left);
|
31
30
|
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
for (auto &expr : delim_join.duplicate_eliminated_columns) {
|
36
|
-
VisitExpression(&expr);
|
37
|
-
}
|
31
|
+
// visit the duplicate eliminated columns on the LHS, if any
|
32
|
+
for (auto &expr : comp_join.duplicate_eliminated_columns) {
|
33
|
+
VisitExpression(&expr);
|
38
34
|
}
|
39
35
|
// then get the bindings of the RHS and resolve the RHS expressions
|
40
36
|
VisitOperator(*comp_join.children[1]);
|
@@ -108,7 +108,7 @@ SinkCombineResultType PhysicalCopyToFile::Combine(ExecutionContext &context, Ope
|
|
108
108
|
auto partition_key_map = l.part_buffer->GetReverseMap();
|
109
109
|
|
110
110
|
string trimmed_path = file_path;
|
111
|
-
StringUtil::RTrim(trimmed_path, fs.PathSeparator());
|
111
|
+
StringUtil::RTrim(trimmed_path, fs.PathSeparator(trimmed_path));
|
112
112
|
|
113
113
|
for (idx_t i = 0; i < partitions.size(); i++) {
|
114
114
|
string hive_path =
|
@@ -9,16 +9,6 @@
|
|
9
9
|
|
10
10
|
namespace duckdb {
|
11
11
|
|
12
|
-
PhysicalTableScan::PhysicalTableScan(vector<LogicalType> types, TableFunction function_p,
|
13
|
-
unique_ptr<FunctionData> bind_data_p, vector<column_t> column_ids_p,
|
14
|
-
vector<string> names_p, unique_ptr<TableFilterSet> table_filters_p,
|
15
|
-
idx_t estimated_cardinality)
|
16
|
-
: PhysicalOperator(PhysicalOperatorType::TABLE_SCAN, std::move(types), estimated_cardinality),
|
17
|
-
function(std::move(function_p)), bind_data(std::move(bind_data_p)), column_ids(std::move(column_ids_p)),
|
18
|
-
names(std::move(names_p)), table_filters(std::move(table_filters_p)) {
|
19
|
-
extra_info.file_filters = "";
|
20
|
-
}
|
21
|
-
|
22
12
|
PhysicalTableScan::PhysicalTableScan(vector<LogicalType> types, TableFunction function_p,
|
23
13
|
unique_ptr<FunctionData> bind_data_p, vector<LogicalType> returned_types_p,
|
24
14
|
vector<column_t> column_ids_p, vector<idx_t> projection_ids_p,
|
@@ -66,7 +66,8 @@ SourceResultType PhysicalAttach::GetData(ExecutionContext &context, DataChunk &c
|
|
66
66
|
const auto &path = info->path;
|
67
67
|
|
68
68
|
if (name.empty()) {
|
69
|
-
|
69
|
+
auto &fs = FileSystem::GetFileSystem(context.client);
|
70
|
+
name = AttachedDatabase::ExtractDatabaseName(path, fs);
|
70
71
|
}
|
71
72
|
auto &db_manager = DatabaseManager::Get(context.client);
|
72
73
|
auto existing_db = db_manager.GetDatabaseFromPath(context.client, path);
|
@@ -74,15 +74,11 @@ SourceResultType PhysicalCreateType::GetData(ExecutionContext &context, DataChun
|
|
74
74
|
if (IsSink()) {
|
75
75
|
D_ASSERT(info->type == LogicalType::INVALID);
|
76
76
|
auto &g_sink_state = sink_state->Cast<CreateTypeGlobalState>();
|
77
|
-
info->type = LogicalType::ENUM(
|
77
|
+
info->type = LogicalType::ENUM(g_sink_state.result, g_sink_state.size);
|
78
78
|
}
|
79
79
|
|
80
80
|
auto &catalog = Catalog::GetCatalog(context.client, info->catalog);
|
81
|
-
|
82
|
-
D_ASSERT(catalog_entry->type == CatalogType::TYPE_ENTRY);
|
83
|
-
auto &catalog_type = catalog_entry->Cast<TypeCatalogEntry>();
|
84
|
-
EnumType::SetCatalog(info->type, &catalog_type);
|
85
|
-
|
81
|
+
catalog.CreateType(context.client, *info);
|
86
82
|
return SourceResultType::FINISHED;
|
87
83
|
}
|
88
84
|
|
@@ -7,11 +7,10 @@
|
|
7
7
|
#include "duckdb/planner/expression/bound_constant_expression.hpp"
|
8
8
|
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
9
9
|
#include "duckdb/planner/expression/bound_window_expression.hpp"
|
10
|
-
#include "duckdb/planner/operator/logical_asof_join.hpp"
|
11
10
|
|
12
11
|
namespace duckdb {
|
13
12
|
|
14
|
-
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::
|
13
|
+
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::PlanAsOfJoin(LogicalComparisonJoin &op) {
|
15
14
|
// now visit the children
|
16
15
|
D_ASSERT(op.children.size() == 2);
|
17
16
|
idx_t lhs_cardinality = op.children[0]->EstimateCardinality(context);
|
@@ -237,7 +237,7 @@ static void RewriteJoinCondition(Expression &expr, idx_t offset) {
|
|
237
237
|
ExpressionIterator::EnumerateChildren(expr, [&](Expression &child) { RewriteJoinCondition(child, offset); });
|
238
238
|
}
|
239
239
|
|
240
|
-
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::
|
240
|
+
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::PlanComparisonJoin(LogicalComparisonJoin &op) {
|
241
241
|
// now visit the children
|
242
242
|
D_ASSERT(op.children.size() == 2);
|
243
243
|
idx_t lhs_cardinality = op.children[0]->EstimateCardinality(context);
|
@@ -338,4 +338,17 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalComparison
|
|
338
338
|
return plan;
|
339
339
|
}
|
340
340
|
|
341
|
+
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalComparisonJoin &op) {
|
342
|
+
switch (op.type) {
|
343
|
+
case LogicalOperatorType::LOGICAL_ASOF_JOIN:
|
344
|
+
return PlanAsOfJoin(op);
|
345
|
+
case LogicalOperatorType::LOGICAL_COMPARISON_JOIN:
|
346
|
+
return PlanComparisonJoin(op);
|
347
|
+
case LogicalOperatorType::LOGICAL_DELIM_JOIN:
|
348
|
+
return PlanDelimJoin(op);
|
349
|
+
default:
|
350
|
+
throw InternalException("Unrecognized operator type for LogicalComparisonJoin");
|
351
|
+
}
|
352
|
+
}
|
353
|
+
|
341
354
|
} // namespace duckdb
|
@@ -1,12 +1,11 @@
|
|
1
1
|
#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
|
2
2
|
#include "duckdb/execution/operator/projection/physical_projection.hpp"
|
3
3
|
#include "duckdb/execution/operator/filter/physical_filter.hpp"
|
4
|
-
#include "duckdb/execution/operator/scan/physical_table_scan.hpp"
|
5
4
|
#include "duckdb/execution/operator/schema/physical_create_index.hpp"
|
6
5
|
#include "duckdb/execution/operator/order/physical_order.hpp"
|
7
6
|
#include "duckdb/execution/physical_plan_generator.hpp"
|
8
|
-
#include "duckdb/function/table/table_scan.hpp"
|
9
7
|
#include "duckdb/planner/operator/logical_create_index.hpp"
|
8
|
+
#include "duckdb/planner/operator/logical_get.hpp"
|
10
9
|
#include "duckdb/planner/expression/bound_operator_expression.hpp"
|
11
10
|
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
12
11
|
#include "duckdb/planner/table_filter.hpp"
|
@@ -14,11 +13,10 @@
|
|
14
13
|
namespace duckdb {
|
15
14
|
|
16
15
|
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalCreateIndex &op) {
|
17
|
-
|
18
16
|
// generate a physical plan for the parallel index creation which consists of the following operators
|
19
17
|
// table scan - projection (for expression execution) - filter (NOT NULL) - order - create index
|
20
|
-
|
21
|
-
|
18
|
+
D_ASSERT(op.children.size() == 1);
|
19
|
+
auto table_scan = CreatePlan(*op.children[0]);
|
22
20
|
|
23
21
|
// validate that all expressions contain valid scalar functions
|
24
22
|
// e.g. get_current_timestamp(), random(), and sequence values are not allowed as ART keys
|
@@ -32,19 +30,7 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalCreateInde
|
|
32
30
|
}
|
33
31
|
|
34
32
|
// table scan operator for index key columns and row IDs
|
35
|
-
|
36
|
-
unique_ptr<TableFilterSet> table_filters;
|
37
|
-
op.info->column_ids.emplace_back(COLUMN_IDENTIFIER_ROW_ID);
|
38
|
-
|
39
|
-
auto &bind_data = op.bind_data->Cast<TableScanBindData>();
|
40
|
-
bind_data.is_create_index = true;
|
41
|
-
|
42
|
-
auto table_scan =
|
43
|
-
make_uniq<PhysicalTableScan>(op.info->scan_types, op.function, std::move(op.bind_data), op.info->column_ids,
|
44
|
-
op.info->names, std::move(table_filters), op.estimated_cardinality);
|
45
|
-
|
46
33
|
dependencies.AddDependency(op.table);
|
47
|
-
op.info->column_ids.pop_back();
|
48
34
|
|
49
35
|
D_ASSERT(op.info->scan_types.size() - 1 <= op.info->names.size());
|
50
36
|
D_ASSERT(op.info->scan_types.size() - 1 <= op.info->column_ids.size());
|
@@ -1,10 +1,7 @@
|
|
1
|
-
#include "duckdb/execution/aggregate_hashtable.hpp"
|
2
1
|
#include "duckdb/execution/operator/join/physical_delim_join.hpp"
|
3
2
|
#include "duckdb/execution/operator/join/physical_hash_join.hpp"
|
4
3
|
#include "duckdb/execution/operator/projection/physical_projection.hpp"
|
5
4
|
#include "duckdb/execution/physical_plan_generator.hpp"
|
6
|
-
#include "duckdb/planner/operator/logical_delim_join.hpp"
|
7
|
-
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
8
5
|
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
9
6
|
#include "duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp"
|
10
7
|
|
@@ -19,9 +16,9 @@ static void GatherDelimScans(const PhysicalOperator &op, vector<const_reference<
|
|
19
16
|
}
|
20
17
|
}
|
21
18
|
|
22
|
-
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::
|
19
|
+
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::PlanDelimJoin(LogicalComparisonJoin &op) {
|
23
20
|
// first create the underlying join
|
24
|
-
auto plan =
|
21
|
+
auto plan = PlanComparisonJoin(op);
|
25
22
|
// this should create a join, not a cross product
|
26
23
|
D_ASSERT(plan && plan->type != PhysicalOperatorType::CROSS_PRODUCT);
|
27
24
|
// duplicate eliminated join
|
@@ -113,12 +113,8 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalOperator &
|
|
113
113
|
case LogicalOperatorType::LOGICAL_ANY_JOIN:
|
114
114
|
plan = CreatePlan(op.Cast<LogicalAnyJoin>());
|
115
115
|
break;
|
116
|
-
case LogicalOperatorType::LOGICAL_DELIM_JOIN:
|
117
|
-
plan = CreatePlan(op.Cast<LogicalDelimJoin>());
|
118
|
-
break;
|
119
116
|
case LogicalOperatorType::LOGICAL_ASOF_JOIN:
|
120
|
-
|
121
|
-
break;
|
117
|
+
case LogicalOperatorType::LOGICAL_DELIM_JOIN:
|
122
118
|
case LogicalOperatorType::LOGICAL_COMPARISON_JOIN:
|
123
119
|
plan = CreatePlan(op.Cast<LogicalComparisonJoin>());
|
124
120
|
break;
|
@@ -36,7 +36,6 @@ bool StringEnumCastLoop(const string_t *source_data, ValidityMask &source_mask,
|
|
36
36
|
template <class T>
|
37
37
|
bool StringEnumCast(Vector &source, Vector &result, idx_t count, CastParameters ¶meters) {
|
38
38
|
D_ASSERT(source.GetType().id() == LogicalTypeId::VARCHAR);
|
39
|
-
auto enum_name = EnumType::GetTypeName(result.GetType());
|
40
39
|
switch (source.GetVectorType()) {
|
41
40
|
case VectorType::CONSTANT_VECTOR: {
|
42
41
|
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
@@ -27,9 +27,10 @@ ScalarFunction::ScalarFunction(vector<LogicalType> arguments, LogicalType return
|
|
27
27
|
}
|
28
28
|
|
29
29
|
bool ScalarFunction::operator==(const ScalarFunction &rhs) const {
|
30
|
-
return
|
31
|
-
statistics == rhs.statistics;
|
30
|
+
return name == rhs.name && arguments == rhs.arguments && return_type == rhs.return_type && varargs == rhs.varargs &&
|
31
|
+
bind == rhs.bind && dependency == rhs.dependency && statistics == rhs.statistics;
|
32
32
|
}
|
33
|
+
|
33
34
|
bool ScalarFunction::operator!=(const ScalarFunction &rhs) const {
|
34
35
|
return !(*this == rhs);
|
35
36
|
}
|
@@ -57,23 +58,6 @@ bool ScalarFunction::Equal(const ScalarFunction &rhs) const {
|
|
57
58
|
return true; // they are equal
|
58
59
|
}
|
59
60
|
|
60
|
-
bool ScalarFunction::CompareScalarFunctionT(const scalar_function_t &other) const {
|
61
|
-
typedef void(scalar_function_ptr_t)(DataChunk &, ExpressionState &, Vector &);
|
62
|
-
|
63
|
-
auto func_ptr = (scalar_function_ptr_t **)function.template target<scalar_function_ptr_t *>(); // NOLINT
|
64
|
-
auto other_ptr = (scalar_function_ptr_t **)other.template target<scalar_function_ptr_t *>(); // NOLINT
|
65
|
-
|
66
|
-
// Case the functions were created from lambdas the target will return a nullptr
|
67
|
-
if (!func_ptr && !other_ptr) {
|
68
|
-
return true;
|
69
|
-
}
|
70
|
-
if (func_ptr == nullptr || other_ptr == nullptr) {
|
71
|
-
// scalar_function_t (std::functions) from lambdas cannot be compared
|
72
|
-
return false;
|
73
|
-
}
|
74
|
-
return CastPointerToValue(*func_ptr) == CastPointerToValue(*other_ptr);
|
75
|
-
}
|
76
|
-
|
77
61
|
void ScalarFunction::NopFunction(DataChunk &input, ExpressionState &state, Vector &result) {
|
78
62
|
D_ASSERT(input.ColumnCount() >= 1);
|
79
63
|
result.Reference(input.data[0]);
|
@@ -1297,7 +1297,8 @@ unique_ptr<TableRef> ReadCSVReplacement(ClientContext &context, const string &ta
|
|
1297
1297
|
table_function->function = make_uniq<FunctionExpression>("read_csv_auto", std::move(children));
|
1298
1298
|
|
1299
1299
|
if (!FileSystem::HasGlob(table_name)) {
|
1300
|
-
|
1300
|
+
auto &fs = FileSystem::GetFileSystem(context);
|
1301
|
+
table_function->alias = fs.ExtractBaseName(table_name);
|
1301
1302
|
}
|
1302
1303
|
|
1303
1304
|
return std::move(table_function);
|
@@ -70,14 +70,14 @@ vector<TestType> TestAllTypesFun::GetTestTypes(bool use_large_enum) {
|
|
70
70
|
auto small_enum_ptr = FlatVector::GetData<string_t>(small_enum);
|
71
71
|
small_enum_ptr[0] = StringVector::AddStringOrBlob(small_enum, "DUCK_DUCK_ENUM");
|
72
72
|
small_enum_ptr[1] = StringVector::AddStringOrBlob(small_enum, "GOOSE");
|
73
|
-
result.emplace_back(LogicalType::ENUM(
|
73
|
+
result.emplace_back(LogicalType::ENUM(small_enum, 2), "small_enum");
|
74
74
|
|
75
75
|
Vector medium_enum(LogicalType::VARCHAR, 300);
|
76
76
|
auto medium_enum_ptr = FlatVector::GetData<string_t>(medium_enum);
|
77
77
|
for (idx_t i = 0; i < 300; i++) {
|
78
78
|
medium_enum_ptr[i] = StringVector::AddStringOrBlob(medium_enum, string("enum_") + to_string(i));
|
79
79
|
}
|
80
|
-
result.emplace_back(LogicalType::ENUM(
|
80
|
+
result.emplace_back(LogicalType::ENUM(medium_enum, 300), "medium_enum");
|
81
81
|
|
82
82
|
if (use_large_enum) {
|
83
83
|
// this is a big one... not sure if we should push this one here, but it's required for completeness
|
@@ -86,13 +86,13 @@ vector<TestType> TestAllTypesFun::GetTestTypes(bool use_large_enum) {
|
|
86
86
|
for (idx_t i = 0; i < 70000; i++) {
|
87
87
|
large_enum_ptr[i] = StringVector::AddStringOrBlob(large_enum, string("enum_") + to_string(i));
|
88
88
|
}
|
89
|
-
result.emplace_back(LogicalType::ENUM(
|
89
|
+
result.emplace_back(LogicalType::ENUM(large_enum, 70000), "large_enum");
|
90
90
|
} else {
|
91
91
|
Vector large_enum(LogicalType::VARCHAR, 2);
|
92
92
|
auto large_enum_ptr = FlatVector::GetData<string_t>(large_enum);
|
93
93
|
large_enum_ptr[0] = StringVector::AddStringOrBlob(large_enum, string("enum_") + to_string(0));
|
94
94
|
large_enum_ptr[1] = StringVector::AddStringOrBlob(large_enum, string("enum_") + to_string(69999));
|
95
|
-
result.emplace_back(LogicalType::ENUM(
|
95
|
+
result.emplace_back(LogicalType::ENUM(large_enum, 2), "large_enum");
|
96
96
|
}
|
97
97
|
|
98
98
|
// arrays
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "0.8.2-
|
2
|
+
#define DUCKDB_VERSION "0.8.2-dev2208"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "accdd3edb9"
|
6
6
|
#endif
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
8
8
|
#include "duckdb/main/database.hpp"
|
@@ -71,8 +71,6 @@ public:
|
|
71
71
|
DUCKDB_API vector<LogicalType> GetTypes();
|
72
72
|
//! Returns a list of the columns of the table
|
73
73
|
DUCKDB_API const ColumnList &GetColumns() const;
|
74
|
-
//! Returns a mutable list of the columns of the table
|
75
|
-
DUCKDB_API ColumnList &GetColumnsMutable();
|
76
74
|
//! Returns the underlying storage of the table
|
77
75
|
virtual DataTable &GetStorage();
|
78
76
|
//! Returns a list of the bound constraints of the table
|
@@ -29,10 +29,7 @@ public:
|
|
29
29
|
LogicalType user_type;
|
30
30
|
|
31
31
|
public:
|
32
|
-
|
33
|
-
virtual void Serialize(Serializer &serializer) const;
|
34
|
-
//! Deserializes to a TypeCatalogEntry
|
35
|
-
static unique_ptr<CreateTypeInfo> Deserialize(Deserializer &source);
|
32
|
+
unique_ptr<CreateInfo> GetInfo() const override;
|
36
33
|
|
37
34
|
string ToSQL() const override;
|
38
35
|
};
|
@@ -125,12 +125,6 @@ public:
|
|
125
125
|
void Verify(Catalog &catalog);
|
126
126
|
|
127
127
|
private:
|
128
|
-
//! Adjusts table dependencies on the event of an UNDO
|
129
|
-
void AdjustTableDependencies(CatalogEntry &entry);
|
130
|
-
//! Adjust one dependency
|
131
|
-
void AdjustDependency(CatalogEntry &entry, TableCatalogEntry &table, ColumnDefinition &column, bool remove);
|
132
|
-
//! Adjust User dependency
|
133
|
-
void AdjustUserDependency(CatalogEntry &entry, ColumnDefinition &column, bool remove);
|
134
128
|
//! Given a root entry, gets the entry valid for this transaction
|
135
129
|
CatalogEntry &GetEntryForTransaction(CatalogTransaction transaction, CatalogEntry ¤t);
|
136
130
|
CatalogEntry &GetCommittedEntry(CatalogEntry ¤t);
|
@@ -35,7 +35,6 @@ struct ExtraTypeInfo {
|
|
35
35
|
|
36
36
|
ExtraTypeInfoType type;
|
37
37
|
string alias;
|
38
|
-
optional_ptr<TypeCatalogEntry> catalog_entry;
|
39
38
|
|
40
39
|
public:
|
41
40
|
bool Equals(ExtraTypeInfo *other_p) const;
|
@@ -184,19 +183,17 @@ private:
|
|
184
183
|
enum EnumDictType : uint8_t { INVALID = 0, VECTOR_DICT = 1 };
|
185
184
|
|
186
185
|
struct EnumTypeInfo : public ExtraTypeInfo {
|
187
|
-
explicit EnumTypeInfo(
|
186
|
+
explicit EnumTypeInfo(Vector &values_insert_order_p, idx_t dict_size_p);
|
188
187
|
EnumTypeInfo(const EnumTypeInfo &) = delete;
|
189
188
|
EnumTypeInfo &operator=(const EnumTypeInfo &) = delete;
|
190
189
|
|
191
190
|
public:
|
192
191
|
const EnumDictType &GetEnumDictType() const;
|
193
|
-
const string &GetEnumName() const;
|
194
|
-
const string GetSchemaName() const;
|
195
192
|
const Vector &GetValuesInsertOrder() const;
|
196
193
|
const idx_t &GetDictSize() const;
|
197
194
|
static PhysicalType DictType(idx_t size);
|
198
195
|
|
199
|
-
static LogicalType CreateType(
|
196
|
+
static LogicalType CreateType(Vector &ordered_data, idx_t size);
|
200
197
|
|
201
198
|
void Serialize(FieldWriter &writer) const override;
|
202
199
|
static shared_ptr<ExtraTypeInfo> Deserialize(FieldReader &reader);
|
@@ -212,7 +209,6 @@ protected:
|
|
212
209
|
|
213
210
|
private:
|
214
211
|
EnumDictType dict_type;
|
215
|
-
string enum_name;
|
216
212
|
idx_t dict_size;
|
217
213
|
};
|
218
214
|
|
@@ -185,21 +185,21 @@ public:
|
|
185
185
|
DUCKDB_API virtual string ExpandPath(const string &path);
|
186
186
|
//! Returns the system-available memory in bytes. Returns DConstants::INVALID_INDEX if the system function fails.
|
187
187
|
DUCKDB_API static idx_t GetAvailableMemory();
|
188
|
-
//! Path separator for
|
189
|
-
DUCKDB_API
|
188
|
+
//! Path separator for path
|
189
|
+
DUCKDB_API virtual string PathSeparator(const string &path);
|
190
190
|
//! Checks if path is starts with separator (i.e., '/' on UNIX '\\' on Windows)
|
191
|
-
DUCKDB_API
|
191
|
+
DUCKDB_API bool IsPathAbsolute(const string &path);
|
192
192
|
//! Normalize an absolute path - the goal of normalizing is converting "\test.db" and "C:/test.db" into "C:\test.db"
|
193
193
|
//! so that the database system cache can correctly
|
194
|
-
DUCKDB_API
|
194
|
+
DUCKDB_API string NormalizeAbsolutePath(const string &path);
|
195
195
|
//! Join two paths together
|
196
|
-
DUCKDB_API
|
196
|
+
DUCKDB_API string JoinPath(const string &a, const string &path);
|
197
197
|
//! Convert separators in a path to the local separators (e.g. convert "/" into \\ on windows)
|
198
|
-
DUCKDB_API
|
198
|
+
DUCKDB_API string ConvertSeparators(const string &path);
|
199
199
|
//! Extract the base name of a file (e.g. if the input is lib/example.dll the base name is 'example')
|
200
|
-
DUCKDB_API
|
200
|
+
DUCKDB_API string ExtractBaseName(const string &path);
|
201
201
|
//! Extract the name of a file (e.g if the input is lib/example.dll the name is 'example.dll')
|
202
|
-
DUCKDB_API
|
202
|
+
DUCKDB_API string ExtractName(const string &path);
|
203
203
|
|
204
204
|
//! Returns the value of an environment variable - or the empty string if it is not set
|
205
205
|
DUCKDB_API static string GetEnvVariable(const string &name);
|
@@ -23,7 +23,7 @@ public:
|
|
23
23
|
|
24
24
|
public:
|
25
25
|
void SetFilenamePattern(const string &pattern);
|
26
|
-
string CreateFilename(
|
26
|
+
string CreateFilename(FileSystem &fs, const string &path, const string &extension, idx_t offset) const;
|
27
27
|
|
28
28
|
private:
|
29
29
|
string _base;
|
@@ -32,7 +32,7 @@ struct MultiFileReaderOptions {
|
|
32
32
|
DUCKDB_API static MultiFileReaderOptions FormatDeserialize(FormatDeserializer &source);
|
33
33
|
DUCKDB_API void AddBatchInfo(BindInfo &bind_info) const;
|
34
34
|
DUCKDB_API void AutoDetectHivePartitioning(const vector<string> &files, ClientContext &context);
|
35
|
-
DUCKDB_API static bool AutoDetectHivePartitioningInternal(const vector<string> &files);
|
35
|
+
DUCKDB_API static bool AutoDetectHivePartitioningInternal(const vector<string> &files, ClientContext &context);
|
36
36
|
DUCKDB_API void AutoDetectHiveTypesInternal(const string &file, ClientContext &context);
|
37
37
|
DUCKDB_API void VerifyHiveTypesArePartitions(const std::map<string, string> &partitions) const;
|
38
38
|
DUCKDB_API LogicalType GetHiveLogicalType(const string &hive_partition_column) const;
|
@@ -103,6 +103,10 @@ public:
|
|
103
103
|
GetFileSystem().RemoveFile(filename);
|
104
104
|
}
|
105
105
|
|
106
|
+
string PathSeparator(const string &path) override {
|
107
|
+
return GetFileSystem().PathSeparator(path);
|
108
|
+
}
|
109
|
+
|
106
110
|
vector<string> Glob(const string &path, FileOpener *opener = nullptr) override {
|
107
111
|
if (opener) {
|
108
112
|
throw InternalException("OpenerFileSystem cannot take an opener - the opener is pushed automatically");
|
@@ -37,14 +37,10 @@ public:
|
|
37
37
|
|
38
38
|
ClientContext &GetContext() override;
|
39
39
|
|
40
|
-
optional_ptr<Catalog> GetCatalog() override;
|
41
|
-
void SetCatalog(Catalog &catalog);
|
42
|
-
|
43
40
|
private:
|
44
41
|
idx_t file_size;
|
45
42
|
idx_t total_read;
|
46
43
|
optional_ptr<ClientContext> context;
|
47
|
-
optional_ptr<Catalog> catalog;
|
48
44
|
};
|
49
45
|
|
50
46
|
} // namespace duckdb
|
@@ -22,8 +22,6 @@ private:
|
|
22
22
|
uint64_t version = 0L;
|
23
23
|
|
24
24
|
public:
|
25
|
-
bool is_query_plan = false;
|
26
|
-
|
27
25
|
virtual ~Serializer() {
|
28
26
|
}
|
29
27
|
|
@@ -119,11 +117,6 @@ public:
|
|
119
117
|
throw InternalException("This deserializer does not have a client-context");
|
120
118
|
};
|
121
119
|
|
122
|
-
//! Gets the catalog for the deserializer
|
123
|
-
virtual optional_ptr<Catalog> GetCatalog() {
|
124
|
-
return nullptr;
|
125
|
-
};
|
126
|
-
|
127
120
|
template <class T>
|
128
121
|
T Read() {
|
129
122
|
T value;
|
@@ -26,7 +26,7 @@ struct timestamp_t { // NOLINT
|
|
26
26
|
int64_t value;
|
27
27
|
|
28
28
|
timestamp_t() = default;
|
29
|
-
explicit inline timestamp_t(int64_t value_p) : value(value_p) {
|
29
|
+
explicit inline constexpr timestamp_t(int64_t value_p) : value(value_p) {
|
30
30
|
}
|
31
31
|
inline timestamp_t &operator=(int64_t value_p) {
|
32
32
|
value = value_p;
|
@@ -67,21 +67,25 @@ struct timestamp_t { // NOLINT
|
|
67
67
|
timestamp_t &operator-=(const int64_t &delta);
|
68
68
|
|
69
69
|
// special values
|
70
|
-
static timestamp_t infinity() { // NOLINT
|
70
|
+
static constexpr timestamp_t infinity() { // NOLINT
|
71
71
|
return timestamp_t(NumericLimits<int64_t>::Maximum());
|
72
|
-
}
|
73
|
-
static timestamp_t ninfinity() { // NOLINT
|
72
|
+
} // NOLINT
|
73
|
+
static constexpr timestamp_t ninfinity() { // NOLINT
|
74
74
|
return timestamp_t(-NumericLimits<int64_t>::Maximum());
|
75
|
-
}
|
76
|
-
static inline timestamp_t epoch() { // NOLINT
|
75
|
+
} // NOLINT
|
76
|
+
static constexpr inline timestamp_t epoch() { // NOLINT
|
77
77
|
return timestamp_t(0);
|
78
78
|
} // NOLINT
|
79
79
|
};
|
80
80
|
|
81
|
-
struct timestamp_tz_t : public timestamp_t {
|
82
|
-
|
83
|
-
struct
|
84
|
-
|
81
|
+
struct timestamp_tz_t : public timestamp_t { // NOLINT
|
82
|
+
};
|
83
|
+
struct timestamp_ns_t : public timestamp_t { // NOLINT
|
84
|
+
};
|
85
|
+
struct timestamp_ms_t : public timestamp_t { // NOLINT
|
86
|
+
};
|
87
|
+
struct timestamp_sec_t : public timestamp_t { // NOLINT
|
88
|
+
};
|
85
89
|
|
86
90
|
enum class TimestampCastResult : uint8_t { SUCCESS, ERROR_INCORRECT_FORMAT, ERROR_NON_UTC_TIMEZONE };
|
87
91
|
|
@@ -286,8 +286,6 @@ struct LogicalType {
|
|
286
286
|
//! Serializes a LogicalType to a stand-alone binary blob
|
287
287
|
DUCKDB_API void Serialize(Serializer &serializer) const;
|
288
288
|
|
289
|
-
DUCKDB_API void SerializeEnumType(Serializer &serializer) const;
|
290
|
-
|
291
289
|
//! Deserializes a blob back into an LogicalType
|
292
290
|
DUCKDB_API static LogicalType Deserialize(Deserializer &source);
|
293
291
|
|
@@ -373,9 +371,10 @@ public:
|
|
373
371
|
DUCKDB_API static LogicalType STRUCT(child_list_t<LogicalType> children); // NOLINT
|
374
372
|
DUCKDB_API static LogicalType AGGREGATE_STATE(aggregate_state_t state_type); // NOLINT
|
375
373
|
DUCKDB_API static LogicalType MAP(const LogicalType &child); // NOLINT
|
376
|
-
DUCKDB_API static LogicalType MAP( child_list_t<LogicalType> children); // NOLINT
|
377
374
|
DUCKDB_API static LogicalType MAP(LogicalType key, LogicalType value); // NOLINT
|
378
375
|
DUCKDB_API static LogicalType UNION( child_list_t<LogicalType> members); // NOLINT
|
376
|
+
DUCKDB_API static LogicalType ENUM(Vector &ordered_data, idx_t size); // NOLINT
|
377
|
+
// DEPRECATED - provided for backwards compatibility
|
379
378
|
DUCKDB_API static LogicalType ENUM(const string &enum_name, Vector &ordered_data, idx_t size); // NOLINT
|
380
379
|
DUCKDB_API static LogicalType USER(const string &user_type_name); // NOLINT
|
381
380
|
//! A list of all NUMERIC types (integral and floating point types)
|
@@ -400,21 +399,17 @@ struct ListType {
|
|
400
399
|
DUCKDB_API static const LogicalType &GetChildType(const LogicalType &type);
|
401
400
|
};
|
402
401
|
|
403
|
-
struct UserType{
|
402
|
+
struct UserType {
|
404
403
|
DUCKDB_API static const string &GetTypeName(const LogicalType &type);
|
405
404
|
};
|
406
405
|
|
407
|
-
struct EnumType{
|
408
|
-
DUCKDB_API static const string &GetTypeName(const LogicalType &type);
|
406
|
+
struct EnumType {
|
409
407
|
DUCKDB_API static int64_t GetPos(const LogicalType &type, const string_t& key);
|
410
408
|
DUCKDB_API static const Vector &GetValuesInsertOrder(const LogicalType &type);
|
411
409
|
DUCKDB_API static idx_t GetSize(const LogicalType &type);
|
412
410
|
DUCKDB_API static const string GetValue(const Value &val);
|
413
|
-
DUCKDB_API static void SetCatalog(LogicalType &type, optional_ptr<TypeCatalogEntry> catalog_entry);
|
414
|
-
DUCKDB_API static optional_ptr<TypeCatalogEntry> GetCatalog(const LogicalType &type);
|
415
|
-
DUCKDB_API static string GetSchemaName(const LogicalType &type);
|
416
411
|
DUCKDB_API static PhysicalType GetPhysicalType(const LogicalType &type);
|
417
|
-
DUCKDB_API static
|
412
|
+
DUCKDB_API static string_t GetString(const LogicalType &type, idx_t pos);
|
418
413
|
};
|
419
414
|
|
420
415
|
struct StructType {
|
@@ -68,6 +68,8 @@ public:
|
|
68
68
|
|
69
69
|
void SetDisabledFileSystems(const vector<string> &names) override;
|
70
70
|
|
71
|
+
string PathSeparator(const string &path) override;
|
72
|
+
|
71
73
|
private:
|
72
74
|
FileSystem &FindFileSystem(const string &path);
|
73
75
|
FileSystem &FindFileSystemInternal(const string &path);
|
@@ -22,10 +22,6 @@ public:
|
|
22
22
|
static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::TABLE_SCAN;
|
23
23
|
|
24
24
|
public:
|
25
|
-
//! Regular Table Scan
|
26
|
-
PhysicalTableScan(vector<LogicalType> types, TableFunction function, unique_ptr<FunctionData> bind_data,
|
27
|
-
vector<column_t> column_ids, vector<string> names, unique_ptr<TableFilterSet> table_filters,
|
28
|
-
idx_t estimated_cardinality);
|
29
25
|
//! Table scan that immediately projects out filter columns that are unused in the remainder of the query plan
|
30
26
|
PhysicalTableScan(vector<LogicalType> types, TableFunction function, unique_ptr<FunctionData> bind_data,
|
31
27
|
vector<LogicalType> returned_types, vector<column_t> column_ids, vector<idx_t> projection_ids,
|