Selector (apache-cassandra API)
Date: 2018-02-12

org.apache.cassandra.cql3.selection

## Class Selector

- java.lang.Object
- - org.apache.cassandra.cql3.selection.Selector

- All Implemented Interfaces:
    AssignmentTestable
  Direct Known Subclasses:
    SimpleSelector

      public abstract class Selector
      extends java.lang.Object
      implements AssignmentTestable

  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, `Selector`s cannot be called anymore by multiple threads as they have an internal state.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Selector.Factory` A factory for `Selector` instances.

    - ### Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.AssignmentTestable

      `AssignmentTestable.TestResult`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Selector()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `addInput(int protocolVersion, Selection.ResultSetBuilder rs)` Add the current value from the specified `ResultSetBuilder`.
    `abstract java.nio.ByteBuffer` | `getOutput(int protocolVersion)` Returns the selector output.
    `abstract AbstractType<?>` | `getType()` Returns the `Selector` output type.
    `boolean` | `isAggregate()` Checks if this `Selector` is creating aggregates.
    `abstract void` | `reset()` Reset the internal state of this `Selector`.
    `AssignmentTestable.TestResult` | `testAssignment(java.lang.String keyspace, ColumnSpecification receiver)`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### Selector

          public Selector()

  - ### Method Detail

    - #### addInput

          public abstract void addInput(int protocolVersion,
                                        Selection.ResultSetBuilder rs)
                                 throws InvalidRequestException

      Add the current value from the specified `ResultSetBuilder`.
      Parameters:
        `protocolVersion` - protocol version used for serialization
        `rs` - the `ResultSetBuilder`
      Throws:
        `InvalidRequestException` - if a problem occurs while add the input value

    - #### getOutput

          public abstract java.nio.ByteBuffer getOutput(int 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

    - #### getType

          public abstract AbstractType<?> getType()

      Returns the `Selector` output type.
      Returns:
        the `Selector` output type.

    - #### isAggregate

          public boolean isAggregate()

      Checks if this `Selector` is creating aggregates.
      Returns:
        `true` if this `Selector` is creating aggregates `false` otherwise.

    - #### reset

          public abstract void reset()

      Reset the internal state of this `Selector`.

    - #### testAssignment

          public final AssignmentTestable.TestResult testAssignment(java.lang.String keyspace,
                                                                    ColumnSpecification receiver)

      Specified by:
        `testAssignment` in interface `AssignmentTestable`
      Returns:
        whether this object can be assigned to the provided receiver. We distinguish between 3 values: - EXACT_MATCH if this object is exactly of the type expected by the receiver - WEAKLY_ASSIGNABLE if this object is not exactly the expected type but is assignable nonetheless - NOT_ASSIGNABLE if it's not assignable Most caller should just call the isAssignable() method on the result, though functions have a use for testing "strong" equality to decide the most precise overload to pick when multiple could match.

Copyright © 2018 The Apache Software Foundation