Class ExecuteProperties


  • @API(MAINTAINED)
    public class ExecuteProperties
    extends Object
    Limits on the execution of a query.
    • number of records to skip
    • limit on number of records returned
    • time limit for execution
    • limit on number of key-value pairs scanned
    • Field Detail

      • UNLIMITED_TIME

        public static final long UNLIMITED_TIME
        A constant representing that no time limit is set.
        See Also:
        Constant Field Values
      • SERIAL_EXECUTE

        public static final ExecuteProperties SERIAL_EXECUTE
        A basic set of properties for an unlimited query/scan execution with serializable isolation.
      • skip

        protected final int skip
      • rowLimit

        protected final int rowLimit
    • Method Detail

      • getSkip

        public int getSkip()
      • getReturnedRowLimit

        public int getReturnedRowLimit()
        Get the limit on the number of rows that will be returned as it would be passed to FDB.
        Returns:
        the limit or ReadTransaction.ROW_LIMIT_UNLIMITED if there is no limit.
      • getTimeLimit

        public long getTimeLimit()
        Get the time limit for query execution. This will return UNLIMITED_TIME if there is no time-limit imposed on a query.
        Returns:
        the maximum time for query execution
      • getScannedRecordsLimit

        public int getScannedRecordsLimit()
        Get the maximum number of records a query with this execute properties will scan. This will return Integer.MAX_VALUE if there is no limit to the number of records scanned by a query.
        Returns:
        the maximum number of records a query will scan
      • getScannedBytesLimit

        public long getScannedBytesLimit()
        Get the maximum number of bytes a query with this execute properties will scan. This will return Long.MAX_VALUE if there is no limit to the number of bytes scanned by a query.
        Returns:
        the maximum number of bytes a query will scan
      • setState

        @Nonnull
        public ExecuteProperties setState​(@Nonnull
                                          ExecuteState newState)
        Build a new ExecuteProperties with the given ExecuteState.
        Parameters:
        newState - the new state
        Returns:
        a new properties object with the new state
      • clearState

        @Nonnull
        public ExecuteProperties clearState()
        Build a new ExecuteProperties with an empty state.
        Returns:
        a new properties object with an empty state
      • isFailOnScanLimitReached

        public boolean isFailOnScanLimitReached()
        Get whether reaching the scan limit throws an exception.
        Returns:
        true if the scan limit throws an exception when reached, false if the scan returns early with RecordCursor.NoNextReason.SCAN_LIMIT_REACHED
      • setFailOnScanLimitReached

        public ExecuteProperties setFailOnScanLimitReached​(boolean failOnScanLimitReached)
      • clearRowAndTimeLimits

        @Nonnull
        public ExecuteProperties clearRowAndTimeLimits()
        Clear the returned row limit and time limit. Does not clear the skip.
        Returns:
        a new ExecuteProperties without the returned row and time limits
      • clearSkipAndLimit

        @Nonnull
        public ExecuteProperties clearSkipAndLimit()
        Clear the skip and returned row limit, but no other limits.
        Returns:
        a new ExecuteProperties without the skip and returned row limit
      • clearSkipAndAdjustLimit

        @Nonnull
        public ExecuteProperties clearSkipAndAdjustLimit()
        Remove any skip count and adjust the limit to include enough rows that we can skip those and then apply the current limit.
        Returns:
        a new properties without skip and with an adjusted limit
      • getReturnedRowLimitOrMax

        public int getReturnedRowLimitOrMax()
        Get the limit on the number of rows that will be returned as could be used for counting.
        Returns:
        the limit or Integer.MAX_VALUE if there is no limit.
      • setLimitsFrom

        @Nonnull
        public ExecuteProperties setLimitsFrom​(@Nonnull
                                               ExecuteProperties other)
        Merge these limits with the ones specified in other, using the limit specified by other except where it is unlimited, in which case the limit from this ExecuteProperties is used instead.
        Parameters:
        other - the ExecuteProperties to the take the limits from
        Returns:
        an ExecuteProperties with limits merged as described above
      • resetState

        @Nonnull
        public ExecuteProperties resetState()
        Reset the stateful parts of the properties to their "original" values, creating an independent mutable state.
        Returns:
        an ExecuteProperties with an independent mutable state
        See Also:
        ExecuteState.reset()
      • copy

        @Nonnull
        protected ExecuteProperties copy​(int skip,
                                         int rowLimit,
                                         long timeLimit,
                                         @Nonnull
                                         IsolationLevel isolationLevel,
                                         @Nonnull
                                         ExecuteState state,
                                         boolean failOnScanLimitReached,
                                         CursorStreamingMode defaultCursorStreamingMode)
        Create a new instance with these fields, copying any additional fields from subclasses.
        Parameters:
        skip - skip count
        rowLimit - returned row limit
        timeLimit - time limit
        isolationLevel - isolation level
        state - execute state
        failOnScanLimitReached - fail on scan limit reached
        defaultCursorStreamingMode - default streaming mode
        Returns:
        a new properties with the given fields changed and other fields copied from this properties