Package org.apache.calcite.schema.impl
Class TableFunctionImpl
- java.lang.Object
-
- org.apache.calcite.schema.impl.ReflectiveFunctionBase
-
- org.apache.calcite.schema.impl.TableFunctionImpl
-
- All Implemented Interfaces:
Function
,ImplementableFunction
,TableFunction
public class TableFunctionImpl extends ReflectiveFunctionBase implements TableFunction, ImplementableFunction
Implementation ofTableFunction
based on a method.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.calcite.schema.impl.ReflectiveFunctionBase
ReflectiveFunctionBase.ParameterListBuilder
-
-
Field Summary
Fields Modifier and Type Field Description private CallImplementor
implementor
-
Fields inherited from class org.apache.calcite.schema.impl.ReflectiveFunctionBase
method, parameters
-
-
Constructor Summary
Constructors Modifier Constructor Description private
TableFunctionImpl(java.lang.reflect.Method method, CallImplementor implementor)
Private constructor; usecreate(java.lang.Class<?>)
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private Table
apply(java.util.List<java.lang.Object> arguments)
static TableFunction
create(java.lang.Class<?> clazz)
Creates aTableFunctionImpl
from a class, looking for an "eval" method.static TableFunction
create(java.lang.Class<?> clazz, java.lang.String methodName)
Creates aTableFunctionImpl
from a class, looking for a method with a given name.static TableFunction
create(java.lang.reflect.Method method)
Creates aTableFunctionImpl
from a method.private static CallImplementor
createImplementor(java.lang.reflect.Method method)
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.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.-
Methods inherited from class org.apache.calcite.schema.impl.ReflectiveFunctionBase
builder, classHasPublicZeroArgsConstructor, findMethod, getParameters
-
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.schema.Function
getParameters
-
-
-
-
Field Detail
-
implementor
private final CallImplementor implementor
-
-
Constructor Detail
-
TableFunctionImpl
private TableFunctionImpl(java.lang.reflect.Method method, CallImplementor implementor)
Private constructor; usecreate(java.lang.Class<?>)
.
-
-
Method Detail
-
create
public static TableFunction create(java.lang.Class<?> clazz)
Creates aTableFunctionImpl
from a class, looking for an "eval" method. Returns null if there is no such method.
-
create
public static TableFunction create(java.lang.Class<?> clazz, java.lang.String methodName)
Creates aTableFunctionImpl
from a class, looking for a method with a given name. Returns null if there is no such method.
-
create
public static TableFunction create(java.lang.reflect.Method method)
Creates aTableFunctionImpl
from a method.
-
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
)
-
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.
-
createImplementor
private static CallImplementor createImplementor(java.lang.reflect.Method method)
-
apply
private Table apply(java.util.List<java.lang.Object> arguments)
-
-