Search in sources :

Example 1 with UnsupportedOperatorsVisitor

use of org.apache.drill.exec.planner.sql.parser.UnsupportedOperatorsVisitor in project drill by apache.

the class DefaultSqlHandler method validateNode.

private TypedSqlNode validateNode(SqlNode sqlNode) throws ValidationException, RelConversionException, ForemanSetupException {
    final SqlNode sqlNodeValidated = config.getConverter().validate(sqlNode);
    final TypedSqlNode typedSqlNode = new TypedSqlNode(sqlNodeValidated, config.getConverter().getOutputType(sqlNodeValidated));
    // Check if the unsupported functionality is used
    UnsupportedOperatorsVisitor visitor = UnsupportedOperatorsVisitor.createVisitor(context);
    try {
        sqlNodeValidated.accept(visitor);
    } catch (UnsupportedOperationException ex) {
        // If the exception due to the unsupported functionalities
        visitor.convertException();
        // If it is not, let this exception move forward to higher logic
        throw ex;
    }
    return typedSqlNode;
}
Also used : UnsupportedOperatorsVisitor(org.apache.drill.exec.planner.sql.parser.UnsupportedOperatorsVisitor) SqlNode(org.apache.calcite.sql.SqlNode) TypedSqlNode(org.apache.calcite.sql.TypedSqlNode) TypedSqlNode(org.apache.calcite.sql.TypedSqlNode)

Aggregations

SqlNode (org.apache.calcite.sql.SqlNode)1 TypedSqlNode (org.apache.calcite.sql.TypedSqlNode)1 UnsupportedOperatorsVisitor (org.apache.drill.exec.planner.sql.parser.UnsupportedOperatorsVisitor)1