Class RestrictedCursorFactory

java.lang.Object
org.apache.druid.segment.RestrictedCursorFactory
All Implemented Interfaces:
Expr.InputBindingInspector, ColumnInspector, CursorFactory

public class RestrictedCursorFactory extends Object implements CursorFactory
A factory class for creating Cursor instances with strict adherence to Policy restrictions. Created by RestrictedSegment.as(Class), and applies policies transparently.

The CursorFactory simplifies the process of initializing and retrieving Cursor objects while ensuring that any cursor created complies with the Policy restrictions.

Policy enforcement in makeCursorHolder(org.apache.druid.segment.CursorBuildSpec):

  • Row-level restrictions are enforced by adding filters to CursorBuildSpec, which is then passed to delegate for execution. This ensures that only relevant data are accessible by the client.
  • Constructor Details

    • RestrictedCursorFactory

      public RestrictedCursorFactory(CursorFactory delegate, Policy policy)
  • Method Details

    • makeCursorHolder

      public CursorHolder makeCursorHolder(CursorBuildSpec spec)
      Description copied from interface: CursorFactory
      Creates a CursorHolder for a given CursorBuildSpec which describes how the reader is going to scan, filter, transform, group and aggregate, and/or order the data.
      Specified by:
      makeCursorHolder in interface CursorFactory
    • getRowSignature

      public RowSignature getRowSignature()
      Description copied from interface: CursorFactory
      Returns the RowSignature of the data available from this cursor factory. For mutable segments, even though the signature may evolve over time, any particular object returned by this method is an immutable snapshot.
      Specified by:
      getRowSignature in interface CursorFactory
    • getColumnCapabilities

      @Nullable public ColumnCapabilities getColumnCapabilities(String column)
      Description copied from interface: CursorFactory
      Returns capabilities of a particular column, if known. May be null if the column doesn't exist, or if the column does exist but the capabilities are unknown. The latter is possible with dynamically discovered columns. Note that CursorFactory are representations of "real" segments, so they are not aware of any virtual columns that may be involved in a query. In general, query engines should instead use the method ColumnSelectorFactory.getColumnCapabilities(String), which returns capabilities for virtual columns as well.
      Specified by:
      getColumnCapabilities in interface ColumnInspector
      Specified by:
      getColumnCapabilities in interface CursorFactory
      Parameters:
      column - column name
      Returns:
      capabilities, or null