Search in sources :

Example 6 with HiveJdbcConverter

use of org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter in project hive by apache.

the class JDBCExtractJoinFilterRule method matches.

// ~ Methods ----------------------------------------------------------------
@Override
public boolean matches(RelOptRuleCall call) {
    final Join join = call.rel(0);
    final HiveJdbcConverter conv1 = call.rel(1);
    final HiveJdbcConverter conv2 = call.rel(2);
    if (!conv1.getJdbcDialect().equals(conv2.getJdbcDialect())) {
        return false;
    }
    return JDBCAbstractSplitFilterRule.canSplitFilter(join.getCondition(), conv1.getJdbcDialect());
}
Also used : HiveJoin(org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveJoin) Join(org.apache.calcite.rel.core.Join) HiveJdbcConverter(org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter)

Example 7 with HiveJdbcConverter

use of org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter in project hive by apache.

the class JDBCFilterPushDownRule method matches.

@Override
public boolean matches(RelOptRuleCall call) {
    final HiveFilter filter = call.rel(0);
    final HiveJdbcConverter converter = call.rel(1);
    RexNode cond = filter.getCondition();
    return JDBCRexCallValidator.isValidJdbcOperation(cond, converter.getJdbcDialect());
}
Also used : HiveJdbcConverter(org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter) HiveFilter(org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveFilter) RexNode(org.apache.calcite.rex.RexNode)

Example 8 with HiveJdbcConverter

use of org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter in project hive by apache.

the class JDBCProjectPushDownRule method matches.

@Override
public boolean matches(RelOptRuleCall call) {
    final HiveProject project = call.rel(0);
    final HiveJdbcConverter conv = call.rel(1);
    for (RexNode currProject : project.getProjects()) {
        if (!JDBCRexCallValidator.isValidJdbcOperation(currProject, conv.getJdbcDialect())) {
            return false;
        }
        if (!validDataType(conv.getJdbcDialect(), currProject)) {
            return false;
        }
    }
    return true;
}
Also used : HiveProject(org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveProject) HiveJdbcConverter(org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter) RexNode(org.apache.calcite.rex.RexNode)

Example 9 with HiveJdbcConverter

use of org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter 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)

Example 10 with HiveJdbcConverter

use of org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter in project hive by apache.

the class JDBCFilterJoinRule method matches.

@Override
public boolean matches(RelOptRuleCall call) {
    Filter filter = call.rel(0);
    Join join = call.rel(1);
    HiveJdbcConverter conv1 = call.rel(2);
    HiveJdbcConverter conv2 = call.rel(3);
    if (!conv1.getJdbcDialect().equals(conv2.getJdbcDialect())) {
        return false;
    }
    boolean visitorRes = JDBCRexCallValidator.isValidJdbcOperation(filter.getCondition(), conv1.getJdbcDialect());
    if (visitorRes) {
        return JDBCRexCallValidator.isValidJdbcOperation(join.getCondition(), conv1.getJdbcDialect());
    }
    return false;
}
Also used : Filter(org.apache.calcite.rel.core.Filter) HiveFilter(org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveFilter) HiveJoin(org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveJoin) Join(org.apache.calcite.rel.core.Join) HiveJdbcConverter(org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter)

Aggregations

HiveJdbcConverter (org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.jdbc.HiveJdbcConverter)16 RelNode (org.apache.calcite.rel.RelNode)5 RexNode (org.apache.calcite.rex.RexNode)4 HiveJoin (org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveJoin)4 Join (org.apache.calcite.rel.core.Join)3 HiveFilter (org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveFilter)3 DruidQuery (org.apache.calcite.adapter.druid.DruidQuery)2 JdbcFilter (org.apache.calcite.adapter.jdbc.JdbcRules.JdbcFilter)2 JdbcSort (org.apache.calcite.adapter.jdbc.JdbcRules.JdbcSort)2 InvalidRelException (org.apache.calcite.rel.InvalidRelException)2 Filter (org.apache.calcite.rel.core.Filter)2 JoinRelType (org.apache.calcite.rel.core.JoinRelType)2 HiveAggregate (org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveAggregate)2 HiveProject (org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveProject)2 HiveTableScan (org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveTableScan)2 HiveUnion (org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveUnion)2 ASTNode (org.apache.hadoop.hive.ql.parse.ASTNode)2 BigDecimal (java.math.BigDecimal)1 Collectors (java.util.stream.Collectors)1 JdbcAggregate (org.apache.calcite.adapter.jdbc.JdbcRules.JdbcAggregate)1