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

The following examples show how to use org.apache.calcite.adapter.enumerable.ReflectiveCallNotNullImplementor. These examples are extracted from open source projects. 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 Project: calcite   Source File: TableFunctionImpl.java    License: 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 Project: mat-calcite-plugin   Source File: CollectionsFunctions.java    License: 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 Project: calcite   Source File: ScalarFunctionImpl.java    License: 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);
}