Description
Repro:
1.Create Index
create index index_agg on default(Year, Month, Sale)
2.Explain select meta().id from default WHERE
(Year = "2016" and Month = 1 )
OR
(Year = "2017" and Month >= 2 and Month <= 3)
This generates four spans. Explain output is -
[
|
{
|
"plan": {
|
"#operator": "Sequence",
|
"~children": [
|
{
|
"#operator": "DistinctScan",
|
"scan": {
|
"#operator": "IndexScan2",
|
"covers": [
|
"cover ((`default`.`Year`))",
|
"cover ((`default`.`Month`))",
|
"cover ((`default`.`Sale`))",
|
"cover ((meta(`default`).`id`))"
|
],
|
"index": "index_agg",
|
"index_id": "e19a9ebeed1c721c",
|
"index_projection": {
|
"entry_keys": [
|
0,
|
1
|
],
|
"primary_key": true
|
},
|
"keyspace": "default",
|
"namespace": "default",
|
"spans": [
|
{
|
"exact": true,
|
"range": [
|
{
|
"high": "\"2016\"",
|
"inclusion": 3,
|
"low": "\"2016\""
|
},
|
{
|
"high": "1",
|
"inclusion": 3,
|
"low": "1"
|
}
|
]
|
},
|
{
|
"exact": true,
|
"range": [
|
{
|
"high": "\"2016\"",
|
"inclusion": 3,
|
"low": "\"2016\""
|
},
|
{
|
"high": "3",
|
"inclusion": 3,
|
"low": "2"
|
}
|
]
|
},
|
{
|
"exact": true,
|
"range": [
|
{
|
"high": "\"2017\"",
|
"inclusion": 3,
|
"low": "\"2017\""
|
},
|
{
|
"high": "1",
|
"inclusion": 3,
|
"low": "1"
|
}
|
]
|
},
|
{
|
"exact": true,
|
"range": [
|
{
|
"high": "\"2017\"",
|
"inclusion": 3,
|
"low": "\"2017\""
|
},
|
{
|
"high": "3",
|
"inclusion": 3,
|
"low": "2"
|
}
|
]
|
}
|
],
|
"using": "gsi"
|
}
|
},
|
{
|
"#operator": "Parallel",
|
"~child": {
|
"#operator": "Sequence",
|
"~children": [
|
{
|
"#operator": "Filter",
|
"condition": "(((cover ((`default`.`Year`)) = \"2016\") and (cover ((`default`.`Month`)) = 1)) or (((cover ((`default`.`Year`)) = \"2017\") and (2 <= cover ((`default`.`Month`)))) and (cover ((`default`.`Month`)) <= 3)))"
|
},
|
{
|
"#operator": "InitialProject",
|
"result_terms": [
|
{
|
"expr": "cover ((meta(`default`).`id`))"
|
}
|
]
|
},
|
{
|
"#operator": "FinalProject"
|
}
|
]
|
}
|
}
|
]
|
},
|
"text": "select meta().id from default WHERE \n(Year = \"2016\" and Month = 1 )\nOR\n(Year = \"2017\" and Month >= 2 and Month <= 3)"
|
}
|
]
|
I am on latest vulcan manifest, with query sha at -
commit cae52fa97d2ba85296381f05c7fe925140552e40
Author: miaobingjie <bingjie.miao@couchbase.com>
Date: Tue Nov 21 20:28:50 2017 -0700
MB-25757 Add ability to push ON-clause filters from inner joins to left-hand-side keyspace
I haven't tried testing on older builds and I am not sure if this is a regression or not.
Please confirm my understanding that two spans should be generated for this query. Additional spans are causing indexer to return more rows to N1QL. Final result is correct anyway.
Attachments
Issue Links
- duplicates
-
MB-26946 [Explain Plan] test_count_distinct fails
- Closed