core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLSelect.java
public int getTemporaryRIDCounter(final OCommandContext iContext) {
    final OTemporaryRidGenerator parentQuery = (OTemporaryRidGenerator) iContext.getVariable("parentQuery");
    return parentQuery != null && parentQuery != this ?
        parentQuery.getTemporaryRIDCounter(iContext) :
        serialTempRID.getAndIncrement();
  }
public int getTemporaryRIDCounter(final OCommandContext iContext) {
    final OTemporaryRidGenerator parentQuery = (OTemporaryRidGenerator) iContext.getVariable("parentQuery");
    return parentQuery != null && parentQuery != this ?
        parentQuery.getTemporaryRIDCounter(iContext) :
        serialTempRID.getAndIncrement();
  }
public int getTemporaryRIDCounter ( final OCommandContext iContext ) { final OTemporaryRidGenerator parentQuery = ( OTemporaryRidGenerator ) iContext . getVariable ( "parentQuery" ) ; return parentQuery != null && parentQuery != this ? parentQuery . getTemporaryRIDCounter ( iContext ) : serialTempRID . getAndIncrement ( ) ; }
Returns the temporary RID counter assuring it's unique per query tree.

@return Serial as integer
Returns the temporary RID counter assuring it s unique per query tree .