Skip to content

Commit

Permalink
MB-54804 Do not include SELF as recommended index key
Browse files Browse the repository at this point in the history
In Elixir SELF is no longer allowed as an index key (MB-51996).
To be consistent, we now also skip SELF as an index key in
recommended indexes from the index advisor.

When collecting index key information from predicates and others,
skip "self". Note only "self" is excluded, it does not exclude
other references to "self", such as "self[1]", "self[1:3]", etc.

Change-Id: I85bbed3f87c0f9e071b20fb6dda346d48fd8ff20
Reviewed-on: https://review.couchbase.org/c/query/+/183875
Tested-by: Sitaram Vemulapalli <sitaram.vemulapalli@couchbase.com>
Reviewed-by: Sitaram Vemulapalli <sitaram.vemulapalli@couchbase.com>
  • Loading branch information
miaobingjie committed Dec 8, 2022
1 parent 8d6ed31 commit 251bf59
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/gsi/test_cases/advise/case_advise_edgecase.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@
"recommended_indexes": {
"indexes": [
{
"index_statement": "CREATE INDEX adv_self ON `shellTest`(self)",
"index_statement": "CREATE INDEX adv_self13 ON `shellTest`(self[1 : 3] INCLUDE MISSING)",
"keyspace_alias": "shellTest_a",
"recommending_rule": "Index keys follow order of predicate types: 7. not null/not missing/valued."
"recommending_rule": "Leading index key INCLUDE MISSING."
}
]
}
Expand Down
8 changes: 4 additions & 4 deletions test/gsi/test_cases/advise/case_advise_lkmissing.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{
"index_statement": "CREATE INDEX adv_state ON `shellTest`(`state` INCLUDE MISSING)",
"keyspace_alias": "shellTest_l",
"recommending_rule": "Leading Index Key Missing."
"recommending_rule": "Leading index key INCLUDE MISSING."
}
]
}
Expand Down Expand Up @@ -91,7 +91,7 @@
{
"index_statement": "CREATE INDEX adv_city_state ON `shellTest`(`city` INCLUDE MISSING,`state`)",
"keyspace_alias": "shellTest_l",
"recommending_rule": "Leading Index Key Missing."
"recommending_rule": "Leading index key INCLUDE MISSING."
}
]
}
Expand Down Expand Up @@ -122,7 +122,7 @@
{
"index_statement": "CREATE INDEX adv_city_state ON `shellTest`(`city` INCLUDE MISSING,`state`)",
"keyspace_alias": "shellTest_l",
"recommending_rule": "Leading Index Key Missing."
"recommending_rule": "Leading index key INCLUDE MISSING."
}
]
}
Expand Down Expand Up @@ -151,7 +151,7 @@
{
"index_statement": "CREATE INDEX adv_city_state ON `shellTest`(`city` INCLUDE MISSING,`state`)",
"keyspace_alias": "shellTest_l",
"recommending_rule": "Leading Index Key Missing."
"recommending_rule": "Leading index key INCLUDE MISSING."
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions test/gsi/test_cases/advise/case_advise_select.json
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@
{
"index_statement": "CREATE INDEX adv_type ON `shellTest`(`type` INCLUDE MISSING)",
"keyspace_alias": "shellTest",
"recommending_rule": "Leading Index Key Missing."
"recommending_rule": "Leading index key INCLUDE MISSING."
}
]
}
Expand Down Expand Up @@ -657,7 +657,7 @@
{
"index_statement": "CREATE INDEX adv_type ON `shellTest`(`type` INCLUDE MISSING)",
"keyspace_alias": "shellTest",
"recommending_rule": "Leading Index Key Missing."
"recommending_rule": "Leading index key INCLUDE MISSING."
}
]
}
Expand Down

0 comments on commit 251bf59

Please sign in to comment.