Search in sources :

Example 1 with UnsupportedOperationVisitor

use of com.hazelcast.jet.sql.impl.validate.UnsupportedOperationVisitor in project hazelcast by hazelcast.

the class QueryParser method parse0.

private QueryParseResult parse0(String sql) throws SqlParseException {
    SqlParser parser = SqlParser.create(sql, CONFIG);
    SqlNodeList statements = parser.parseStmtList();
    if (statements.size() != 1) {
        throw QueryException.error(SqlErrorCode.PARSING, "The command must contain a single statement");
    }
    SqlNode topNode = statements.get(0);
    SqlNode node = validator.validate(topNode);
    SqlVisitor<Void> visitor = new UnsupportedOperationVisitor();
    node.accept(visitor);
    return new QueryParseResult(node, new QueryParameterMetadata(validator.getParameterConverters(node)), validator.isInfiniteRows());
}
Also used : UnsupportedOperationVisitor(com.hazelcast.jet.sql.impl.validate.UnsupportedOperationVisitor) HazelcastSqlParser(com.hazelcast.jet.sql.impl.calcite.parser.HazelcastSqlParser) SqlParser(org.apache.calcite.sql.parser.SqlParser) SqlNodeList(org.apache.calcite.sql.SqlNodeList) QueryParameterMetadata(com.hazelcast.sql.impl.QueryParameterMetadata) SqlNode(org.apache.calcite.sql.SqlNode)

Aggregations

HazelcastSqlParser (com.hazelcast.jet.sql.impl.calcite.parser.HazelcastSqlParser)1 UnsupportedOperationVisitor (com.hazelcast.jet.sql.impl.validate.UnsupportedOperationVisitor)1 QueryParameterMetadata (com.hazelcast.sql.impl.QueryParameterMetadata)1 SqlNode (org.apache.calcite.sql.SqlNode)1 SqlNodeList (org.apache.calcite.sql.SqlNodeList)1 SqlParser (org.apache.calcite.sql.parser.SqlParser)1