Class QueryContext


  • public class QueryContext
    extends Object
    Immutable holder for query context parameters with typed access methods. Code builds up a map of context values from serialization or during planning. Once that map is handed to the QueryContext, that map is effectively immutable.

    The implementation uses a TreeMap so that the serialized form of a query lists context values in a deterministic order. Jackson will call getContext() on the query, which will call asMap() here, which returns the sorted TreeMap.

    The TreeMap is a mutable class. We'd prefer an immutable class, but we can choose either ordering or immutability. Since the semantics of the context is that it is immutable once it is placed in a query. Code should NEVER get the context map from a query and modify it, even if the actual implementation allows it.

    • Constructor Detail

    • Method Detail

      • isEmpty

        public boolean isEmpty()
      • containsKey

        public boolean containsKey​(String key)
        Check if the given key is set. If the client will then fetch the value, consider using one of the get<Type>(String key) methods instead: they each return null if the value is not set.
      • get

        @Nullable
        public Object get​(String key)
        Return a value as a generic Object, returning null if the context value is not set.
      • getBoolean

        public Boolean getBoolean​(String key)
        Return a value as an Boolean, returning {@link null} if the context value is not set.
        Throws:
        BadQueryContextException - for an invalid value
      • getBoolean

        public boolean getBoolean​(String key,
                                  boolean defaultValue)
        Return a value as an boolean, returning the default value if the context value is not set.
        Throws:
        BadQueryContextException - for an invalid value
      • getInt

        public Integer getInt​(String key)
        Return a value as an Integer, returning {@link null} if the context value is not set.
        Throws:
        BadQueryContextException - for an invalid value
      • getInt

        public int getInt​(String key,
                          int defaultValue)
        Return a value as an int, returning the default value if the context value is not set.
        Throws:
        BadQueryContextException - for an invalid value
      • getLong

        public Long getLong​(String key)
        Return a value as an Long, returning {@link null} if the context value is not set.
        Throws:
        BadQueryContextException - for an invalid value
      • getLong

        public long getLong​(String key,
                            long defaultValue)
        Return a value as an long, returning the default value if the context value is not set.
        Throws:
        BadQueryContextException - for an invalid value
      • getFloat

        public Float getFloat​(String key)
        Return a value as an Float, returning {@link null} if the context value is not set.
        Throws:
        BadQueryContextException - for an invalid value
      • getFloat

        public float getFloat​(String key,
                              float defaultValue)
        Return a value as an float, returning the default value if the context value is not set.
        Throws:
        BadQueryContextException - for an invalid value
      • getEnum

        public <E extends Enum<E>> E getEnum​(String key,
                                             Class<E> clazz,
                                             E defaultValue)
      • getGranularity

        public Granularity getGranularity​(String key,
                                          com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
      • isDebug

        public boolean isDebug()
      • isBySegment

        public boolean isBySegment()
      • isBySegment

        public boolean isBySegment​(boolean defaultValue)
      • isPopulateCache

        public boolean isPopulateCache()
      • isPopulateCache

        public boolean isPopulateCache​(boolean defaultValue)
      • isUseCache

        public boolean isUseCache()
      • isUseCache

        public boolean isUseCache​(boolean defaultValue)
      • isPopulateResultLevelCache

        public boolean isPopulateResultLevelCache()
      • isPopulateResultLevelCache

        public boolean isPopulateResultLevelCache​(boolean defaultValue)
      • isUseResultLevelCache

        public boolean isUseResultLevelCache()
      • isUseResultLevelCache

        public boolean isUseResultLevelCache​(boolean defaultValue)
      • isFinalize

        public boolean isFinalize​(boolean defaultValue)
      • isSerializeDateTimeAsLong

        public boolean isSerializeDateTimeAsLong​(boolean defaultValue)
      • isSerializeDateTimeAsLongInner

        public boolean isSerializeDateTimeAsLongInner​(boolean defaultValue)
      • getVectorSize

        public int getVectorSize()
      • getVectorSize

        public int getVectorSize​(int defaultSize)
      • getMaxSubqueryRows

        public int getMaxSubqueryRows​(int defaultSize)
      • getMaxSubqueryMemoryBytes

        public String getMaxSubqueryMemoryBytes​(String defaultMemoryBytes)
      • isUseNestedForUnknownTypeInSubquery

        public boolean isUseNestedForUnknownTypeInSubquery​(boolean defaultUseNestedForUnkownTypeInSubquery)
      • getUncoveredIntervalsLimit

        public int getUncoveredIntervalsLimit()
      • getUncoveredIntervalsLimit

        public int getUncoveredIntervalsLimit​(int defaultValue)
      • getPriority

        public int getPriority()
      • getPriority

        public int getPriority​(int defaultValue)
      • getLane

        public String getLane()
      • getEnableParallelMerges

        public boolean getEnableParallelMerges()
      • getParallelMergeInitialYieldRows

        public int getParallelMergeInitialYieldRows​(int defaultValue)
      • getParallelMergeSmallBatchRows

        public int getParallelMergeSmallBatchRows​(int defaultValue)
      • getParallelMergeParallelism

        public int getParallelMergeParallelism​(int defaultValue)
      • getJoinFilterRewriteMaxSize

        public long getJoinFilterRewriteMaxSize()
      • getEnableJoinFilterPushDown

        public boolean getEnableJoinFilterPushDown()
      • getEnableJoinFilterRewrite

        public boolean getEnableJoinFilterRewrite()
      • isSecondaryPartitionPruningEnabled

        public boolean isSecondaryPartitionPruningEnabled()
      • getMaxQueuedBytes

        public long getMaxQueuedBytes​(long defaultValue)
      • getMaxScatterGatherBytes

        public long getMaxScatterGatherBytes()
      • hasTimeout

        public boolean hasTimeout()
      • getTimeout

        public long getTimeout()
      • getTimeout

        public long getTimeout​(long defaultTimeout)
      • getDefaultTimeout

        public long getDefaultTimeout()
      • verifyMaxQueryTimeout

        public void verifyMaxQueryTimeout​(long maxQueryTimeout)
      • verifyMaxScatterGatherBytes

        public void verifyMaxScatterGatherBytes​(long maxScatterGatherBytesLimit)
      • getNumRetriesOnMissingSegments

        public int getNumRetriesOnMissingSegments​(int defaultValue)
      • allowReturnPartialResults

        public boolean allowReturnPartialResults​(boolean defaultValue)
      • getEnableJoinFilterRewriteValueColumnFilters

        public boolean getEnableJoinFilterRewriteValueColumnFilters()
      • getEnableRewriteJoinToFilter

        public boolean getEnableRewriteJoinToFilter()
      • getEnableJoinLeftScanDirect

        public boolean getEnableJoinLeftScanDirect()
      • getInSubQueryThreshold

        public int getInSubQueryThreshold()
      • getInSubQueryThreshold

        public int getInSubQueryThreshold​(int defaultValue)
      • isTimeBoundaryPlanningEnabled

        public boolean isTimeBoundaryPlanningEnabled()
      • getBrokerServiceName

        public String getBrokerServiceName()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object