Package org.apache.calcite.sql.util
Class ReflectiveSqlOperatorTable
java.lang.Object
org.apache.calcite.sql.util.ReflectiveSqlOperatorTable
- All Implemented Interfaces:
SqlOperatorTable
- Direct Known Subclasses:
OracleSqlOperatorTable
,SqlStdOperatorTable
ReflectiveSqlOperatorTable implements the
SqlOperatorTable
interface
by reflecting the public fields of a subclass.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected com.google.common.collect.ImmutableMultimap<String,
SqlOperator> Contains all (name, operator) pairs. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static com.google.common.collect.ImmutableMultimap<String,
SqlOperator> buildIndex
(Iterable<? extends SqlOperator> operators) Derives a value to be assigned tooperators
from a given list of operators.Retrieves a list of all functions and operators in this table.final SqlOperatorTable
init()
Performs post-constructor initialization of an operator table.void
lookupOperatorOverloads
(SqlIdentifier opName, @Nullable SqlFunctionCategory category, SqlSyntax syntax, List<SqlOperator> operatorList, SqlNameMatcher nameMatcher) Retrieves a list of operators with a given name and syntax.protected void
lookUpOperators
(String name, boolean caseSensitive, Consumer<SqlOperator> consumer) Looks up operators, optionally matching case-sensitively.void
register
(SqlOperator op) Deprecated.This table is designed to be initialized from the fields of a class, and adding operators is not efficientprotected void
setOperators
(com.google.common.collect.Multimap<String, SqlOperator> operators) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.calcite.sql.SqlOperatorTable
getOperatorList
-
Field Details
-
IS_NAME
- See Also:
-
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
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 interfaceSqlOperatorTable
- Parameters:
opName
- name of operatorcategory
- function category to look up, or null for any matching operatorsyntax
- syntax type of operatoroperatorList
- mutable list to which to append matchesnameMatcher
- Name matcher
-
register
Deprecated.This table is designed to be initialized from the fields of a class, and adding operators is not efficientRegisters a function or operator in the table. -
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 interfaceSqlOperatorTable
- Returns:
- list of SqlOperator objects
-
setOperators
-
buildIndex
protected static com.google.common.collect.ImmutableMultimap<String,SqlOperator> buildIndex(Iterable<? extends SqlOperator> operators) Derives a value to be assigned tooperators
from a given list of operators. -
lookUpOperators
Looks up operators, optionally matching case-sensitively.
-