8000 ZKD Indexes by maierlars · Pull Request #13650 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

ZKD Indexes #13650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 50 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c19d549
Bootstrap zkd indexes. Now fill in the details.
Mar 3, 2021
60d6ceb
Added prototype for condition finder.
Mar 4, 2021
63fd0b7
Added helper for Range.
Mar 4, 2021
a43cf14
Fixed double conversion.
Mar 4, 2021
9305dbc
Added wrong but working nextImpl
Mar 5, 2021
14ba135
Extract bounds for iterator.
Mar 5, 2021
3d7d5fc
Fixed extraction logic with reversed operator usage.
Mar 5, 2021
db52b6d
Detect equal operator correctly.
Mar 5, 2021
ede46db
Implemented nextImpl
goedderz Mar 5, 2021
5c78b96
Removed log devel for hot path.
Mar 5, 2021
0b73dcf
Cleanup
goedderz Mar 5, 2021
4fb378c
Added support for partially unbounded queries.
Mar 5, 2021
6948eb6
Do not use index for full collection scans.
Mar 5, 2021
34117f4
Merge branch 'feature/zkd-index' of github.com:arangodb/arangodb into…
Mar 5, 2021
59fd78e
Added tests for ZkdHelper.
Mar 8, 2021
db392e3
Added functional test suite skeleton for zkd index
goedderz Mar 8, 2021
811e660
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Mar 8, 2021
91f5651
Some fixes to double conversions
goedderz Mar 8, 2021
5be1cd2
Fixed bug in double to byte_string conversion.
Mar 8, 2021
34c4324
Added support for denormalized doubles and infinity.
Mar 9, 2021
e2977ff
Test all interesting double values.
Mar 9, 2021
c9042d2
Disallow Nan.
Mar 9, 2021
dd3b8f2
Added more js tests.
Mar 9, 2021
7b879dc
Added a lot of tests.
Mar 9, 2021
6fcf4d1
Cleaned up test.
Mar 9, 2021
5697c52
[zkd] Strict comparsion (#13673)
Mar 10, 2021
1d3522d
[zkd] Cluster support (#13677)
Mar 11, 2021
94dd02e
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Mar 11, 2021
3d1ce4b
Added support for nested fields - excluding expansions. (#13681)
Mar 11, 2021
7618470
[zkd] Unique Constraints (#13691)
Mar 12, 2021
1d4928b
[zkd] Forward Compat (#13694)
Mar 15, 2021
8cabd6f
[zkd] Column Family (#13692)
Mar 15, 2021
bbf25b4
Added zkd index docu block. (#13698)
Mar 15, 2021
caa87ae
Fixed bug in RocksDBKeyBounds and using default cost estimation
Mar 16, 2021
6c6a34e
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Mar 22, 2021
b81f948
[zkd] testInBox speedup (#13798)
Mar 24, 2021
aaddb71
Feature/zkd index speedup getnextzvalue (#13799)
goedderz Mar 25, 2021
10ed61a
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
May 25, 2021
5a1adc3
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
May 26, 2021
584f524
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Jul 1, 2021
d650d3f
Updated CHANGELOG.
Jul 1, 2021
265ed5c
Merge branch 'devel' of github.com:arangodb/arangodb into feature/zkd…
goedderz Jul 6, 2021
3c73e3d
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Jul 15, 2021
41ea5e2
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Aug 5, 2021
fa7d8b0
Fixing iterator.
Aug 6, 2021
5f83c9f
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Aug 12, 2021
dd48bf9
Added review suggestions.
Aug 20, 2021
a55c4c6
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Sep 9, 2021
60473c5
Applied suggestions from review.
Sep 9, 2021
a185712
Merge branch 'devel' into feature/zkd-index
mchacki Sep 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added support for nested fields - excluding expansions. (#13681)
* Added support for nested fields - excluding expansions.

* Added tests for nested attributes.
  • Loading branch information
Lars Maier authored Mar 11, 2021
commit 3d1ce4b25db3b31d6408f01f80ac6224e6ec9210
2 changes: 1 addition & 1 deletion arangod/Indexes/IndexFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Result IndexFactory::emplace(std::string const& type, IndexTypeFactory const& fa
return arangodb::Result();
}

Result IndexFactory::enhanceIndexDefinition( // normalizze deefinition
Result IndexFactory::enhanceIndexDefinition( // normalize definition
velocypack::Slice const definition, // source definition
velocypack::Builder& normalized, // normalized definition (out-param)
bool isCreation, // definition for index creation
Expand Down
68 changes: 35 additions & 33 deletions arangod/RocksDBEngine/RocksDBZkdIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,31 @@ auto nodeExtractDouble(aql::AstNode const* node) -> std::optional<zkd::byte_stri
return std::nullopt;
}

auto accessDocumentPath(VPackSlice doc, std::vector<basics::AttributeName> const& path) -> VPackSlice {
for (auto&& attrib : path) {
TRI_ASSERT(attrib.shouldExpand == false);
if (!doc.isObject()) {
return VPackSlice::noneSlice();
}

doc = doc.get(attrib.name);
}

return doc;
}

auto readDocumentKey(VPackSlice doc,
std::vector<std::vector<basics::AttributeName>> const& fields)
-> zkd::byte_string {
std::vector<zkd::byte_string> v;
v.reserve(fields.size());

for (auto const& path : fields) {
TRI_ASSERT(path.size() == 1);
TRI_ASSERT(path[0].shouldExpand == false);
VPackSlice value = doc.get(path[0].name);
VPackSlice value = accessDocumentPath(doc, path);
if (!value.isNumber<double>()) {
THROW_ARANGO_EXCEPTION(TRI_ERROR_QUERY_INVALID_ARITHMETIC_VALUE);
}
double dv = value.getNumericValue<double>();
auto dv = value.getNumericValue<double>();
if (std::isnan(dv)) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_BAD_PARAMETER, "NaN is not allowed");
}
Expand Down Expand Up @@ -238,39 +249,30 @@ void zkd::extractBoundsFromCondition(
return false;
}

auto& path = attributeData.second;
// TODO -- make this more generic
TRI_ASSERT(path.size() == 1 && !path[0].shouldExpand);

auto& name = path[0].name;
for (auto&& [idx, field] : enumerate(index->fields())) {
TRI_ASSERT(field.size() == 1);

if (name != field[0].name) {
if (attributeData.second != field) {
continue;
}

if (name == field[0].name) {
switch (op->type) {
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_EQ:
useAsBound(idx, op, access, other, true, false);
useAsB 8000 ound(idx, op, access, other, false, false);
return true;
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_LE:
useAsBound(idx, op, access, other, reverse, false);
return true;
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_GE:
useAsBound(idx, op, access, other, !reverse, false);
return true;
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_LT:
useAsBound(idx, op, access, other, reverse, true);
return true;
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_GT:
useAsBound(idx, op, access, other, !reverse, true);
return true;
default:
break;
}
switch (op->type) {
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_EQ:
useAsBound(idx, op, access, other, true, false);
useAsBound(idx, op, access, other, false, false);
return true;
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_LE:
useAsBound(idx, op, access, other, reverse, false);
return true;
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_GE:
useAsBound(idx, op, access, other, !reverse, false);
return true;
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_LT:
useAsBound(idx, op, access, other, reverse, true);
return true;
case arangodb::aql::NODE_TYPE_OPERATOR_BINARY_GT:
useAsBound(idx, op, access, other, !reverse, true);
return true;
default:
break;
}
}

Expand Down
10 changes: 0 additions & 10 deletions tests/Zkd/Conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,6 @@ TEST(Zkd_byte_string_conversion, int64_compare) {
}
}

TEST(Zkd_byte_string_conversion, double_float) {
auto tests = {std::pair{0.0, byte_string{0b10111111_b, 0b11110000_b, 0_b, 0_b,
0_b, 0_b, 0_b, 0_b}}};

for (auto&& [v, bs] : tests) {
auto result = to_byte_string_fixed_length(v);
EXPECT_EQ(result, bs);
}
}

auto const doubles_worth_testing = {0.0,
0.1,
0.2,
Expand Down
8 changes: 4 additions & 4 deletions tests/js/server/aql/aql-optimizer-zkdindex-multi.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ function optimizerRuleZkd2dIndexTestSuite() {
let testObject = {
setUpAll: function () {
col = db._create(colName);
col.ensureIndex({type: 'zkd', name: 'zkdIndex', fields: ['x', 'y', 'z', 'w']});
col.ensureIndex({type: 'zkd', name: 'zkdIndex', fields: ['x', 'y', 'z', 'a.w']});
db._query(aql`
FOR x IN 0..10
FOR y IN 0..10
FOR z IN 0..10
FOR w IN 0..10
INSERT {x, y, z, w} INTO ${col}
INSERT {x, y, z, a: {w}} INTO ${col}
`);
},

Expand All @@ -131,8 +131,8 @@ function optimizerRuleZkd2dIndexTestSuite() {
FILTER ${conditionForVariable(x, "d.x")}
FILTER ${conditionForVariable(y, "d.y")}
FILTER ${conditionForVariable(z, "d.z")}
FILTER ${conditionForVariable(w, "d.w")}
RETURN [d.x, d.y, d.z, d.w]
FILTER ${conditionForVariable(w, "d.a.w")}
RETURN [d.x, d.y, d.z, d.a.w]
`;
const explainRes = AQL_EXPLAIN(query);
const appliedRules = explainRes.plan.rules;
Expand Down
0