Class OSpatialFunctionAbstractIndexable
java.lang.Object
com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
com.orientechnologies.spatial.functions.OSpatialFunctionAbstract
com.orientechnologies.spatial.functions.OSpatialFunctionAbstractIndexable
- All Implemented Interfaces:
OIndexableSQLFunction,OSQLFunction
- Direct Known Subclasses:
OSTContainsFunction,OSTDistanceSphereFunction,OSTDWithinFunction,OSTIntersectsFunction,OSTWithinFunction
public abstract class OSpatialFunctionAbstractIndexable
extends OSpatialFunctionAbstract
implements OIndexableSQLFunction
Created by Enrico Risa on 31/08/15.
-
Field Summary
Fields inherited from class com.orientechnologies.spatial.functions.OSpatialFunctionAbstract
factoryFields inherited from class com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
maxParams, minParams, name -
Constructor Summary
ConstructorsConstructorDescriptionOSpatialFunctionAbstractIndexable(String iName, int iMinParams, int iMaxParams) -
Method Summary
Modifier and TypeMethodDescriptionbooleanallowsIndexedExecution(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Checks if this function can be used to fetch data from this target and with these arguments (eg. if the index exists on this target and it's defined on these fields)booleancanExecuteInline(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) checks if the function can be used even on single records, not as an indexed function (even if the index does not exist at all)longestimate(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) estimates the number of entries returned by searchFromTarget() with these parameters<T> booleanprotected booleanisValidBinaryOperator(OBinaryCompareOperator operator) protected voidonAfterParsing(Map<String, Object> params, OExpression[] args, OCommandContext ctx, Object rightValue) protected abstract Stringoperator()protected Iterable<OIdentifiable>results(OFromClause target, OExpression[] args, OCommandContext ctx, Object rightValue) protected OLuceneSpatialIndexsearchForIndex(OFromClause target, OExpression[] args, OCommandContext ctx) booleanshouldExecuteAfterSearch(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Checks if this function should be called even if the methodOIndexableSQLFunction.searchFromTarget(com.orientechnologies.orient.core.sql.parser.OFromClause, com.orientechnologies.orient.core.sql.parser.OBinaryCompareOperator, java.lang.Object, com.orientechnologies.orient.core.command.OCommandContext, com.orientechnologies.orient.core.sql.parser.OExpression...)is executed.Methods inherited from class com.orientechnologies.spatial.functions.OSpatialFunctionAbstract
toShapeMethods inherited from class com.orientechnologies.orient.core.sql.functions.OSQLFunctionAbstract
aggregateResults, config, filterResult, getDatabase, getDistributedStorageId, getMaxParams, getMinParams, getName, getResult, getSingleItem, getSingleProperty, mergeDistributedResult, returnDistributedResult, setResult, shouldMergeDistributedResult, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.orientechnologies.orient.core.sql.functions.OIndexableSQLFunction
searchFromTargetMethods inherited from interface com.orientechnologies.orient.core.sql.functions.OSQLFunction
aggregateResults, config, execute, filterResult, getMaxParams, getMinParams, getName, getResult, getSyntax, mergeDistributedResult, setResult, shouldMergeDistributedResult
-
Constructor Details
-
OSpatialFunctionAbstractIndexable
-
-
Method Details
-
searchForIndex
protected OLuceneSpatialIndex searchForIndex(OFromClause target, OExpression[] args, OCommandContext ctx) -
results
protected Iterable<OIdentifiable> results(OFromClause target, OExpression[] args, OCommandContext ctx, Object rightValue) -
onAfterParsing
protected void onAfterParsing(Map<String, Object> params, OExpression[] args, OCommandContext ctx, Object rightValue) -
operator
-
canExecuteInline
public boolean canExecuteInline(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Description copied from interface:OIndexableSQLFunctionchecks if the function can be used even on single records, not as an indexed function (even if the index does not exist at all)- Specified by:
canExecuteInlinein interfaceOIndexableSQLFunction- Parameters:
target- the query targetoperator- the operator after the function, eg. inselect from Foo where myFunction(name) > 4the operator is >rightValue- the value that has to be compared to the function result, eg. inselect from Foo where myFunction(name) > 4the right value is 4ctx- the command context for this queryargs- the function arguments, eg. inselect from Foo where myFunction(name) > 4the arguments are [name]- Returns:
- true if the function can be calculated without the index. False otherwise
-
allowsIndexedExecution
public boolean allowsIndexedExecution(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Description copied from interface:OIndexableSQLFunctionChecks if this function can be used to fetch data from this target and with these arguments (eg. if the index exists on this target and it's defined on these fields)- Specified by:
allowsIndexedExecutionin interfaceOIndexableSQLFunction- Parameters:
target- the query targetoperator- the operator after the function, eg. inselect from Foo where myFunction(name) > 4the operator is >rightValue- the value that has to be compared to the function result, eg. inselect from Foo where myFunction(name) > 4the right value is 4ctx- the command context for this queryargs- the function arguments, eg. inselect from Foo where myFunction(name) > 4the arguments are [name]- Returns:
- True if the function can be used to fetch from an index. False otherwise
-
shouldExecuteAfterSearch
public boolean shouldExecuteAfterSearch(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Description copied from interface:OIndexableSQLFunctionChecks if this function should be called even if the methodOIndexableSQLFunction.searchFromTarget(com.orientechnologies.orient.core.sql.parser.OFromClause, com.orientechnologies.orient.core.sql.parser.OBinaryCompareOperator, java.lang.Object, com.orientechnologies.orient.core.command.OCommandContext, com.orientechnologies.orient.core.sql.parser.OExpression...)is executed.- Specified by:
shouldExecuteAfterSearchin interfaceOIndexableSQLFunction- Parameters:
target- the query targetoperator- the operator after the function, eg. inselect from Foo where myFunction(name) > 4the operator is >rightValue- the value that has to be compared to the function result, eg. inselect from Foo where myFunction(name) > 4the right value is 4ctx- the command context for this queryargs- the function arguments, eg. inselect from Foo where myFunction(name) > 4the arguments are [name]- Returns:
- True if this function should be called even if the method
OIndexableSQLFunction.searchFromTarget(com.orientechnologies.orient.core.sql.parser.OFromClause, com.orientechnologies.orient.core.sql.parser.OBinaryCompareOperator, java.lang.Object, com.orientechnologies.orient.core.command.OCommandContext, com.orientechnologies.orient.core.sql.parser.OExpression...)is executed. False otherwise
-
estimate
public long estimate(OFromClause target, OBinaryCompareOperator operator, Object rightValue, OCommandContext ctx, OExpression... args) Description copied from interface:OIndexableSQLFunctionestimates the number of entries returned by searchFromTarget() with these parameters- Specified by:
estimatein interfaceOIndexableSQLFunction- Parameters:
target- the query targetoperator- the operator after the function, eg. inselect from Foo where myFunction(name) > 4the operator is >rightValue- the value that has to be compared to the function result, eg. inselect from Foo where myFunction(name) > 4the right value is 4ctx- the command context for this queryargs- the function arguments, eg. inselect from Foo where myFunction(name) > 4the arguments are [name]- Returns:
- an estimantion of how many entries will be returned by searchFromTarget() with these parameters, -1 if the estimation cannot be done
-
intersect
-
isValidBinaryOperator
-