Class Selector

  • Direct Known Subclasses:
    SimpleSelector, TermSelector, VectorSelector

    public abstract class Selector
    extends java.lang.Object
    A Selector is used to convert the data returned by the storage engine into the data requested by the user. They correspond to the <selector> elements from the select clause.

    Since the introduction of aggregation, Selectors cannot be called anymore by multiple threads as they have an internal state.

    • Method Detail

      • kind

        public final Selector.Kind kind()
        Returns the Selector kind.
        Returns:
        the Selector kind
      • addFetchedColumns

        public abstract void addFetchedColumns​(ColumnFilter.Builder builder)
        Add to the provided builder the column (and potential subselections) to fetch for this selection.
        Parameters:
        builder - the builder to add columns and subselections to.
      • addInput

        public abstract void addInput​(Selector.InputRow input)
        Add the current value from the specified ResultSetBuilder.
        Parameters:
        input - the input row
        Throws:
        InvalidRequestException - if a problem occurs while adding the input row
      • getOutput

        public abstract java.nio.ByteBuffer getOutput​(ProtocolVersion protocolVersion)
                                               throws InvalidRequestException
        Returns the selector output.
        Parameters:
        protocolVersion - protocol version used for serialization
        Returns:
        the selector output
        Throws:
        InvalidRequestException - if a problem occurs while computing the output value
      • getWritetimes

        protected org.apache.cassandra.cql3.selection.ColumnTimestamps getWritetimes​(ProtocolVersion protocolVersion)
      • getTTLs

        protected org.apache.cassandra.cql3.selection.ColumnTimestamps getTTLs​(ProtocolVersion protocolVersion)
      • getType

        public abstract AbstractType<?> getType()
        Returns the Selector output type.
        Returns:
        the Selector output type.
      • reset

        public abstract void reset()
        Reset the internal state of this Selector.
      • validateForGroupBy

        public void validateForGroupBy()
        Checks that this selector is valid for GROUP BY clause.
      • serializedSize

        protected abstract int serializedSize​(int version)
      • serialize

        protected abstract void serialize​(DataOutputPlus out,
                                          int version)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeType

        protected static void writeType​(DataOutputPlus out,
                                        AbstractType<?> type)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • sizeOf

        protected static int sizeOf​(AbstractType<?> type)