use of com.hazelcast.jet.sql.impl.HazelcastSqlToRelConverter in project hazelcast by hazelcast.
the class QueryConverter method convert.
public QueryConvertResult convert(SqlNode node) {
SqlToRelConverter converter = new HazelcastSqlToRelConverter(viewExpander, validator, catalogReader, cluster, StandardConvertletTable.INSTANCE, CONFIG);
// 1. Perform initial conversion.
RelRoot root = converter.convertQuery(node, false, true);
// 2. Remove subquery expressions, converting them to Correlate nodes.
RelNode relNoSubqueries = rewriteSubqueries(root.project());
// 3. Perform decorrelation, i.e. rewrite a nested loop where the right side depends on the value of the left side,
// to a variation of joins, semijoins and aggregations, which could be executed much more efficiently.
// See "Unnesting Arbitrary Queries", Thomas Neumann and Alfons Kemper.
RelNode result = converter.decorrelate(node, relNoSubqueries);
// The bug is likely in decorrelation which produces LogicalAggregate with 0 output columns.
if (!hasNestedExists(root.rel)) {
result = converter.trimUnusedFields(true, result);
}
// 5. Collect original field names.
return new QueryConvertResult(result, Pair.right(root.fields));
}
Aggregations