Package org.apache.calcite.sql.advise
Class SqlAdvisorGetHintsFunction
- java.lang.Object
-
- org.apache.calcite.sql.advise.SqlAdvisorGetHintsFunction
-
- All Implemented Interfaces:
Function
,ImplementableFunction
,TableFunction
public class SqlAdvisorGetHintsFunction extends java.lang.Object implements TableFunction, ImplementableFunction
Table function that returns completion hints for a given SQL statement.
-
-
Field Summary
Fields Modifier and Type Field Description private static Expression
ADVISOR
private static java.lang.reflect.Method
GET_COMPLETION_HINTS
private static CallImplementor
IMPLEMENTOR
private static java.util.List<FunctionParameter>
PARAMETERS
-
Constructor Summary
Constructors Constructor Description SqlAdvisorGetHintsFunction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Enumerable<SqlAdvisorHint>
getCompletionHints(SqlAdvisor advisor, java.lang.String sql, int pos)
Returns completion hints for a given SQL statement.java.lang.reflect.Type
getElementType(java.util.List<java.lang.Object> arguments)
Returns the row type of the table yielded by this function when applied to given arguments.CallImplementor
getImplementor()
Returns implementor that translates the function to linq4j expression.java.util.List<FunctionParameter>
getParameters()
Returns the parameters of this function.RelDataType
getRowType(RelDataTypeFactory typeFactory, java.util.List<java.lang.Object> arguments)
Returns the record type of the table yielded by this function when applied to given arguments.
-
-
-
Field Detail
-
ADVISOR
private static final Expression ADVISOR
-
GET_COMPLETION_HINTS
private static final java.lang.reflect.Method GET_COMPLETION_HINTS
-
IMPLEMENTOR
private static final CallImplementor IMPLEMENTOR
-
PARAMETERS
private static final java.util.List<FunctionParameter> PARAMETERS
-
-
Method Detail
-
getImplementor
public CallImplementor getImplementor()
Description copied from interface:ImplementableFunction
Returns implementor that translates the function to linq4j expression.- Specified by:
getImplementor
in interfaceImplementableFunction
- Returns:
- implementor that translates the function to linq4j expression.
-
getRowType
public RelDataType getRowType(RelDataTypeFactory typeFactory, java.util.List<java.lang.Object> arguments)
Description copied from interface:TableFunction
Returns the record type of the table yielded by this function when applied to given arguments. Only literal arguments are passed, non-literal are replaced with default values (null, 0, false, etc).- Specified by:
getRowType
in interfaceTableFunction
- Parameters:
typeFactory
- Type factoryarguments
- arguments of a function call (only literal arguments are passed, nulls for non-literal ones)- Returns:
- row type of the table
-
getElementType
public java.lang.reflect.Type getElementType(java.util.List<java.lang.Object> arguments)
Description copied from interface:TableFunction
Returns the row type of the table yielded by this function when applied to given arguments. Only literal arguments are passed, non-literal are replaced with default values (null, 0, false, etc).- Specified by:
getElementType
in interfaceTableFunction
- Parameters:
arguments
- arguments of a function call (only literal arguments are passed, nulls for non-literal ones)- Returns:
- element type of the table (e.g.
Object[].class
)
-
getParameters
public java.util.List<FunctionParameter> getParameters()
Description copied from interface:Function
Returns the parameters of this function.- Specified by:
getParameters
in interfaceFunction
- Returns:
- Parameters; never null
-
getCompletionHints
public static Enumerable<SqlAdvisorHint> getCompletionHints(SqlAdvisor advisor, java.lang.String sql, int pos)
Returns completion hints for a given SQL statement.Typically this is called from generated code (via
IMPLEMENTOR
).- Parameters:
advisor
- Advisor to produce completion hintssql
- SQL to completepos
- Cursor position in SQL- Returns:
- the table that contains completion hints for a given SQL statement
-
-