org.apache.calcite.adapter.enumerable.ReflectiveCallNotNullImplementor Java Examples

The following examples show how to use org.apache.calcite.adapter.enumerable.ReflectiveCallNotNullImplementor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TableFunctionImpl.java    From calcite with Apache License 2.0 6 votes vote down vote up
private static CallImplementor createImplementor(final Method method) {
  return RexImpTable.createImplementor(
      new ReflectiveCallNotNullImplementor(method) {
        public Expression implement(RexToLixTranslator translator,
            RexCall call, List<Expression> translatedOperands) {
          Expression expr = super.implement(translator, call,
              translatedOperands);
          final Class<?> returnType = method.getReturnType();
          if (QueryableTable.class.isAssignableFrom(returnType)) {
            Expression queryable = Expressions.call(
                Expressions.convert_(expr, QueryableTable.class),
                BuiltInMethod.QUERYABLE_TABLE_AS_QUERYABLE.method,
                Expressions.call(DataContext.ROOT,
                    BuiltInMethod.DATA_CONTEXT_GET_QUERY_PROVIDER.method),
                Expressions.constant(null, SchemaPlus.class),
                Expressions.constant(call.getOperator().getName(), String.class));
            expr = Expressions.call(queryable,
                BuiltInMethod.QUERYABLE_AS_ENUMERABLE.method);
          } else {
            expr = Expressions.call(expr,
                BuiltInMethod.SCANNABLE_TABLE_SCAN.method, DataContext.ROOT);
          }
          return expr;
        }
      }, NullPolicy.NONE, false);
}
 
Example #2
Source File: CollectionsFunctions.java    From mat-calcite-plugin with Apache License 2.0 4 votes vote down vote up
BaseImplementableFunction(Method method) {
    super(method);
    implementor = RexImpTable.createImplementor(new ReflectiveCallNotNullImplementor(method), NullPolicy.NONE, false);
}
 
Example #3
Source File: ScalarFunctionImpl.java    From calcite with Apache License 2.0 4 votes vote down vote up
private static CallImplementor createImplementor(final Method method) {
  final NullPolicy nullPolicy = getNullPolicy(method);
  return RexImpTable.createImplementor(
      new ReflectiveCallNotNullImplementor(method), nullPolicy, false);
}