Details
-
Bug
-
Resolution: Fixed
-
Major
-
5.0.0
-
5.0.0-2759
Test passes in 5.0.0-2703
-
Untriaged
-
Yes
Description
Test which fails:
./testrunner -i query1.ini -t tuqquery.tuq_2i_index.QueriesIndexTests.test_and_every_array_index -p array_indexing=True -p doc-per-day=1 |
Indexes created by test:
CREATE INDEX `rec1-1_record_by_index_map` ON default((distinct (array `i` for `i` in object_pairs(`indexMap`) end))) |
CREATE INDEX `rec1-2_record_by_index_map` ON default((distinct (array `i` for `i` in object_pairs(`data`) end))) |
CREATE INDEX `rec1-3_record_by_index_map` ON default((distinct (array `j` for `j` in object_pairs(`data`) end))) |
|
Explain query which fails:
explain SELECT r AS doc, meta(r).cas AS revision FROM default AS r WHERE any i in object_pairs(indexMap) satisfies i = |
{ "name":"key1", "value":"val1"} |
end AND any i in object_pairs(indexMap) satisfies i =
|
{ "name":"key2", "val":"val2"} |
end LIMIT 100 |
Assert which fails in 2759 but passes in 2703:
self.assertTrue(plan['~children'][0]['~children'][0]['scans'][0]['index']=='rec1-1_record_by_index_map') |
Plan with build 2703:
{
|
u'#operator':u'Sequence', |
u'~children':[ |
{
|
u'#operator':u'Sequence', |
u'~children':[ |
{
|
u'#operator':u'IntersectScan', |
*u'scans*':[ |
{
|
*u'index*':u'rec1-1_record_by_index_map', |
u'namespace':u'default', |
u'keyspace':u'default', |
u'#operator':u'IndexScan2', |
u'index_projection':{ |
u'primary_key':True |
},
|
u'spans':[ |
{
|
u'range':[ |
{
|
u'high':u' { |
"name":"key1", |
"value":"val1" |
} ', u' low':u' { |
"name":"key1", |
"value":"val1" |
} ', u' inclusion':3 |
}
|
],
|
u'exact':True |
}
|
],
|
u'using':u'gsi', |
u'index_id':u'82435f183dbda87' |
},
|
{
|
u'index':u'rec1-1_record_by_index_map', |
u'namespace':u'default', |
u'keyspace':u'default', |
u'#operator':u'IndexScan2', |
u'index_projection':{ |
u'primary_key':True |
},
|
u'spans':[ |
{
|
u'range':[ |
{
|
u'high':u' { |
"name":"key2", |
"val":"val2" |
} ', u' low':u' { |
"name":"key2", |
"val":"val2" |
} ', u' inclusion':3 |
}
|
],
|
u'exact':True |
}
|
],
|
u'using':u'gsi', |
u'index_id':u'82435f183dbda87' |
}
|
]
|
},
|
{
|
u'keyspace':u'default', |
u'#operator':u'Fetch', |
u'namespace':u'default', |
u'as':u'r' |
},
|
{
|
u'#operator':u'Parallel', |
u'~child':{ |
u'#operator':u'Sequence', |
u'~children':[ |
{
|
u'#operator':u'Filter', |
u'condition':u'(any `i` in object_pairs((`r`.`indexMap`)) satisfies (`i` = { |
"name":"key1", |
"value":"val1" |
} ) end and any `i` in object_pairs((`r`.`indexMap`)) satisfies (`i` = {
|
"name":"key2", |
"val":"val2" |
} ) end)'
|
},
|
{
|
u'#operator':u'InitialProject', |
u'result_terms':[ |
{
|
u'expr':u'`r`', |
u'as':u'doc' |
},
|
{
|
u'expr':u'(meta(`r`).`cas`)', |
u'as':u'revision' |
}
|
]
|
},
|
{
|
u'#operator':u'FinalProject' |
}
|
]
|
}
|
}
|
]
|
},
|
{
|
u'expr':u'100', |
u'#operator':u'Limit' |
}
|
]
|
}
|
|
Plan with 2759 build:
{
|
u'#operator':u'Sequence', |
u'~children':[ |
{
|
u'#operator':u'Sequence', |
u'~children':[ |
{
|
u'#operator':u'IntersectScan', |
*u'scans*':[ |
{
|
u'#operator':u'DistinctScan', |
*u'scan*':{ |
*u'index*':u'rec1-1_record_by_index_map', |
u'namespace':u'default', |
u'keyspace':u'default', |
u'#operator':u'IndexScan2', |
u'index_projection':{ |
u'primary_key':True |
},
|
u'spans':[ |
{
|
u'range':[ |
{
|
u'high':u' { |
"name":"key1", |
"value":"val1" |
} ', u' low':u' { |
"name":"key1", |
"value":"val1" |
} ', u' inclusion':3 |
}
|
],
|
u'exact':True |
}
|
],
|
u'using':u'gsi', |
u'index_id':u'4dd7fd9c07e606f6' |
}
|
},
|
{
|
u'#operator':u'DistinctScan', |
u'scan':{ |
u'index':u'rec1-1_record_by_index_map', |
u'namespace':u'default', |
u'keyspace':u'default', |
u'#operator':u'IndexScan2', |
u'index_projection':{ |
u'primary_key':True |
},
|
u'spans':[ |
{
|
u'range':[ |
{
|
u'high':u' { |
"name":"key2", |
"val":"val2" |
} ', u' low':u' { |
"name":"key2", |
"val":"val2" |
} ', u' inclusion':3 |
}
|
],
|
u'exact':True |
}
|
],
|
u'using':u'gsi', |
u'index_id':u'4dd7fd9c07e606f6' |
}
|
}
|
]
|
},
|
{
|
u'keyspace':u'default', |
u'#operator':u'Fetch', |
u'namespace':u'default', |
u'as':u'r' |
},
|
{
|
u'#operator':u'Parallel', |
u'~child':{ |
u'#operator':u'Sequence', |
u'~children':[ |
{
|
u'#operator':u'Filter', |
u'condition':u'(any `i` in object_pairs((`r`.`indexMap`)) satisfies (`i` = { |
"name":"key1", |
"value":"val1" |
} ) end and any `i` in object_pairs((`r`.`indexMap`)) satisfies (`i` = {
|
"name":"key2", |
"val":"val2" |
} ) end)'
|
},
|
{
|
u'#operator':u'InitialProject', |
u'result_terms':[ |
{
|
u'expr':u'`r`', |
u'as':u'doc' |
},
|
{
|
u'expr':u'(meta(`r`).`cas`)', |
u'as':u'revision' |
}
|
]
|
},
|
{
|
u'#operator':u'FinalProject' |
}
|
]
|
}
|
}
|
]
|
},
|
{
|
u'expr':u'100', |
u'#operator':u'Limit' |
}
|
]
|
}
|
|
Basically the assert needs to be changed to:
self.assertTrue(plan['~children'][0]['~children'][0]['scans'][0]['scan']['index']=='rec1-1_record_by_index_map')