Class ReflectiveSqlOperatorTable

All Implemented Interfaces:
Direct Known Subclasses:
OracleSqlOperatorTable, SqlStdOperatorTable

public abstract class ReflectiveSqlOperatorTable extends Object implements SqlOperatorTable
ReflectiveSqlOperatorTable implements the SqlOperatorTable interface by reflecting the public fields of a subclass.
  • Field Details

    • IS_NAME

      public static final String IS_NAME
      See Also:
    • operators

      protected<String,SqlOperator> operators
      Contains all (name, operator) pairs. Effectively a sorted immutable multimap.

      There can be several operators with the same name (case-insensitive or case-sensitive) and these operators will lie in a contiguous range which we can find efficiently using binary search.

  • Constructor Details

    • ReflectiveSqlOperatorTable

      protected ReflectiveSqlOperatorTable()
  • Method Details

    • init

      public final SqlOperatorTable init()
      Performs post-constructor initialization of an operator table. It can't be part of the constructor, because the subclass constructor needs to complete first.
    • lookupOperatorOverloads

      public void lookupOperatorOverloads(SqlIdentifier opName, @Nullable SqlFunctionCategory category, SqlSyntax syntax, List<SqlOperator> operatorList, SqlNameMatcher nameMatcher)
      Description copied from interface: SqlOperatorTable
      Retrieves a list of operators with a given name and syntax. For example, by passing SqlSyntax.Function, the returned list is narrowed to only matching SqlFunction objects.
      Specified by:
      lookupOperatorOverloads in interface SqlOperatorTable
      opName - name of operator
      category - function category to look up, or null for any matching operator
      syntax - syntax type of operator
      operatorList - mutable list to which to append matches
      nameMatcher - Name matcher
    • register

      @Deprecated public void register(SqlOperator op)
      This table is designed to be initialized from the fields of a class, and adding operators is not efficient
      Registers a function or operator in the table.
    • getOperatorList

      public List<SqlOperator> getOperatorList()
      Description copied from interface: SqlOperatorTable
      Retrieves a list of all functions and operators in this table. Used for automated testing. Depending on the table type, may or may not be mutable.
      Specified by:
      getOperatorList in interface SqlOperatorTable
      list of SqlOperator objects
    • setOperators

      protected void setOperators(<String,SqlOperator> operators)
    • buildIndex

      protected static<String,SqlOperator> buildIndex(Iterable<? extends SqlOperator> operators)
      Derives a value to be assigned to operators from a given list of operators.
    • lookUpOperators

      protected void lookUpOperators(String name, boolean caseSensitive, Consumer<SqlOperator> consumer)
      Looks up operators, optionally matching case-sensitively.