use of org.apache.calcite.adapter.jdbc.JdbcRules.JdbcFilter 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));
}
use of org.apache.calcite.adapter.jdbc.JdbcRules.JdbcFilter in project hive by apache.
the class JDBCFilterPushDownRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
LOG.debug("JDBCFilterPushDown has been called");
final HiveFilter filter = call.rel(0);
final HiveJdbcConverter converter = call.rel(1);
Filter newHiveFilter = filter.copy(filter.getTraitSet(), converter.getInput(), filter.getCondition());
JdbcFilter newJdbcFilter = (JdbcFilter) JdbcFilterRule.create(converter.getJdbcConvention()).convert(newHiveFilter);
if (newJdbcFilter != null) {
RelNode converterRes = converter.copy(converter.getTraitSet(), Arrays.asList(newJdbcFilter));
call.transformTo(converterRes);
}
}
Aggregations