Search in sources :

Example 1 with JdbcSort

use of org.apache.calcite.adapter.jdbc.JdbcRules.JdbcSort in project hive by apache.

the class JDBCSortPushDownRule method onMatch.

@Override
public void onMatch(RelOptRuleCall call) {
    LOG.debug("JDBCSortPushDownRule has been called");
    final HiveSortLimit sort = call.rel(0);
    final HiveJdbcConverter converter = call.rel(1);
    RelNode node = (sort.fetch != null && RexLiteral.intValue(sort.fetch) == 0) ? new JdbcFilter(sort.getCluster(), sort.getTraitSet().replace(converter.getJdbcConvention()), converter.getInput(), call.builder().literal(false)) : new JdbcSort(sort.getCluster(), sort.getTraitSet().replace(converter.getJdbcConvention()), converter.getInput(), sort.getCollation(), sort.offset, sort.fetch);
    call.transformTo(converter.copy(converter.getTraitSet(), node));
}
Also used : JdbcSort(org.apache.calcite.adapter.jdbc.JdbcRules.JdbcSort) RelNode(org.apache.calcite.rel.RelNode) HiveJdbcConverter(org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter) HiveSortLimit(org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveSortLimit) JdbcFilter(org.apache.calcite.adapter.jdbc.JdbcRules.JdbcFilter)

Aggregations

JdbcFilter (org.apache.calcite.adapter.jdbc.JdbcRules.JdbcFilter)1 JdbcSort (org.apache.calcite.adapter.jdbc.JdbcRules.JdbcSort)1 RelNode (org.apache.calcite.rel.RelNode)1 HiveSortLimit (org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveSortLimit)1 HiveJdbcConverter (org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter)1