public abstract class OCommandExecutorSQLResultsetAbstract extends OCommandExecutorSQLAbstract implements OCommandDistributedReplicateRequest, Iterable<OIdentifiable>, OIterableRecordSource
SYNTAX: TRAVERSE
In the command context you've access to the variable $depth containing the depth level from
the root node. This is useful to limit the traverse up to a level. For example to consider from
the first depth level (0 is root node) to the third use:
TRAVERSE children FROM #5:23 WHERE $depth BETWEEN 1 AND 3
. To filter traversed records use
it combined with a SELECT statement:
SELECT FROM (TRAVERSE children FROM #5:23 WHERE $depth BETWEEN 1 AND 3) WHERE city.name = 'Rome'
OCommandDistributedReplicateRequest.DISTRIBUTED_EXECUTION_MODE, OCommandDistributedReplicateRequest.DISTRIBUTED_RESULT_MGMT, OCommandDistributedReplicateRequest.QUORUM_TYPE
Modifier and Type | Field and Description |
---|---|
protected OSQLFilter |
compiledFilter |
protected static String |
KEYWORD_FROM_2FIND |
protected static String |
KEYWORD_LET_2FIND |
protected boolean |
lazyIteration |
protected Map<String,Object> |
let |
protected OSQLTarget |
parsedTarget |
protected OSQLAsynchQuery<ODocument> |
request |
protected int |
resultCount |
protected AtomicInteger |
serialTempRID |
protected int |
skip |
protected Iterator<? extends OIdentifiable> |
target |
protected Iterable<OIdentifiable> |
tempResult |
CLASS_PREFIX, CLUSTER_PREFIX, DEFAULT_PARAM_USER, DICTIONARY_PREFIX, INDEX_PREFIX, INDEX_VALUES_ASC_PREFIX, INDEX_VALUES_DESC_PREFIX, INDEX_VALUES_PREFIX, KEYWORD_FROM, KEYWORD_KEY, KEYWORD_LET, KEYWORD_LIMIT, KEYWORD_LOCK, KEYWORD_OFFSET, KEYWORD_RETURN, KEYWORD_RID, KEYWORD_SKIP, KEYWORD_TIMEOUT, KEYWORD_UNSAFE, KEYWORD_WHERE, METADATA_DATABASE, METADATA_INDEXMGR, METADATA_PREFIX, METADATA_SCHEMA, METADATA_STORAGE, preParsedStatement, timeoutMs, timeoutStrategy
context, limit, parameters, progressListener
parserText, parserTextUpperCase
Constructor and Description |
---|
OCommandExecutorSQLResultsetAbstract() |
Modifier and Type | Method and Description |
---|---|
protected void |
applyLimitAndSkip() |
protected void |
assignLetClauses(ORecord iRecord) |
protected boolean |
assignTarget(Map<Object,Object> iArgs)
Assign the right TARGET if found.
|
protected boolean |
evaluateRecord(ORecord iRecord,
OCommandContext iContext) |
protected boolean |
filter(ORecord iRecord,
OCommandContext iContext) |
OCommandDistributedReplicateRequest.DISTRIBUTED_EXECUTION_MODE |
getDistributedExecutionMode()
The command is replicated
|
OCommandDistributedReplicateRequest.DISTRIBUTED_RESULT_MGMT |
getDistributedResultManagement()
Returns how to manage the distributed result between:
CHECK_FOR_EQUALS: all results must be the same
MERGE: merges results.
|
protected ORID[] |
getRange() |
protected Object |
getResult() |
protected Object |
getResultInstance() |
Iterator<? extends OIdentifiable> |
getTarget() |
protected boolean |
handleResult(OIdentifiable iRecord,
OCommandContext iContext) |
boolean |
isCacheable()
Returns true if the command results can be cached.
|
boolean |
isIdempotent()
Returns true if the command doesn't change the database, otherwise false.
|
boolean |
isLazyIteration() |
protected boolean |
isUseCache() |
Object |
mergeResults(Map<String,Object> results) |
protected void |
optimize()
Optimizes the condition tree.
|
protected void |
optimizeBranch(OSQLFilterCondition iParentCondition,
OSQLFilterCondition iCondition) |
protected Object |
optimizeFunction(OSQLFunctionRuntime function)
Check function arguments and pre calculate it if possible
|
OCommandExecutorSQLResultsetAbstract |
parse(OCommandRequest iRequest)
Compile the filter conditions only the first time.
|
protected void |
parseLet() |
protected int |
parseLimit(String w)
Parses the limit keyword if found.
|
protected int |
parseSkip(String w)
Parses the skip keyword if found.
|
protected boolean |
pushResult(Object rec) |
protected void |
searchInClasses() |
protected void |
searchInClasses(boolean iAscendentOrder) |
protected Iterator<? extends OIdentifiable> |
searchInClasses(OClass iCls,
boolean iPolymorphic,
boolean iAscendentOrder) |
protected void |
searchInClusters() |
void |
setCompiledFilter(OSQLFilter compiledFilter) |
void |
setLazyIteration(boolean lazyIteration) |
void |
setParsedTarget(OSQLTarget parsedTarget) |
void |
setRequest(OSQLAsynchQuery<ODocument> request) |
void |
setTarget(Iterator<? extends OIdentifiable> target) |
bindDefaultContextVariables, checkClusterAccess, decodeClassName, getInvolvedClustersOfClasses, getInvolvedClustersOfClusters, getInvolvedClustersOfIndex, parseLock, parseTimeout, preParse, throwParsingException, throwParsingException, throwSyntaxErrorException
checkInterruption, checkInterruption, getContext, getDatabase, getDistributedTimeout, getFetchPlan, getInvolvedClusters, getLimit, getParameters, getProgressListener, getSecurityOperationType, getUndoCommand, init, involveSchema, isDistributedExecutingOnLocalNodeFirst, isLocalExecution, setContext, setLimit, setProgressListener, toString, upperCase
getLastWordLength, getSyntax, getWordStatic, nextWord, nextWord, parseOptionalWord, parserGetCurrentChar, parserGetCurrentPosition, parserGetLastSeparator, parserGetLastWord, parserGetPreviousPosition, parserGoBack, parserIsEnded, parserMoveCurrentPosition, parserNextChars, parserNextWord, parserNextWord, parserNextWord, parserOptionalKeyword, parserOptionalWord, parserRequiredKeyword, parserRequiredWord, parserRequiredWord, parserRequiredWord, parserSetCurrentPosition, parserSetEndOfText, parserSetLastSeparator, parserSkipWhiteSpaces
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDistributedTimeout, getQuorumType, getUndoCommand, isDistributedExecutingOnLocalNodeFirst
forEach, iterator, spliterator
iterator
execute, getSyntax
protected static final String KEYWORD_FROM_2FIND
protected static final String KEYWORD_LET_2FIND
protected OSQLAsynchQuery<ODocument> request
protected OSQLTarget parsedTarget
protected OSQLFilter compiledFilter
protected Iterator<? extends OIdentifiable> target
protected Iterable<OIdentifiable> tempResult
protected int resultCount
protected AtomicInteger serialTempRID
protected int skip
protected boolean lazyIteration
public OCommandExecutorSQLResultsetAbstract()
public OCommandExecutorSQLResultsetAbstract parse(OCommandRequest iRequest)
parse
in interface OCommandExecutor
iRequest
- Command request implementation.#execute(Map
public boolean isIdempotent()
OCommandExecutor
isIdempotent
in interface OCommandExecutor
isIdempotent
in class OCommandExecutorSQLAbstract
public boolean isLazyIteration()
public void setLazyIteration(boolean lazyIteration)
public OCommandDistributedReplicateRequest.DISTRIBUTED_EXECUTION_MODE getDistributedExecutionMode()
OCommandExecutorSQLAbstract
getDistributedExecutionMode
in interface OCommandDistributedReplicateRequest
getDistributedExecutionMode
in class OCommandExecutorSQLAbstract
public OCommandDistributedReplicateRequest.DISTRIBUTED_RESULT_MGMT getDistributedResultManagement()
OCommandDistributedReplicateRequest
getDistributedResultManagement
in interface OCommandDistributedReplicateRequest
getDistributedResultManagement
in class OCommandExecutorAbstract
protected boolean assignTarget(Map<Object,Object> iArgs)
iArgs
- Parameters to bindprotected Object getResultInstance()
protected Object getResult()
protected boolean pushResult(Object rec)
protected boolean handleResult(OIdentifiable iRecord, OCommandContext iContext)
protected void parseLet()
protected int parseLimit(String w) throws OCommandSQLParsingException
w
- OCommandSQLParsingException
- if no valid limit has been foundprotected int parseSkip(String w) throws OCommandSQLParsingException
w
- OCommandSQLParsingException
- if no valid skip has been foundprotected boolean filter(ORecord iRecord, OCommandContext iContext)
protected boolean evaluateRecord(ORecord iRecord, OCommandContext iContext)
protected void assignLetClauses(ORecord iRecord)
protected void searchInClasses()
protected void searchInClasses(boolean iAscendentOrder)
protected Iterator<? extends OIdentifiable> searchInClasses(OClass iCls, boolean iPolymorphic, boolean iAscendentOrder)
protected boolean isUseCache()
protected void searchInClusters()
protected void applyLimitAndSkip()
protected void optimize()
protected Object optimizeFunction(OSQLFunctionRuntime function)
function
- protected void optimizeBranch(OSQLFilterCondition iParentCondition, OSQLFilterCondition iCondition)
protected ORID[] getRange()
public Iterator<? extends OIdentifiable> getTarget()
public void setTarget(Iterator<? extends OIdentifiable> target)
public void setRequest(OSQLAsynchQuery<ODocument> request)
public void setParsedTarget(OSQLTarget parsedTarget)
public void setCompiledFilter(OSQLFilter compiledFilter)
public boolean isCacheable()
OCommandExecutor
isCacheable
in interface OCommandExecutor
isCacheable
in class OCommandExecutorAbstract
public Object mergeResults(Map<String,Object> results) throws Exception
mergeResults
in interface OCommandExecutor
mergeResults
in class OCommandExecutorAbstract
Exception
Copyright © 2009–2020 OrientDB. All rights reserved.