duckdb 0.7.2-dev3441.0 → 0.7.2-dev3546.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/configure.py +2 -0
- package/package.json +2 -2
- package/src/duckdb/extension/json/json_functions/json_create.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/read_json.cpp +1 -0
- package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +42 -0
- package/src/duckdb/src/catalog/catalog_search_path.cpp +5 -0
- package/src/duckdb/src/catalog/catalog_set.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_functions.cpp +1 -0
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +4 -4
- package/src/duckdb/src/common/compressed_file_system.cpp +2 -2
- package/src/duckdb/src/common/constants.cpp +1 -0
- package/src/duckdb/src/common/file_system.cpp +2 -2
- package/src/duckdb/src/common/row_operations/row_gather.cpp +2 -2
- package/src/duckdb/src/common/serializer/binary_deserializer.cpp +1 -1
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +1 -1
- package/src/duckdb/src/common/serializer/buffered_file_writer.cpp +1 -1
- package/src/duckdb/src/common/serializer/buffered_serializer.cpp +4 -3
- package/src/duckdb/src/common/serializer.cpp +1 -1
- package/src/duckdb/src/common/sort/radix_sort.cpp +5 -5
- package/src/duckdb/src/common/string_util.cpp +2 -2
- package/src/duckdb/src/common/types/bit.cpp +2 -2
- package/src/duckdb/src/common/types/blob.cpp +2 -2
- package/src/duckdb/src/common/types/data_chunk.cpp +2 -2
- package/src/duckdb/src/common/types/date.cpp +1 -1
- package/src/duckdb/src/common/types/decimal.cpp +2 -2
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +14 -2
- package/src/duckdb/src/common/types/selection_vector.cpp +1 -1
- package/src/duckdb/src/common/types/time.cpp +1 -1
- package/src/duckdb/src/common/types/vector.cpp +10 -10
- package/src/duckdb/src/common/types/vector_buffer.cpp +11 -3
- package/src/duckdb/src/common/types/vector_cache.cpp +5 -5
- package/src/duckdb/src/common/virtual_file_system.cpp +4 -0
- package/src/duckdb/src/common/windows_util.cpp +2 -2
- package/src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp +6 -3
- package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +2 -5
- package/src/duckdb/src/core_functions/scalar/string/printf.cpp +1 -1
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +1 -1
- package/src/duckdb/src/execution/join_hashtable.cpp +3 -3
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +2 -2
- package/src/duckdb/src/execution/operator/join/outer_join_marker.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +2 -7
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +4 -41
- package/src/duckdb/src/execution/operator/persistent/csv_file_handle.cpp +158 -0
- package/src/duckdb/src/execution/operator/projection/physical_pivot.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +2 -2
- package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +2 -2
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +3 -4
- package/src/duckdb/src/execution/window_segment_tree.cpp +1 -1
- package/src/duckdb/src/function/macro_function.cpp +43 -0
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +1 -1
- package/src/duckdb/src/function/scalar/strftime_format.cpp +2 -1
- package/src/duckdb/src/function/scalar/string/concat.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/like.cpp +2 -2
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +5 -5
- package/src/duckdb/src/function/scalar_macro_function.cpp +10 -0
- package/src/duckdb/src/function/table/copy_csv.cpp +3 -7
- package/src/duckdb/src/function/table/read_csv.cpp +60 -35
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/table_macro_function.cpp +10 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +3 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +0 -6
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +0 -6
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/compressed_file_system.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -5
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/helper.hpp +22 -9
- package/src/duckdb/src/include/duckdb/common/memory_safety.hpp +15 -0
- package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_writer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_serializer.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/sort/duckdb_pdqsort.hpp +11 -6
- package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +16 -6
- package/src/duckdb/src/include/duckdb/common/unique_ptr.hpp +53 -22
- package/src/duckdb/src/include/duckdb/common/vector.hpp +5 -2
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +4 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/outer_join_marker.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/perfect_hash_join_executor.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_range_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/base_csv_reader.hpp +0 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/buffered_csv_reader.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_file_handle.hpp +27 -127
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/parallel_csv_reader.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/perfect_aggregate_hashtable.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +7 -1
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +3 -4
- package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +7 -2
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +2 -4
- package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +5 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_relation.hpp +3 -3
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +4 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +8 -12
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +6 -20
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +6 -18
- package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +4 -8
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +4 -38
- package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +5 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +10 -10
- package/src/duckdb/src/include/duckdb/parser/statement/insert_statement.hpp +5 -0
- package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/buffer/buffer_handle.hpp +9 -2
- package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/append_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +2 -2
- package/src/duckdb/src/optimizer/join_order/join_relation_set.cpp +5 -5
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +14 -6
- package/src/duckdb/src/parser/parsed_data/attach_info.cpp +42 -0
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +0 -7
- package/src/duckdb/src/parser/parsed_data/create_info.cpp +19 -8
- package/src/duckdb/src/parser/parsed_data/create_macro_info.cpp +46 -0
- package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +56 -0
- package/src/duckdb/src/parser/parsed_data/create_type_info.cpp +47 -0
- package/src/duckdb/src/parser/parsed_data/detach_info.cpp +34 -0
- package/src/duckdb/src/parser/parsed_data/drop_info.cpp +46 -0
- package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +24 -0
- package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +37 -0
- package/src/duckdb/src/parser/statement/insert_statement.cpp +4 -1
- package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +10 -0
- package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +27 -9
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +2 -1
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +1 -0
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +32 -7
- package/src/duckdb/src/planner/logical_operator.cpp +1 -2
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +16 -25
- package/src/duckdb/src/planner/operator/logical_insert.cpp +30 -0
- package/src/duckdb/src/planner/operator/logical_simple.cpp +33 -5
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +6 -16
- package/src/duckdb/src/planner/planner.cpp +4 -13
- package/src/duckdb/src/storage/arena_allocator.cpp +1 -1
- package/src/duckdb/src/storage/buffer/buffer_handle.cpp +2 -11
- package/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +1 -1
- package/src/duckdb/src/storage/checkpoint_manager.cpp +12 -6
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +2 -2
- package/src/duckdb/src/storage/statistics/list_stats.cpp +1 -1
- package/src/duckdb/src/storage/statistics/struct_stats.cpp +1 -1
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/src/storage/table/row_group.cpp +2 -2
- package/src/duckdb/src/storage/table/update_segment.cpp +7 -6
- package/src/duckdb/third_party/fsst/libfsst.cpp +1 -2
- package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +9 -0
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +13 -12
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +2 -1
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +12537 -12415
- package/src/duckdb/ub_src_catalog_catalog_entry.cpp +1 -1
- package/src/duckdb/ub_src_execution_operator_persistent.cpp +2 -0
- package/src/duckdb/ub_src_parser_parsed_data.cpp +16 -0
- package/src/statement.cpp +15 -13
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +0 -104
@@ -1,7 +1,11 @@
|
|
1
1
|
#include "duckdb/planner/operator/logical_simple.hpp"
|
2
2
|
#include "duckdb/parser/parsed_data/alter_info.hpp"
|
3
|
+
#include "duckdb/parser/parsed_data/attach_info.hpp"
|
3
4
|
#include "duckdb/parser/parsed_data/drop_info.hpp"
|
4
5
|
#include "duckdb/parser/parsed_data/load_info.hpp"
|
6
|
+
#include "duckdb/parser/parsed_data/transaction_info.hpp"
|
7
|
+
#include "duckdb/parser/parsed_data/vacuum_info.hpp"
|
8
|
+
#include "duckdb/parser/parsed_data/detach_info.hpp"
|
5
9
|
|
6
10
|
namespace duckdb {
|
7
11
|
|
@@ -9,16 +13,28 @@ void LogicalSimple::Serialize(FieldWriter &writer) const {
|
|
9
13
|
writer.WriteField<LogicalOperatorType>(type);
|
10
14
|
switch (type) {
|
11
15
|
case LogicalOperatorType::LOGICAL_ALTER:
|
12
|
-
|
16
|
+
info->Cast<AlterInfo>().Serialize(writer.GetSerializer());
|
13
17
|
break;
|
14
18
|
case LogicalOperatorType::LOGICAL_DROP:
|
15
|
-
|
19
|
+
info->Cast<DropInfo>().Serialize(writer.GetSerializer());
|
16
20
|
break;
|
17
21
|
case LogicalOperatorType::LOGICAL_LOAD:
|
18
|
-
|
22
|
+
info->Cast<LoadInfo>().Serialize(writer.GetSerializer());
|
23
|
+
break;
|
24
|
+
case LogicalOperatorType::LOGICAL_VACUUM:
|
25
|
+
info->Cast<VacuumInfo>().Serialize(writer.GetSerializer());
|
26
|
+
break;
|
27
|
+
case LogicalOperatorType::LOGICAL_ATTACH:
|
28
|
+
info->Cast<AttachInfo>().Serialize(writer.GetSerializer());
|
29
|
+
break;
|
30
|
+
case LogicalOperatorType::LOGICAL_DETACH:
|
31
|
+
info->Cast<DetachInfo>().Serialize(writer.GetSerializer());
|
32
|
+
break;
|
33
|
+
case LogicalOperatorType::LOGICAL_TRANSACTION:
|
34
|
+
info->Cast<TransactionInfo>().Serialize(writer.GetSerializer());
|
19
35
|
break;
|
20
36
|
default:
|
21
|
-
throw
|
37
|
+
throw InternalException(LogicalOperatorToString(type));
|
22
38
|
}
|
23
39
|
}
|
24
40
|
|
@@ -35,8 +51,20 @@ unique_ptr<LogicalOperator> LogicalSimple::Deserialize(LogicalDeserializationSta
|
|
35
51
|
case LogicalOperatorType::LOGICAL_LOAD:
|
36
52
|
parse_info = LoadInfo::Deserialize(reader.GetSource());
|
37
53
|
break;
|
54
|
+
case LogicalOperatorType::LOGICAL_VACUUM:
|
55
|
+
parse_info = VacuumInfo::Deserialize(reader.GetSource());
|
56
|
+
break;
|
57
|
+
case LogicalOperatorType::LOGICAL_ATTACH:
|
58
|
+
parse_info = AttachInfo::Deserialize(reader.GetSource());
|
59
|
+
break;
|
60
|
+
case LogicalOperatorType::LOGICAL_DETACH:
|
61
|
+
parse_info = DetachInfo::Deserialize(reader.GetSource());
|
62
|
+
break;
|
63
|
+
case LogicalOperatorType::LOGICAL_TRANSACTION:
|
64
|
+
parse_info = TransactionInfo::Deserialize(reader.GetSource());
|
65
|
+
break;
|
38
66
|
default:
|
39
|
-
throw
|
67
|
+
throw InternalException(LogicalOperatorToString(state.type));
|
40
68
|
}
|
41
69
|
return make_uniq<LogicalSimple>(type, std::move(parse_info));
|
42
70
|
}
|
@@ -6,25 +6,15 @@
|
|
6
6
|
namespace duckdb {
|
7
7
|
void BoundCreateTableInfo::Serialize(Serializer &serializer) const {
|
8
8
|
serializer.WriteOptional(base);
|
9
|
-
serializer.WriteList(constraints);
|
10
|
-
serializer.WriteList(bound_constraints);
|
11
|
-
serializer.WriteList(bound_defaults);
|
12
|
-
serializer.WriteOptional(query);
|
13
9
|
}
|
14
10
|
|
15
11
|
unique_ptr<BoundCreateTableInfo> BoundCreateTableInfo::Deserialize(Deserializer &source,
|
16
12
|
PlanDeserializationState &state) {
|
17
|
-
auto
|
18
|
-
|
19
|
-
auto
|
20
|
-
auto
|
21
|
-
auto
|
22
|
-
|
23
|
-
auto result = make_uniq<BoundCreateTableInfo>(schema_catalog_entry, std::move(create_info_base));
|
24
|
-
source.ReadList<Constraint>(result->constraints);
|
25
|
-
source.ReadList<BoundConstraint>(result->bound_constraints);
|
26
|
-
source.ReadList<Expression>(result->bound_defaults, state);
|
27
|
-
result->query = source.ReadOptional<LogicalOperator>(state);
|
28
|
-
return result;
|
13
|
+
auto info = source.ReadOptional<CreateInfo>();
|
14
|
+
auto schema_name = info->schema;
|
15
|
+
auto catalog = info->catalog;
|
16
|
+
auto binder = Binder::CreateBinder(state.context);
|
17
|
+
auto bound_info = binder->BindCreateTableInfo(std::move(info));
|
18
|
+
return bound_info;
|
29
19
|
}
|
30
20
|
} // namespace duckdb
|
@@ -143,24 +143,11 @@ void Planner::CreatePlan(unique_ptr<SQLStatement> statement) {
|
|
143
143
|
|
144
144
|
static bool OperatorSupportsSerialization(LogicalOperator &op) {
|
145
145
|
switch (op.type) {
|
146
|
-
case LogicalOperatorType::LOGICAL_INSERT:
|
147
|
-
case LogicalOperatorType::LOGICAL_UPDATE:
|
148
|
-
case LogicalOperatorType::LOGICAL_DELETE:
|
149
146
|
case LogicalOperatorType::LOGICAL_PREPARE:
|
150
147
|
case LogicalOperatorType::LOGICAL_EXECUTE:
|
151
|
-
case LogicalOperatorType::LOGICAL_ALTER:
|
152
|
-
case LogicalOperatorType::LOGICAL_CREATE_TABLE:
|
153
|
-
case LogicalOperatorType::LOGICAL_CREATE_INDEX:
|
154
|
-
case LogicalOperatorType::LOGICAL_CREATE_SEQUENCE:
|
155
|
-
case LogicalOperatorType::LOGICAL_CREATE_VIEW:
|
156
|
-
case LogicalOperatorType::LOGICAL_CREATE_SCHEMA:
|
157
|
-
case LogicalOperatorType::LOGICAL_CREATE_MACRO:
|
158
148
|
case LogicalOperatorType::LOGICAL_PRAGMA:
|
159
|
-
case LogicalOperatorType::LOGICAL_TRANSACTION:
|
160
|
-
case LogicalOperatorType::LOGICAL_CREATE_TYPE:
|
161
149
|
case LogicalOperatorType::LOGICAL_EXPLAIN:
|
162
150
|
case LogicalOperatorType::LOGICAL_COPY_TO_FILE:
|
163
|
-
case LogicalOperatorType::LOGICAL_VACUUM:
|
164
151
|
// unsupported (for now)
|
165
152
|
return false;
|
166
153
|
default:
|
@@ -175,6 +162,10 @@ static bool OperatorSupportsSerialization(LogicalOperator &op) {
|
|
175
162
|
}
|
176
163
|
|
177
164
|
void Planner::VerifyPlan(ClientContext &context, unique_ptr<LogicalOperator> &op, bound_parameter_map_t *map) {
|
165
|
+
#ifdef DUCKDB_ALTERNATIVE_VERIFY
|
166
|
+
// if alternate verification is enabled we run the original operator
|
167
|
+
return;
|
168
|
+
#endif
|
178
169
|
if (!op || !ClientConfig::GetConfig(context).verify_serializer) {
|
179
170
|
return;
|
180
171
|
}
|
@@ -64,7 +64,7 @@ data_ptr_t ArenaAllocator::Allocate(idx_t len) {
|
|
64
64
|
do {
|
65
65
|
current_capacity *= 2;
|
66
66
|
} while (current_capacity < len);
|
67
|
-
auto new_chunk =
|
67
|
+
auto new_chunk = make_unsafe_uniq<ArenaChunk>(allocator, current_capacity);
|
68
68
|
if (head) {
|
69
69
|
head->prev = new_chunk.get();
|
70
70
|
new_chunk->next = std::move(head);
|
@@ -7,7 +7,8 @@ namespace duckdb {
|
|
7
7
|
BufferHandle::BufferHandle() : handle(nullptr), node(nullptr) {
|
8
8
|
}
|
9
9
|
|
10
|
-
BufferHandle::BufferHandle(shared_ptr<BlockHandle>
|
10
|
+
BufferHandle::BufferHandle(shared_ptr<BlockHandle> handle_p, FileBuffer *node_p)
|
11
|
+
: handle(std::move(handle_p)), node(node_p) {
|
11
12
|
}
|
12
13
|
|
13
14
|
BufferHandle::BufferHandle(BufferHandle &&other) noexcept {
|
@@ -29,16 +30,6 @@ bool BufferHandle::IsValid() const {
|
|
29
30
|
return node != nullptr;
|
30
31
|
}
|
31
32
|
|
32
|
-
data_ptr_t BufferHandle::Ptr() const {
|
33
|
-
D_ASSERT(IsValid());
|
34
|
-
return node->buffer;
|
35
|
-
}
|
36
|
-
|
37
|
-
data_ptr_t BufferHandle::Ptr() {
|
38
|
-
D_ASSERT(IsValid());
|
39
|
-
return node->buffer;
|
40
|
-
}
|
41
|
-
|
42
33
|
void BufferHandle::Destroy() {
|
43
34
|
if (!handle || !IsValid()) {
|
44
35
|
return;
|
@@ -32,7 +32,7 @@ void WriteOverflowStringsToDisk::WriteString(string_t string, block_id_t &result
|
|
32
32
|
MiniZStream s;
|
33
33
|
size_t compressed_size = 0;
|
34
34
|
compressed_size = s.MaxCompressedLength(uncompressed_size);
|
35
|
-
auto compressed_buf =
|
35
|
+
auto compressed_buf = make_unsafe_array<data_t>(compressed_size);
|
36
36
|
s.Compress((const char *)string.GetData(), uncompressed_size, (char *)compressed_buf.get(), &compressed_size);
|
37
37
|
string_t compressed_string((const char *)compressed_buf.get(), compressed_size);
|
38
38
|
|
@@ -337,7 +337,6 @@ void CheckpointWriter::WriteIndex(IndexCatalogEntry &index_catalog) {
|
|
337
337
|
}
|
338
338
|
|
339
339
|
void CheckpointReader::ReadIndex(ClientContext &context, MetaBlockReader &reader) {
|
340
|
-
|
341
340
|
// deserialize the index metadata
|
342
341
|
auto info = IndexCatalogEntry::Deserialize(reader, context);
|
343
342
|
|
@@ -361,10 +360,17 @@ void CheckpointReader::ReadIndex(ClientContext &context, MetaBlockReader &reader
|
|
361
360
|
}
|
362
361
|
|
363
362
|
// bind the parsed expressions
|
363
|
+
// add the table to the bind context
|
364
364
|
auto binder = Binder::CreateBinder(context);
|
365
|
-
|
366
|
-
|
367
|
-
|
365
|
+
vector<LogicalType> column_types;
|
366
|
+
vector<string> column_names;
|
367
|
+
for (auto &col : table_catalog.GetColumns().Logical()) {
|
368
|
+
column_types.push_back(col.Type());
|
369
|
+
column_names.push_back(col.Name());
|
370
|
+
}
|
371
|
+
vector<column_t> column_ids;
|
372
|
+
binder->bind_context.AddBaseTable(0, info->table->table_name, column_names, column_types, column_ids,
|
373
|
+
&table_catalog);
|
368
374
|
IndexBinder idx_binder(*binder, context);
|
369
375
|
unbound_expressions.reserve(parsed_expressions.size());
|
370
376
|
for (auto &expr : parsed_expressions) {
|
@@ -419,7 +425,7 @@ void CheckpointWriter::WriteMacro(ScalarMacroCatalogEntry ¯o) {
|
|
419
425
|
}
|
420
426
|
|
421
427
|
void CheckpointReader::ReadMacro(ClientContext &context, MetaBlockReader &reader) {
|
422
|
-
auto info =
|
428
|
+
auto info = MacroCatalogEntry::Deserialize(reader, context);
|
423
429
|
catalog.CreateFunction(context, *info);
|
424
430
|
}
|
425
431
|
|
@@ -428,7 +434,7 @@ void CheckpointWriter::WriteTableMacro(TableMacroCatalogEntry ¯o) {
|
|
428
434
|
}
|
429
435
|
|
430
436
|
void CheckpointReader::ReadTableMacro(ClientContext &context, MetaBlockReader &reader) {
|
431
|
-
auto info =
|
437
|
+
auto info = MacroCatalogEntry::Deserialize(reader, context);
|
432
438
|
catalog.CreateFunction(context, *info);
|
433
439
|
}
|
434
440
|
|
@@ -292,13 +292,13 @@ string_t UncompressedStringStorage::ReadOverflowString(ColumnSegment &segment, V
|
|
292
292
|
offset += 2 * sizeof(uint32_t);
|
293
293
|
|
294
294
|
data_ptr_t decompression_ptr;
|
295
|
-
|
295
|
+
unsafe_array_ptr<data_t> decompression_buffer;
|
296
296
|
|
297
297
|
// If string is in single block we decompress straight from it, else we copy first
|
298
298
|
if (remaining <= Storage::BLOCK_SIZE - sizeof(block_id_t) - offset) {
|
299
299
|
decompression_ptr = handle.Ptr() + offset;
|
300
300
|
} else {
|
301
|
-
decompression_buffer =
|
301
|
+
decompression_buffer = make_unsafe_array<data_t>(compressed_size);
|
302
302
|
auto target_ptr = decompression_buffer.get();
|
303
303
|
|
304
304
|
// now append the string to the single buffer
|
@@ -7,7 +7,7 @@
|
|
7
7
|
namespace duckdb {
|
8
8
|
|
9
9
|
void ListStats::Construct(BaseStatistics &stats) {
|
10
|
-
stats.child_stats =
|
10
|
+
stats.child_stats = unsafe_array_ptr<BaseStatistics>(new BaseStatistics[1]);
|
11
11
|
BaseStatistics::Construct(stats.child_stats[0], ListType::GetChildType(stats.GetType()));
|
12
12
|
}
|
13
13
|
|
@@ -7,7 +7,7 @@ namespace duckdb {
|
|
7
7
|
|
8
8
|
void StructStats::Construct(BaseStatistics &stats) {
|
9
9
|
auto &child_types = StructType::GetChildTypes(stats.GetType());
|
10
|
-
stats.child_stats =
|
10
|
+
stats.child_stats = unsafe_array_ptr<BaseStatistics>(new BaseStatistics[child_types.size()]);
|
11
11
|
for (idx_t i = 0; i < child_types.size(); i++) {
|
12
12
|
BaseStatistics::Construct(stats.child_stats[i], child_types[i].second);
|
13
13
|
}
|
@@ -155,7 +155,7 @@ void ColumnScanState::Initialize(const LogicalType &type) {
|
|
155
155
|
|
156
156
|
void CollectionScanState::Initialize(const vector<LogicalType> &types) {
|
157
157
|
auto &column_ids = GetColumnIds();
|
158
|
-
column_scans =
|
158
|
+
column_scans = make_unsafe_array<ColumnScanState>(column_ids.size());
|
159
159
|
for (idx_t i = 0; i < column_ids.size(); i++) {
|
160
160
|
if (column_ids[i] == COLUMN_IDENTIFIER_ROW_ID) {
|
161
161
|
continue;
|
@@ -695,7 +695,7 @@ void RowGroup::InitializeAppend(RowGroupAppendState &append_state) {
|
|
695
695
|
append_state.row_group = this;
|
696
696
|
append_state.offset_in_row_group = this->count;
|
697
697
|
// for each column, initialize the append state
|
698
|
-
append_state.states =
|
698
|
+
append_state.states = make_unsafe_array<ColumnAppendState>(GetColumnCount());
|
699
699
|
for (idx_t i = 0; i < GetColumnCount(); i++) {
|
700
700
|
auto &col_data = GetColumn(i);
|
701
701
|
col_data.InitializeAppend(append_state.states[i]);
|
@@ -1042,8 +1042,9 @@ static idx_t SortSelectionVector(SelectionVector &sel, idx_t count, row_t *ids)
|
|
1042
1042
|
return pos;
|
1043
1043
|
}
|
1044
1044
|
|
1045
|
-
UpdateInfo *CreateEmptyUpdateInfo(TransactionData transaction, idx_t type_size, idx_t count,
|
1046
|
-
|
1045
|
+
UpdateInfo *CreateEmptyUpdateInfo(TransactionData transaction, idx_t type_size, idx_t count,
|
1046
|
+
unsafe_array_ptr<char> &data) {
|
1047
|
+
data = make_unsafe_array<char>(sizeof(UpdateInfo) + (sizeof(sel_t) + type_size) * STANDARD_VECTOR_SIZE);
|
1047
1048
|
auto update_info = (UpdateInfo *)data.get();
|
1048
1049
|
update_info->max = STANDARD_VECTOR_SIZE;
|
1049
1050
|
update_info->tuples = (sel_t *)(((data_ptr_t)update_info) + sizeof(UpdateInfo));
|
@@ -1109,7 +1110,7 @@ void UpdateSegment::Update(TransactionData transaction, idx_t column_index, Vect
|
|
1109
1110
|
}
|
1110
1111
|
node = node->next;
|
1111
1112
|
}
|
1112
|
-
|
1113
|
+
unsafe_array_ptr<char> update_info_data;
|
1113
1114
|
if (!node) {
|
1114
1115
|
// no updates made yet by this transaction: initially the update info to empty
|
1115
1116
|
if (transaction.transaction) {
|
@@ -1144,8 +1145,8 @@ void UpdateSegment::Update(TransactionData transaction, idx_t column_index, Vect
|
|
1144
1145
|
auto result = make_uniq<UpdateNodeData>();
|
1145
1146
|
|
1146
1147
|
result->info = make_uniq<UpdateInfo>();
|
1147
|
-
result->tuples =
|
1148
|
-
result->tuple_data =
|
1148
|
+
result->tuples = make_unsafe_array<sel_t>(STANDARD_VECTOR_SIZE);
|
1149
|
+
result->tuple_data = make_unsafe_array<data_t>(STANDARD_VECTOR_SIZE * type_size);
|
1149
1150
|
result->info->tuples = result->tuples.get();
|
1150
1151
|
result->info->tuple_data = result->tuple_data.get();
|
1151
1152
|
result->info->version_number = TRANSACTION_ID_START - 1;
|
@@ -1153,7 +1154,7 @@ void UpdateSegment::Update(TransactionData transaction, idx_t column_index, Vect
|
|
1153
1154
|
InitializeUpdateInfo(*result->info, ids, sel, count, vector_index, vector_offset);
|
1154
1155
|
|
1155
1156
|
// now create the transaction level update info in the undo log
|
1156
|
-
|
1157
|
+
unsafe_array_ptr<char> update_info_data;
|
1157
1158
|
UpdateInfo *transaction_node;
|
1158
1159
|
if (transaction.transaction) {
|
1159
1160
|
transaction_node = transaction.transaction->CreateUpdateInfo(type_size, count);
|
@@ -381,8 +381,7 @@ static inline size_t compressBulk(SymbolTable &symbolTable, size_t nlines, size_
|
|
381
381
|
size_t curLine, suffixLim = symbolTable.suffixLim;
|
382
382
|
u8 byteLim = symbolTable.nSymbols + symbolTable.zeroTerminated - symbolTable.lenHisto[0];
|
383
383
|
|
384
|
-
u8 buf[512+7]; /* +7 sentinel is to avoid 8-byte unaligned-loads going beyond 511 out-of-bounds */
|
385
|
-
memset(buf+511, 0, 8); /* and initialize the sentinal bytes */
|
384
|
+
u8 buf[512+7] = {}; /* +7 sentinel is to avoid 8-byte unaligned-loads going beyond 511 out-of-bounds */
|
386
385
|
|
387
386
|
// three variants are possible. dead code falls away since the bool arguments are constants
|
388
387
|
auto compressVariant = [&](bool noSuffixOpt, bool avoidBranch) {
|
@@ -814,4 +814,13 @@ typedef enum PGOnConflictActionAlias {
|
|
814
814
|
PG_ONCONFLICT_ALIAS_IGNORE /* INSERT OR IGNORE */
|
815
815
|
} PGOnConflictActionAlias;
|
816
816
|
|
817
|
+
/*
|
818
|
+
* PGInsertByNameOrPosition
|
819
|
+
* "INSERT BY [POSITION|NAME]
|
820
|
+
*/
|
821
|
+
typedef enum PGInsertColumnOrder {
|
822
|
+
PG_INSERT_BY_POSITION, /* INSERT BY POSITION (default behavior) */
|
823
|
+
PG_INSERT_BY_NAME, /* INSERT BY NAME */
|
824
|
+
} PGInsertColumnOrder;
|
825
|
+
|
817
826
|
}
|
@@ -1045,11 +1045,11 @@ typedef struct PGInferClause {
|
|
1045
1045
|
*/
|
1046
1046
|
typedef struct PGOnConflictClause {
|
1047
1047
|
PGNodeTag type;
|
1048
|
-
PGOnConflictAction action;
|
1049
|
-
PGInferClause *infer;
|
1050
|
-
PGList *targetList;
|
1051
|
-
PGNode *whereClause;
|
1052
|
-
int location;
|
1048
|
+
PGOnConflictAction action; /* DO NOTHING or UPDATE? */
|
1049
|
+
PGInferClause *infer; /* Optional index inference clause */
|
1050
|
+
PGList *targetList; /* the target list (of PGResTarget) */
|
1051
|
+
PGNode *whereClause; /* qualifications */
|
1052
|
+
int location; /* token location, or -1 if unknown */
|
1053
1053
|
} PGOnConflictClause;
|
1054
1054
|
|
1055
1055
|
/*
|
@@ -1125,14 +1125,15 @@ typedef struct PGRawStmt {
|
|
1125
1125
|
*/
|
1126
1126
|
typedef struct PGInsertStmt {
|
1127
1127
|
PGNodeTag type;
|
1128
|
-
PGRangeVar *relation;
|
1129
|
-
PGList *cols;
|
1130
|
-
PGNode *selectStmt;
|
1128
|
+
PGRangeVar *relation; /* relation to insert into */
|
1129
|
+
PGList *cols; /* optional: names of the target columns */
|
1130
|
+
PGNode *selectStmt; /* the source SELECT/VALUES, or NULL */
|
1131
1131
|
PGOnConflictActionAlias onConflictAlias; /* the (optional) shorthand provided for the onConflictClause */
|
1132
|
-
PGOnConflictClause *onConflictClause;
|
1133
|
-
PGList *returningList;
|
1134
|
-
PGWithClause *withClause;
|
1135
|
-
PGOverridingKind override;
|
1132
|
+
PGOnConflictClause *onConflictClause; /* ON CONFLICT clause */
|
1133
|
+
PGList *returningList; /* list of expressions to return */
|
1134
|
+
PGWithClause *withClause; /* WITH clause */
|
1135
|
+
PGOverridingKind override; /* OVERRIDING clause */
|
1136
|
+
PGInsertColumnOrder insert_column_order; /* INSERT BY NAME or INSERT BY POSITION */
|
1136
1137
|
} PGInsertStmt;
|
1137
1138
|
|
1138
1139
|
/* ----------------------
|
@@ -1065,9 +1065,10 @@ typedef union YYSTYPE
|
|
1065
1065
|
PGLockWaitPolicy lockwaitpolicy;
|
1066
1066
|
PGSubLinkType subquerytype;
|
1067
1067
|
PGViewCheckOption viewcheckoption;
|
1068
|
+
PGInsertColumnOrder bynameorposition;
|
1068
1069
|
}
|
1069
1070
|
/* Line 1529 of yacc.c. */
|
1070
|
-
#line
|
1071
|
+
#line 1072 "third_party/libpg_query/grammar/grammar_out.hpp"
|
1071
1072
|
YYSTYPE;
|
1072
1073
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
1073
1074
|
# define YYSTYPE_IS_DECLARED 1
|