use of org.apache.calcite.adapter.enumerable.CallImplementor in project beam by apache.
the class ZetaSqlScalarFunctionImpl method create.
/**
* Creates {@link org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.Function} from
* given method. When {@code eval} method does not suit, {@code null} is returned.
*
* @param method method that is used to implement the function
* @param functionGroup ZetaSQL function group identifier. Different function groups may have
* divergent translation paths.
* @return created {@link Function} or null
*/
public static Function create(Method method, String functionGroup, String jarPath) {
validateMethod(method);
CallImplementor implementor = createImplementor(method);
return new ZetaSqlScalarFunctionImpl(method, implementor, functionGroup, jarPath);
}
use of org.apache.calcite.adapter.enumerable.CallImplementor in project beam by apache.
the class ScalarFunctionImpl method create.
/**
* Creates {@link org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.schema.Function} from
* given method. When {@code eval} method does not suit, {@code null} is returned.
*
* @param method method that is used to implement the function
* @param jarPath Path to jar that contains the method.
* @return created {@link Function} or null
*/
public static Function create(Method method, String jarPath) {
validateMethod(method);
CallImplementor implementor = createImplementor(method);
return new ScalarFunctionImpl(method, implementor, jarPath);
}
use of org.apache.calcite.adapter.enumerable.CallImplementor in project calcite by apache.
the class TableFunctionImpl method create.
/**
* Creates a {@link TableFunctionImpl} from a method.
*/
public static TableFunction create(final Method method) {
if (!Modifier.isStatic(method.getModifiers())) {
Class clazz = method.getDeclaringClass();
if (!classHasPublicZeroArgsConstructor(clazz)) {
throw RESOURCE.requireDefaultConstructor(clazz.getName()).ex();
}
}
final Class<?> returnType = method.getReturnType();
if (!QueryableTable.class.isAssignableFrom(returnType) && !ScannableTable.class.isAssignableFrom(returnType)) {
return null;
}
CallImplementor implementor = createImplementor(method);
return new TableFunctionImpl(method, implementor);
}
Aggregations