Class OQueryOperator

java.lang.Object
com.orientechnologies.orient.core.sql.operator.OQueryOperator
Direct Known Subclasses:
OQueryOperatorAnd, OQueryOperatorDivide, OQueryOperatorEquality, OQueryOperatorMinus, OQueryOperatorMod, OQueryOperatorMultiply, OQueryOperatorNot, OQueryOperatorOr, OQueryOperatorPlus, OQueryTargetOperator

public abstract class OQueryOperator extends Object
Query Operators. Remember to handle the operator in OQueryItemCondition.
Author:
Luca Garulli (l.garulli--(at)--orientdb.com)
  • Field Details

    • DEFAULT_OPERATORS_ORDER

      protected static final Class<?>[] DEFAULT_OPERATORS_ORDER
      Default operator order. can be used by additional operator to locate themself relatively to default ones.

      WARNING: ORDER IS IMPORTANT TO AVOID SUB-STRING LIKE "IS" and AND "INSTANCEOF": INSTANCEOF MUST BE PLACED BEFORE! AND ALSO FOR PERFORMANCE (MOST USED BEFORE)

    • keyword

      public final String keyword
    • precedence

      public final int precedence
    • expectedRightWords

      public final int expectedRightWords
    • unary

      public final boolean unary
    • expectsParameters

      public final boolean expectsParameters
  • Constructor Details

    • OQueryOperator

      protected OQueryOperator(String iKeyword, int iPrecedence, boolean iUnary)
    • OQueryOperator

      protected OQueryOperator(String iKeyword, int iPrecedence, boolean iUnary, int iExpectedRightWords)
    • OQueryOperator

      protected OQueryOperator(String iKeyword, int iPrecedence, boolean iUnary, int iExpectedRightWords, boolean iExpectsParameters)
  • Method Details

    • evaluateRecord

      public abstract Object evaluateRecord(OIdentifiable iRecord, ODocument iCurrentResult, OSQLFilterCondition iCondition, Object iLeft, Object iRight, OCommandContext iContext, ODocumentSerializer serializer)
    • getIndexReuseType

      public abstract OIndexReuseType getIndexReuseType(Object iLeft, Object iRight)
      Returns hint how index can be used to calculate result of operator execution.
      Parameters:
      iLeft - Value of left query parameter.
      iRight - Value of right query parameter.
      Returns:
      Hint how index can be used to calculate result of operator execution.
    • getOIndexSearchResult

      public OIndexSearchResult getOIndexSearchResult(OClass iSchemaClass, OSQLFilterCondition iCondition, List<OIndexSearchResult> iIndexSearchResults, OCommandContext context)
    • executeIndexQuery

      public Stream<ORawPair<Object,ORID>> executeIndexQuery(OCommandContext iContext, OIndex index, List<Object> keyParams, boolean ascSortOrder)
      Performs index query and returns index stream which presents subset of index data which corresponds to result of execution of given operator.

      Query that should be executed can be presented like: [[property0 = keyParam0] and [property1 = keyParam1] and] propertyN operator keyParamN.

      It is supped that index which passed in as parameter is used to index properties listed above and responsibility of given method execute query using given parameters.

      Multiple parameters are passed in to implement composite indexes support.

      Parameters:
      iContext -
      index - Instance of index that will be used to calculate result of operator execution.
      keyParams - Parameters of query is used to calculate query result.
      ascSortOrder - Data returned by cursors should be sorted in ascending or descending order.
      Returns:
      Cursor instance if index can be used to evaluate result of execution of given operator and null otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • configure

      public OQueryOperator configure(List<String> iParams)
      Default State-less implementation: does not save parameters and just return itself
      Parameters:
      iParams -
      Returns:
    • getSyntax

      public String getSyntax()
    • getBeginRidRange

      public abstract ORID getBeginRidRange(Object iLeft, Object iRight)
    • getEndRidRange

      public abstract ORID getEndRidRange(Object iLeft, Object iRight)
    • isUnary

      public boolean isUnary()
    • compare

      public OQueryOperator.ORDER compare(OQueryOperator other)
      Check priority of this operator compare to given operator.
      Parameters:
      other -
      Returns:
      ORDER place of this operator compared to given operator
    • updateProfiler

      protected void updateProfiler(OCommandContext iContext, OIndex index, List<Object> keyParams, OIndexDefinition indexDefinition)
    • canShortCircuit

      public boolean canShortCircuit(Object l)
    • canBeMerged

      public boolean canBeMerged()
    • isSupportingBinaryEvaluate

      public boolean isSupportingBinaryEvaluate()
    • getKeyword

      public String getKeyword()
    • evaluate

      public boolean evaluate(Object iLeft, Object iRight)