Class BaseEmbeddedQuery<T>

java.lang.Object
org.infinispan.query.dsl.impl.BaseQuery<T>
org.infinispan.query.core.impl.BaseEmbeddedQuery<T>
All Implemented Interfaces:
Iterable<T>, org.infinispan.query.dsl.PaginationContext<org.infinispan.query.dsl.Query<T>>, org.infinispan.query.dsl.ParameterContext<org.infinispan.query.dsl.Query<T>>, org.infinispan.query.dsl.Query<T>
Direct Known Subclasses:
EmbeddedQuery, EmptyResultQuery, HybridQuery

public abstract class BaseEmbeddedQuery<T> extends org.infinispan.query.dsl.impl.BaseQuery<T>
Base class for embedded-mode query implementations. Subclasses need to implement getInternalIterator() and getComparator() methods and this class will take care of sorting (fully in-memory).
Since:
8.0
Author:
anistor@redhat.com
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.infinispan.AdvancedCache<?,?>
     
    protected final PartitionHandlingSupport
     
    protected final LocalQueryStatistics
     
    protected final org.infinispan.objectfilter.impl.syntax.parser.IckleParsingResult.StatementType
     

    Fields inherited from class org.infinispan.query.dsl.impl.BaseQuery

    hitCountAccuracy, local, maxResults, namedParameters, projection, queryFactory, queryString, startOffset, timeout
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    BaseEmbeddedQuery(org.infinispan.query.dsl.QueryFactory queryFactory, org.infinispan.AdvancedCache<?,?> cache, String queryString, org.infinispan.objectfilter.impl.syntax.parser.IckleParsingResult.StatementType statementType, Map<String,Object> namedParameters, String[] projection, long startOffset, int maxResults, LocalQueryStatistics queryStatistics, boolean local)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.infinispan.query.dsl.QueryResult<T>
     
    protected abstract Comparator<Comparable<?>[]>
    Create a comparator to be used for ordering the results returned by getInternalIterator().
    protected abstract org.infinispan.commons.util.CloseableIterator<org.infinispan.objectfilter.ObjectFilter.FilterResult>
    Create an iterator over the results of the query, in no particular order.
    int
     
    protected boolean
     
    org.infinispan.commons.util.CloseableIterator<T>
     
     
    protected abstract void
    recordQuery(long time)
     
    void
     
     

    Methods inherited from class org.infinispan.query.dsl.impl.BaseQuery

    entryIterator, executeStatement, getMaxResults, getParameters, getProjection, getQueryString, getStartOffset, hasProjections, hitCountAccuracy, hitCountAccuracy, isLocal, local, maxResults, setParameter, setParameters, startOffset, timeout, validateNamedParameters

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

    • statementType

      protected final org.infinispan.objectfilter.impl.syntax.parser.IckleParsingResult.StatementType statementType
    • cache

      protected final org.infinispan.AdvancedCache<?,?> cache
    • partitionHandlingSupport

      protected final PartitionHandlingSupport partitionHandlingSupport
    • queryStatistics

      protected final LocalQueryStatistics queryStatistics
  • Constructor Details

    • BaseEmbeddedQuery

      protected BaseEmbeddedQuery(org.infinispan.query.dsl.QueryFactory queryFactory, org.infinispan.AdvancedCache<?,?> cache, String queryString, org.infinispan.objectfilter.impl.syntax.parser.IckleParsingResult.StatementType statementType, Map<String,Object> namedParameters, String[] projection, long startOffset, int maxResults, LocalQueryStatistics queryStatistics, boolean local)
  • Method Details

    • resetQuery

      public void resetQuery()
      Specified by:
      resetQuery in class org.infinispan.query.dsl.impl.BaseQuery<T>
    • list

      public List<T> list()
    • recordQuery

      protected abstract void recordQuery(long time)
    • execute

      public org.infinispan.query.dsl.QueryResult<T> execute()
    • iterator

      public org.infinispan.commons.util.CloseableIterator<T> iterator()
    • getComparator

      protected abstract Comparator<Comparable<?>[]> getComparator()
      Create a comparator to be used for ordering the results returned by getInternalIterator().
      Returns:
      the comparator or null if no sorting needs to be applied
    • getInternalIterator

      protected abstract org.infinispan.commons.util.CloseableIterator<org.infinispan.objectfilter.ObjectFilter.FilterResult> getInternalIterator()
      Create an iterator over the results of the query, in no particular order. Ordering will be provided if getComparator() returns a non-null Comparator. Please note this it not the same iterator as the one retuend by iterator().
    • getResultSize

      public int getResultSize()
    • isSelectStatement

      protected boolean isSelectStatement()
    • toString

      public String toString()
      Overrides:
      toString in class Object