MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / checkIndexExpression

Method checkIndexExpression

src/jrd/optimizer/Retrieval.cpp:802–825  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

800}
801
802bool Retrieval::checkIndexExpression(const index_desc* idx, ValueExprNode* node) const
803{
804 fb_assert(idx && idx->idx_expression);
805
806 // The desired expression can be hidden inside a derived expression node,
807 // so try to recover it (see CORE-4118).
808 while (!idx->idx_expression->sameAs(node, true))
809 {
810 const auto derivedExpr = nodeAs<DerivedExprNode>(node);
811 const auto cast = nodeAs<CastNode>(node);
812
813 if (derivedExpr)
814 node = derivedExpr->arg;
815 else if (cast && cast->artificial)
816 node = cast->source;
817 else
818 return false;
819 }
820
821 // Check the index for matching both the given stream and the given expression tree
822
823 return idx->idx_expression->containsStream(0, true) &&
824 node->containsStream(stream, true);
825}
826
827void Retrieval::getInversionCandidates(InversionCandidateList& inversions,
828 IndexScratchList& fromIndexScratches,

Callers

nothing calls this directly

Calls 2

sameAsMethod · 0.45
containsStreamMethod · 0.45

Tested by

no test coverage detected