duckdb 0.5.2-dev618.0 → 0.5.2-dev630.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.cpp +32 -30
- package/src/duckdb.hpp +2 -2
- package/src/parquet-amalgamation.cpp +36601 -36601
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -2214,6 +2214,8 @@ private:
|
|
|
2214
2214
|
bool Next();
|
|
2215
2215
|
//! Push part of the key to cur_key
|
|
2216
2216
|
void PushKey(Node *node, uint16_t pos);
|
|
2217
|
+
//! Pop node
|
|
2218
|
+
void PopNode();
|
|
2217
2219
|
};
|
|
2218
2220
|
} // namespace duckdb
|
|
2219
2221
|
|
|
@@ -59319,14 +59321,19 @@ bool Iterator::Scan(Key *bound, idx_t max_count, vector<row_t> &result_ids, bool
|
|
|
59319
59321
|
return true;
|
|
59320
59322
|
}
|
|
59321
59323
|
|
|
59324
|
+
void Iterator::PopNode() {
|
|
59325
|
+
auto cur_node = nodes.top();
|
|
59326
|
+
idx_t elements_to_pop = cur_node.node->prefix.Size() + (nodes.size() != 1);
|
|
59327
|
+
cur_key.Pop(elements_to_pop);
|
|
59328
|
+
nodes.pop();
|
|
59329
|
+
}
|
|
59330
|
+
|
|
59322
59331
|
bool Iterator::Next() {
|
|
59323
59332
|
if (!nodes.empty()) {
|
|
59324
59333
|
auto cur_node = nodes.top().node;
|
|
59325
59334
|
if (cur_node->type == NodeType::NLeaf) {
|
|
59326
59335
|
// Pop Leaf (We must pop the prefix size + the key to the node (unless we are popping the root)
|
|
59327
|
-
|
|
59328
|
-
cur_key.Pop(elements_to_pop);
|
|
59329
|
-
nodes.pop();
|
|
59336
|
+
PopNode();
|
|
59330
59337
|
}
|
|
59331
59338
|
}
|
|
59332
59339
|
|
|
@@ -59354,17 +59361,14 @@ bool Iterator::Next() {
|
|
|
59354
59361
|
nodes.push(IteratorEntry(next_node, DConstants::INVALID_INDEX));
|
|
59355
59362
|
} else {
|
|
59356
59363
|
// no node found: move up the tree and Pop prefix and key of current node
|
|
59357
|
-
|
|
59358
|
-
idx_t elements_to_pop = cur_node->prefix.Size() + (nodes.size() != 1);
|
|
59359
|
-
cur_key.Pop(elements_to_pop);
|
|
59360
|
-
nodes.pop();
|
|
59364
|
+
PopNode();
|
|
59361
59365
|
}
|
|
59362
59366
|
}
|
|
59363
59367
|
return false;
|
|
59364
59368
|
}
|
|
59365
59369
|
|
|
59366
59370
|
bool Iterator::LowerBound(Node *node, Key &key, bool inclusive) {
|
|
59367
|
-
bool equal =
|
|
59371
|
+
bool equal = true;
|
|
59368
59372
|
if (!node) {
|
|
59369
59373
|
return false;
|
|
59370
59374
|
}
|
|
@@ -59376,6 +59380,7 @@ bool Iterator::LowerBound(Node *node, Key &key, bool inclusive) {
|
|
|
59376
59380
|
for (idx_t i = 0; i < top.node->prefix.Size(); i++) {
|
|
59377
59381
|
cur_key.Push(top.node->prefix[i]);
|
|
59378
59382
|
}
|
|
59383
|
+
// greater case: find leftmost leaf node directly
|
|
59379
59384
|
if (!equal) {
|
|
59380
59385
|
while (node->type != NodeType::NLeaf) {
|
|
59381
59386
|
auto min_pos = node->GetMin();
|
|
@@ -59408,28 +59413,21 @@ bool Iterator::LowerBound(Node *node, Key &key, bool inclusive) {
|
|
|
59408
59413
|
if (cur_key > key) {
|
|
59409
59414
|
return true;
|
|
59410
59415
|
}
|
|
59411
|
-
//
|
|
59412
|
-
//
|
|
59413
|
-
|
|
59414
|
-
|
|
59415
|
-
|
|
59416
|
-
|
|
59417
|
-
|
|
59418
|
-
|
|
59419
|
-
return true;
|
|
59420
|
-
}
|
|
59421
|
-
} else if (cur_key > key) {
|
|
59422
|
-
// if it's not inclusive check if there is a next leaf
|
|
59423
|
-
return true;
|
|
59424
|
-
}
|
|
59425
|
-
}
|
|
59426
|
-
return false;
|
|
59416
|
+
// Case1: When the ART has only one leaf node, the Next() will return false
|
|
59417
|
+
// Case2: This means the previous node prefix(if any) + a_key(one element of of key array of previous node)
|
|
59418
|
+
// == key[q..=w].
|
|
59419
|
+
// But key[w+1..=z] maybe greater than leaf node prefix.
|
|
59420
|
+
// One fact is key[w] is alawys equal to a_key and the next element
|
|
59421
|
+
// of key array of previous node is always > a_key So we just call Next() once.
|
|
59422
|
+
|
|
59423
|
+
return Next();
|
|
59427
59424
|
}
|
|
59425
|
+
// equal case:
|
|
59428
59426
|
uint32_t mismatch_pos = node->prefix.KeyMismatchPosition(key, depth);
|
|
59429
59427
|
if (mismatch_pos != node->prefix.Size()) {
|
|
59430
59428
|
if (node->prefix[mismatch_pos] < key[depth + mismatch_pos]) {
|
|
59431
59429
|
// Less
|
|
59432
|
-
|
|
59430
|
+
PopNode();
|
|
59433
59431
|
return Next();
|
|
59434
59432
|
} else {
|
|
59435
59433
|
// Greater
|
|
@@ -59437,14 +59435,18 @@ bool Iterator::LowerBound(Node *node, Key &key, bool inclusive) {
|
|
|
59437
59435
|
return Next();
|
|
59438
59436
|
}
|
|
59439
59437
|
}
|
|
59438
|
+
|
|
59440
59439
|
// prefix matches, search inside the child for the key
|
|
59441
59440
|
depth += node->prefix.Size();
|
|
59442
59441
|
|
|
59443
59442
|
top.pos = node->GetChildGreaterEqual(key[depth], equal);
|
|
59443
|
+
// The maximum key byte of the current node is less than the key
|
|
59444
|
+
// So fall back to the previous node
|
|
59444
59445
|
if (top.pos == DConstants::INVALID_INDEX) {
|
|
59445
|
-
|
|
59446
|
-
|
|
59446
|
+
PopNode();
|
|
59447
|
+
return Next();
|
|
59447
59448
|
}
|
|
59449
|
+
PushKey(node, top.pos);
|
|
59448
59450
|
node = node->GetChild(*art, top.pos);
|
|
59449
59451
|
// This means all children of this node qualify as geq
|
|
59450
59452
|
depth++;
|
|
@@ -59979,7 +59981,7 @@ idx_t Node16::GetChildGreaterEqual(uint8_t k, bool &equal) {
|
|
|
59979
59981
|
return pos;
|
|
59980
59982
|
}
|
|
59981
59983
|
}
|
|
59982
|
-
return
|
|
59984
|
+
return DConstants::INVALID_INDEX;
|
|
59983
59985
|
}
|
|
59984
59986
|
|
|
59985
59987
|
idx_t Node16::GetMin() {
|
|
@@ -60220,7 +60222,7 @@ idx_t Node4::GetChildGreaterEqual(uint8_t k, bool &equal) {
|
|
|
60220
60222
|
return pos;
|
|
60221
60223
|
}
|
|
60222
60224
|
}
|
|
60223
|
-
return
|
|
60225
|
+
return DConstants::INVALID_INDEX;
|
|
60224
60226
|
}
|
|
60225
60227
|
|
|
60226
60228
|
idx_t Node4::GetMin() {
|
|
@@ -60355,7 +60357,7 @@ idx_t Node48::GetChildGreaterEqual(uint8_t k, bool &equal) {
|
|
|
60355
60357
|
return pos;
|
|
60356
60358
|
}
|
|
60357
60359
|
}
|
|
60358
|
-
return
|
|
60360
|
+
return DConstants::INVALID_INDEX;
|
|
60359
60361
|
}
|
|
60360
60362
|
|
|
60361
60363
|
idx_t Node48::GetMin() {
|
package/src/duckdb.hpp
CHANGED
|
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
13
|
#define DUCKDB_AMALGAMATION_EXTENDED 1
|
|
14
|
-
#define DUCKDB_SOURCE_ID "
|
|
15
|
-
#define DUCKDB_VERSION "v0.5.2-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "770dfea87"
|
|
15
|
+
#define DUCKDB_VERSION "v0.5.2-dev630"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|