All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.hadoop.hive.ql.ppd.OpWalkerInfo Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.hadoop.hive.ql.ppd;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.hadoop.hive.ql.exec.FilterOperator;
import org.apache.hadoop.hive.ql.exec.Operator;
import org.apache.hadoop.hive.ql.exec.ReduceSinkOperator;
import org.apache.hadoop.hive.ql.lib.NodeProcessorCtx;
import org.apache.hadoop.hive.ql.parse.ParseContext;
import org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc;
import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;
import org.apache.hadoop.hive.ql.plan.OperatorDesc;

/**
 * Context class for operator walker of predicate pushdown.
 */
public class OpWalkerInfo implements NodeProcessorCtx {
  /**
   * Operator to Pushdown Predicates Map. This keeps track of the final pushdown
   * predicates for each operator as you walk the Op Graph from child to parent
   */
  private final HashMap, ExprWalkerInfo>
    opToPushdownPredMap;
  private final ParseContext pGraphContext;
  private final List candidateFilterOps;
  // The following two maps required for traversing join branches to discover transitive propagation opportunities
  // over equijoin conditions:
  // Contains column expression desc referenced in all predicates associated to ReduceSink operators.
  private final Map> columnsInPredicates;
  // Contains equal column pairs in ReduceSinkOperator row schema.
  private final Map> equalities;

  public OpWalkerInfo(ParseContext pGraphContext) {
    this.pGraphContext = pGraphContext;
    opToPushdownPredMap = new HashMap, ExprWalkerInfo>();
    candidateFilterOps = new ArrayList();
    columnsInPredicates = new HashMap<>();
    equalities = new HashMap<>();
  }

  public ExprWalkerInfo getPrunedPreds(Operator op) {
    return opToPushdownPredMap.get(op);
  }

  public ExprWalkerInfo putPrunedPreds(Operator op,
      ExprWalkerInfo value) {
    return opToPushdownPredMap.put(op, value);
  }

  public ParseContext getParseContext() {
    return pGraphContext;
  }

  public List getCandidateFilterOps() {
    return candidateFilterOps;
  }

  public void addCandidateFilterOp(FilterOperator fop) {
    candidateFilterOps.add(fop);
  }

  public Map> getColumnsInPredicates() {
    return columnsInPredicates;
  }

  public Map> getEqualities() {
    return equalities;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy