@Override public void onMatch(RelOptRuleCall call) { LOG.debug("JDBCSortPushDownRule has been called"); final HiveSortLimit sort = call.rel(0); final HiveJdbcConverter converter = call.rel(1); final RelNode input = call.rel(2); Sort newHiveSort = sort.copy(sort.getTraitSet(), input, sort.getCollation(), sort.getOffsetExpr(), sort.getFetchExpr()); JdbcSort newJdbcSort = (JdbcSort) new JdbcSortRule(converter.getJdbcConvention()).convert(newHiveSort, false); if (newJdbcSort != null) { RelNode converterRes = converter.copy(converter.getTraitSet(), Arrays.asList(newJdbcSort)); call.transformTo(converterRes); } }
/** * Converts a {@code Sort} into a {@code JdbcSort}. * * @param sort Sort operator to convert * @param convertInputTraits Whether to convert input to {@code sort}'s * JDBC convention * @return A new JdbcSort */ public RelNode convert(Sort sort, boolean convertInputTraits) { final RelTraitSet traitSet = sort.getTraitSet().replace(out); final RelNode input; if (convertInputTraits) { input = convert(sort.getInput(), traitSet); } else { input = sort.getInput(); } return new JdbcSort(sort.getCluster(), traitSet, input, sort.getCollation(), sort.offset, sort.fetch); } }
/** * Converts a {@code Sort} into a {@code JdbcSort}. * * @param sort Sort operator to convert * @param convertInputTraits Whether to convert input to {@code sort}'s * JDBC convention * @return A new JdbcSort */ public RelNode convert(Sort sort, boolean convertInputTraits) { final RelTraitSet traitSet = sort.getTraitSet().replace(out); final RelNode input; if (convertInputTraits) { input = convert(sort.getInput(), traitSet); } else { input = sort.getInput(); } return new JdbcSort(sort.getCluster(), traitSet, input, sort.getCollation(), sort.offset, sort.fetch); } }
public RelNode convert(RelNode rel) { return convert((Sort) rel, true); }
public RelNode convert(RelNode rel) { return convert((Sort) rel, true); }