Skip to content

Commit 6bb5fa1

Browse files
Update vendored DuckDB sources to 6a77b40
1 parent 6a77b40 commit 6bb5fa1

File tree

22 files changed

+16426
-16182
lines changed

22 files changed

+16426
-16182
lines changed

src/duckdb/src/common/enum_util.cpp

+38
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
#include "duckdb/common/types/vector.hpp"
8484
#include "duckdb/common/types/vector_buffer.hpp"
8585
#include "duckdb/execution/index/art/art.hpp"
86+
#include "duckdb/execution/index/art/art_scanner.hpp"
8687
#include "duckdb/execution/index/art/node.hpp"
8788
#include "duckdb/execution/index/bound_index.hpp"
8889
#include "duckdb/execution/operator/csv_scanner/csv_option.hpp"
@@ -172,6 +173,43 @@ ARTConflictType EnumUtil::FromString<ARTConflictType>(const char *value) {
172173
return static_cast<ARTConflictType>(StringUtil::StringToEnum(GetARTConflictTypeValues(), 3, "ARTConflictType", value));
173174
}
174175

176+
const StringUtil::EnumStringLiteral *GetARTScanHandlingModeValues() {
177+
static constexpr StringUtil::EnumStringLiteral values[] {
178+
{ static_cast<uint32_t>(ARTScanHandlingMode::EMPLACE), "EMPLACE" },
179+
{ static_cast<uint32_t>(ARTScanHandlingMode::POP), "POP" }
180+
};
181+
return values;
182+
}
183+
184+
template<>
185+
const char* EnumUtil::ToChars<ARTScanHandlingMode>(ARTScanHandlingMode value) {
186+
return StringUtil::EnumToString(GetARTScanHandlingModeValues(), 2, "ARTScanHandlingMode", static_cast<uint32_t>(value));
187+
}
188+
189+
template<>
190+
ARTScanHandlingMode EnumUtil::FromString<ARTScanHandlingMode>(const char *value) {
191+
return static_cast<ARTScanHandlingMode>(StringUtil::StringToEnum(GetARTScanHandlingModeValues(), 2, "ARTScanHandlingMode", value));
192+
}
193+
194+
const StringUtil::EnumStringLiteral *GetARTScanResultValues() {
195+
static constexpr StringUtil::EnumStringLiteral values[] {
196+
{ static_cast<uint32_t>(ARTScanResult::CONTINUE), "CONTINUE" },
197+
{ static_cast<uint32_t>(ARTScanResult::SKIP), "SKIP" },
198+
{ static_cast<uint32_t>(ARTScanResult::YIELD), "YIELD" }
199+
};
200+
return values;
201+
}
202+
203+
template<>
204+
const char* EnumUtil::ToChars<ARTScanResult>(ARTScanResult value) {
205+
return StringUtil::EnumToString(GetARTScanResultValues(), 3, "ARTScanResult", static_cast<uint32_t>(value));
206+
}
207+
208+
template<>
209+
ARTScanResult EnumUtil::FromString<ARTScanResult>(const char *value) {
210+
return static_cast<ARTScanResult>(StringUtil::StringToEnum(GetARTScanResultValues(), 3, "ARTScanResult", value));
211+
}
212+
175213
const StringUtil::EnumStringLiteral *GetAccessModeValues() {
176214
static constexpr StringUtil::EnumStringLiteral values[] {
177215
{ static_cast<uint32_t>(AccessMode::UNDEFINED), "UNDEFINED" },

src/duckdb/src/execution/index/art/node.cpp

+52-66
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "duckdb/execution/index/art/base_leaf.hpp"
88
#include "duckdb/execution/index/art/base_node.hpp"
99
#include "duckdb/execution/index/art/iterator.hpp"
10+
#include "duckdb/execution/index/art/art_scanner.hpp"
1011
#include "duckdb/execution/index/art/leaf.hpp"
1112
#include "duckdb/execution/index/art/node256.hpp"
1213
#include "duckdb/execution/index/art/node256_leaf.hpp"
@@ -362,35 +363,23 @@ bool Node::IsAnyLeaf() const {
362363

363364
void Node::InitMerge(ART &art, const unsafe_vector<idx_t> &upper_bounds) {
364365
D_ASSERT(HasMetadata());
365-
auto type = GetType();
366+
ARTScanner<ARTScanHandlingMode::POP> scanner(art);
366367

367-
switch (type) {
368-
case NType::PREFIX:
369-
return Prefix::InitializeMerge(art, *this, upper_bounds);
370-
case NType::LEAF:
371-
throw InternalException("Failed to initialize merge due to deprecated ART storage.");
372-
case NType::NODE_4:
373-
InitMergeInternal(art, Ref<Node4>(art, *this, type), upper_bounds);
374-
break;
375-
case NType::NODE_16:
376-
InitMergeInternal(art, Ref<Node16>(art, *this, type), upper_bounds);
377-
break;
378-
case NType::NODE_48:
379-
InitMergeInternal(art, Ref<Node48>(art, *this, type), upper_bounds);
380-
break;
381-
case NType::NODE_256:
382-
InitMergeInternal(art, Ref<Node256>(art, *this, type), upper_bounds);
383-
break;
384-
case NType::LEAF_INLINED:
385-
return;
386-
case NType::NODE_7_LEAF:
387-
case NType::NODE_15_LEAF:
388-
case NType::NODE_256_LEAF:
389-
break;
390-
}
368+
auto handler = [&upper_bounds](Node &node) {
369+
auto type = node.GetType();
370+
if (node.GetType() == NType::LEAF_INLINED) {
371+
return ARTScanResult::CONTINUE;
372+
}
373+
if (type == NType::LEAF) {
374+
throw InternalException("deprecated ART storage in InitMerge");
375+
}
376+
auto idx = GetAllocatorIdx(type);
377+
node.IncreaseBufferId(upper_bounds[idx]);
378+
return ARTScanResult::CONTINUE;
379+
};
391380

392-
auto idx = GetAllocatorIdx(type);
393-
IncreaseBufferId(upper_bounds[idx]);
381+
scanner.Init(handler, *this);
382+
scanner.Scan(handler);
394383
}
395384

396385
bool Node::MergeNormalNodes(ART &art, Node &l_node, Node &r_node, uint8_t &byte, const GateStatus status) {
@@ -597,48 +586,45 @@ bool Node::MergeInternal(ART &art, Node &other, const GateStatus status) {
597586

598587
void Node::Vacuum(ART &art, const unordered_set<uint8_t> &indexes) {
599588
D_ASSERT(HasMetadata());
600-
601-
auto type = GetType();
602-
switch (type) {
603-
case NType::LEAF_INLINED:
604-
return;
605-
case NType::PREFIX:
606-
return Prefix::Vacuum(art, *this, indexes);
607-
case NType::LEAF:
608-
if (indexes.find(GetAllocatorIdx(type)) == indexes.end()) {
609-
return;
589+
ARTScanner<ARTScanHandlingMode::EMPLACE> scanner(art);
590+
591+
auto handler = [&art, &indexes](Node &node) {
592+
ARTScanResult result;
593+
auto type = node.GetType();
594+
switch (type) {
595+
case NType::LEAF_INLINED:
596+
return ARTScanResult::SKIP;
597+
case NType::LEAF: {
598+
if (indexes.find(GetAllocatorIdx(type)) == indexes.end()) {
599+
return ARTScanResult::SKIP;
600+
}
601+
Leaf::DeprecatedVacuum(art, node);
602+
return ARTScanResult::SKIP;
603+
}
604+
case NType::NODE_7_LEAF:
605+
case NType::NODE_15_LEAF:
606+
case NType::NODE_256_LEAF:
607+
result = ARTScanResult::SKIP;
608+
break;
609+
default:
610+
result = ARTScanResult::CONTINUE;
611+
break;
610612
}
611-
return Leaf::DeprecatedVacuum(art, *this);
612-
default:
613-
break;
614-
}
615613

616-
auto idx = GetAllocatorIdx(type);
617-
auto &allocator = GetAllocator(art, type);
618-
auto needs_vacuum = indexes.find(idx) != indexes.end() && allocator.NeedsVacuum(*this);
619-
if (needs_vacuum) {
620-
auto status = GetGateStatus();
621-
*this = allocator.VacuumPointer(*this);
622-
SetMetadata(static_cast<uint8_t>(type));
623-
SetGateStatus(status);
624-
}
614+
auto idx = GetAllocatorIdx(type);
615+
auto &allocator = GetAllocator(art, type);
616+
auto needs_vacuum = indexes.find(idx) != indexes.end() && allocator.NeedsVacuum(node);
617+
if (needs_vacuum) {
618+
auto status = node.GetGateStatus();
619+
node = allocator.VacuumPointer(node);
620+
node.SetMetadata(static_cast<uint8_t>(type));
621+
node.SetGateStatus(status);
622+
}
623+
return result;
624+
};
625625

626-
switch (type) {
627-
case NType::NODE_4:
628-
return VacuumInternal(art, Ref<Node4>(art, *this, type), indexes);
629-
case NType::NODE_16:
630-
return VacuumInternal(art, Ref<Node16>(art, *this, type), indexes);
631-
case NType::NODE_48:
632-
return VacuumInternal(art, Ref<Node48>(art, *this, type), indexes);
633-
case NType::NODE_256:
634-
return VacuumInternal(art, Ref<Node256>(art, *this, type), indexes);
635-
case NType::NODE_7_LEAF:
636-
case NType::NODE_15_LEAF:
637-
case NType::NODE_256_LEAF:
638-
return;
639-
default:
640-
throw InternalException("Invalid node type for Vacuum: %s.", EnumUtil::ToString(type));
641-
}
626+
scanner.Init(handler, *this);
627+
scanner.Scan(handler);
642628
}
643629

644630
//===--------------------------------------------------------------------===//

src/duckdb/src/execution/index/art/prefix.cpp

-36
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,6 @@ void Prefix::Free(ART &art, Node &node) {
9999
node.Clear();
100100
}
101101

102-
void Prefix::InitializeMerge(ART &art, Node &node, const unsafe_vector<idx_t> &upper_bounds) {
103-
auto buffer_count = upper_bounds[Node::GetAllocatorIdx(PREFIX)];
104-
Node next = node;
105-
Prefix prefix(art, next, true);
106-
107-
while (next.GetType() == PREFIX) {
108-
next = *prefix.ptr;
109-
if (prefix.ptr->GetType() == PREFIX) {
110-
prefix.ptr->IncreaseBufferId(buffer_count);
111-
prefix = Prefix(art, next, true);
112-
}
113-
}
114-
115-
node.IncreaseBufferId(buffer_count);
116-
prefix.ptr->InitMerge(art, upper_bounds);
117-
}
118-
119102
void Prefix::Concat(ART &art, Node &parent, uint8_t byte, const GateStatus old_status, const Node &child,
120103
const GateStatus status) {
121104
D_ASSERT(!parent.IsAnyLeaf());
@@ -366,25 +349,6 @@ void Prefix::VerifyAllocations(ART &art, const Node &node, unordered_map<uint8_t
366349
return ref.get().VerifyAllocations(art, node_counts);
367350
}
368351

369-
void Prefix::Vacuum(ART &art, Node &node, const unordered_set<uint8_t> &indexes) {
370-
bool set = indexes.find(Node::GetAllocatorIdx(PREFIX)) != indexes.end();
371-
auto &allocator = Node::GetAllocator(art, PREFIX);
372-
373-
reference<Node> ref(node);
374-
while (ref.get().GetType() == PREFIX) {
375-
if (set && allocator.NeedsVacuum(ref)) {
376-
auto status = ref.get().GetGateStatus();
377-
ref.get() = allocator.VacuumPointer(ref);
378-
ref.get().SetMetadata(static_cast<uint8_t>(PREFIX));
379-
ref.get().SetGateStatus(status);
380-
}
381-
Prefix prefix(art, ref, true);
382-
ref = *prefix.ptr;
383-
}
384-
385-
ref.get().Vacuum(art, indexes);
386-
}
387-
388352
void Prefix::TransformToDeprecated(ART &art, Node &node, unsafe_unique_ptr<FixedSizeAllocator> &allocator) {
389353
// Early-out, if we do not need any transformations.
390354
if (!allocator) {

src/duckdb/src/execution/operator/helper/physical_create_secret.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SourceResultType PhysicalCreateSecret::GetData(ExecutionContext &context, DataCh
1010
auto &client = context.client;
1111
auto &secret_manager = SecretManager::Get(client);
1212

13-
secret_manager.CreateSecret(client, info);
13+
secret_manager.CreateSecret(client, create_input);
1414

1515
chunk.SetValue(0, 0, true);
1616
chunk.SetCardinality(1);

src/duckdb/src/execution/physical_plan/plan_create_secret.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace duckdb {
66

77
PhysicalOperator &PhysicalPlanGenerator::CreatePlan(LogicalCreateSecret &op) {
8-
return Make<PhysicalCreateSecret>(op.info, op.estimated_cardinality);
8+
return Make<PhysicalCreateSecret>(op.secret_input, op.estimated_cardinality);
99
}
1010

1111
} // namespace duckdb

src/duckdb/src/function/table/version/pragma_version.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef DUCKDB_PATCH_VERSION
2-
#define DUCKDB_PATCH_VERSION "0-dev1943"
2+
#define DUCKDB_PATCH_VERSION "0-dev1976"
33
#endif
44
#ifndef DUCKDB_MINOR_VERSION
55
#define DUCKDB_MINOR_VERSION 3
@@ -8,10 +8,10 @@
88
#define DUCKDB_MAJOR_VERSION 1
99
#endif
1010
#ifndef DUCKDB_VERSION
11-
#define DUCKDB_VERSION "v1.3.0-dev1943"
11+
#define DUCKDB_VERSION "v1.3.0-dev1976"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "ca91dfd833"
14+
#define DUCKDB_SOURCE_ID "9293db6aef"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

src/duckdb/src/include/duckdb/common/enum_util.hpp

+16
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ struct EnumUtil {
3434

3535
enum class ARTConflictType : uint8_t;
3636

37+
enum class ARTScanHandlingMode : uint8_t;
38+
39+
enum class ARTScanResult : uint8_t;
40+
3741
enum class AccessMode : uint8_t;
3842

3943
enum class AggregateCombineType : uint8_t;
@@ -398,6 +402,12 @@ enum class WindowExcludeMode : uint8_t;
398402
template<>
399403
const char* EnumUtil::ToChars<ARTConflictType>(ARTConflictType value);
400404

405+
template<>
406+
const char* EnumUtil::ToChars<ARTScanHandlingMode>(ARTScanHandlingMode value);
407+
408+
template<>
409+
const char* EnumUtil::ToChars<ARTScanResult>(ARTScanResult value);
410+
401411
template<>
402412
const char* EnumUtil::ToChars<AccessMode>(AccessMode value);
403413

@@ -942,6 +952,12 @@ const char* EnumUtil::ToChars<WindowExcludeMode>(WindowExcludeMode value);
942952
template<>
943953
ARTConflictType EnumUtil::FromString<ARTConflictType>(const char *value);
944954

955+
template<>
956+
ARTScanHandlingMode EnumUtil::FromString<ARTScanHandlingMode>(const char *value);
957+
958+
template<>
959+
ARTScanResult EnumUtil::FromString<ARTScanResult>(const char *value);
960+
945961
template<>
946962
AccessMode EnumUtil::FromString<AccessMode>(const char *value);
947963

0 commit comments

Comments
 (0)