mirror of https://gitee.com/bigwinds/arangodb
now work to a certain degree with binaray/naray-and in FILTER/SORT
condition
This commit is contained in:
parent
9b4e01eb3b
commit
5dcf61c9ba
|
@ -4052,8 +4052,7 @@ GeoIndexInfo geoDistanceFunctionArgCheck(std::pair<AstNode*,AstNode*> const& pai
|
||||||
|
|
||||||
bool applyGeoOptimization(bool near, ExecutionPlan* plan, GeoIndexInfo& info){
|
bool applyGeoOptimization(bool near, ExecutionPlan* plan, GeoIndexInfo& info){
|
||||||
|
|
||||||
// FIXME - this code should go to the candidate finding /////////////////////
|
// FIXME -- technical debt -- this code should go to the candidate finding /////////////////////
|
||||||
// get it running first
|
|
||||||
auto const& functionArguments = info.node->getMember(0);
|
auto const& functionArguments = info.node->getMember(0);
|
||||||
if(functionArguments->numMembers() < 4){
|
if(functionArguments->numMembers() < 4){
|
||||||
return false;
|
return false;
|
||||||
|
@ -4088,7 +4087,7 @@ bool applyGeoOptimization(bool near, ExecutionPlan* plan, GeoIndexInfo& info){
|
||||||
// << " are geoindexed";
|
// << " are geoindexed";
|
||||||
|
|
||||||
//break; //remove this to make use of the index
|
//break; //remove this to make use of the index
|
||||||
|
|
||||||
// FIXME - END //////////////////////////////////////////////////////////////
|
// FIXME - END //////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
std::unique_ptr<Condition> condition;
|
std::unique_ptr<Condition> condition;
|
||||||
|
@ -4250,7 +4249,7 @@ GeoIndexInfo identifyGeoOptimizationCandidate(ExecutionNode::NodeType type, Exec
|
||||||
if (setter == nullptr || setter->getType() != EN::CALCULATION) {
|
if (setter == nullptr || setter->getType() != EN::CALCULATION) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
//LOG_TOPIC(DEBUG, Logger::DEVEL) << "found setter node for calcuation";
|
LOG_TOPIC(DEBUG, Logger::DEVEL) << "found setter node for calcuation";
|
||||||
|
|
||||||
// downcast to calculation node and get expression
|
// downcast to calculation node and get expression
|
||||||
auto cn = static_cast<CalculationNode*>(setter);
|
auto cn = static_cast<CalculationNode*>(setter);
|
||||||
|
@ -4264,19 +4263,40 @@ GeoIndexInfo identifyGeoOptimizationCandidate(ExecutionNode::NodeType type, Exec
|
||||||
AstNode const* node = expression->node();
|
AstNode const* node = expression->node();
|
||||||
|
|
||||||
|
|
||||||
//LOG_TOPIC(DEBUG, Logger::DEVEL) << "checking expression of calcaulation";
|
LOG_TOPIC(DEBUG, Logger::DEVEL) << "checking expression of calcaulation";
|
||||||
|
|
||||||
|
//FIXME -- technical debt -- code duplication / not all cases covered
|
||||||
switch(type){
|
switch(type){
|
||||||
case EN::SORT: {
|
case EN::SORT: {
|
||||||
rv = isDistanceFunction(node);
|
//iterate && and find frist candidate - this gets way more complex if we want to check more
|
||||||
|
auto ntype = node->type;
|
||||||
|
if ( ntype == NODE_TYPE_OPERATOR_BINARY_AND || ntype == NODE_TYPE_OPERATOR_NARY_AND){
|
||||||
|
for(std::size_t i = 0; i < node->numMembers(); ++i){
|
||||||
|
rv = isDistanceFunction(node->getMember(i));
|
||||||
|
if(rv) break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rv = isDistanceFunction(node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EN::FILTER: {
|
case EN::FILTER: {
|
||||||
rv = isGeoFilterExpression(node);
|
//iterate && and find frist candidate - this gets way more complex if we want to check more
|
||||||
|
auto ntype = node->type;
|
||||||
|
if ( ntype == NODE_TYPE_OPERATOR_BINARY_AND || ntype == NODE_TYPE_OPERATOR_NARY_AND){
|
||||||
|
for(std::size_t i = 0; i < node->numMembers(); ++i){
|
||||||
|
rv = isGeoFilterExpression(node->getMember(i));
|
||||||
|
if(rv) break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rv = isGeoFilterExpression(node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
LOG_TOPIC(DEBUG, Logger::DEVEL) << "expression is not valid for geoindex";
|
||||||
rv.invalidate(); // not required but make sure the result is invalid
|
rv.invalidate(); // not required but make sure the result is invalid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,7 @@ function optimizerIndexesTestSuite () {
|
||||||
|
|
||||||
assertEqual("SingletonNode", nodeTypes[0], query);
|
assertEqual("SingletonNode", nodeTypes[0], query);
|
||||||
assertNotEqual(-1, nodeTypes.indexOf("IndexNode"), query);
|
assertNotEqual(-1, nodeTypes.indexOf("IndexNode"), query);
|
||||||
|
|
||||||
var results = AQL_EXECUTE(query);
|
var results = AQL_EXECUTE(query);
|
||||||
assertEqual([ 12 ], results.json, query);
|
assertEqual([ 12 ], results.json, query);
|
||||||
assertEqual(0, results.stats.scannedFull);
|
assertEqual(0, results.stats.scannedFull);
|
||||||
|
|
Loading…
Reference in New Issue