Search in sources :

Example 1 with TableFunctionImpl

use of org.apache.calcite.schema.impl.TableFunctionImpl in project calcite by apache.

the class EnumerableTableFunctionScan method isQueryable.

private boolean isQueryable() {
    if (!(getCall() instanceof RexCall)) {
        return false;
    }
    final RexCall call = (RexCall) getCall();
    if (!(call.getOperator() instanceof SqlUserDefinedTableFunction)) {
        return false;
    }
    final SqlUserDefinedTableFunction udtf = (SqlUserDefinedTableFunction) call.getOperator();
    if (!(udtf.getFunction() instanceof TableFunctionImpl)) {
        return false;
    }
    final TableFunctionImpl tableFunction = (TableFunctionImpl) udtf.getFunction();
    final Method method = tableFunction.method;
    return QueryableTable.class.isAssignableFrom(method.getReturnType());
}
Also used : RexCall(org.apache.calcite.rex.RexCall) SqlUserDefinedTableFunction(org.apache.calcite.sql.validate.SqlUserDefinedTableFunction) TableFunctionImpl(org.apache.calcite.schema.impl.TableFunctionImpl) Method(java.lang.reflect.Method)

Aggregations

Method (java.lang.reflect.Method)1 RexCall (org.apache.calcite.rex.RexCall)1 TableFunctionImpl (org.apache.calcite.schema.impl.TableFunctionImpl)1 SqlUserDefinedTableFunction (org.apache.calcite.sql.validate.SqlUserDefinedTableFunction)1