@SuppressWarnings("unchecked")
  public final void initialize(Configuration hconf, ObjectInspector[] inputOIs)
      throws HiveException {

    this.done = false;
    this.runTimeNumRows = 0; // initializeOp can be overridden
    // Initializing data structures for vectorForward
    this.selected = new int[VectorizedRowBatch.DEFAULT_SIZE];
    if (state == State.INIT) {
      return;
    }

    this.configuration = hconf;
    if (!areAllParentsInitialized()) {
      return;
    }

    LOG.info("Initializing Operator: {}", this);

    if (inputOIs != null) {
      inputObjInspectors = inputOIs;
    }

    // while initializing so this need to be done here instead of constructor
    childOperatorsArray = new Operator[childOperators.size()];
    for (int i = 0; i < childOperatorsArray.length; i++) {
      childOperatorsArray[i] = childOperators.get(i);
    }
    multiChildren = childOperatorsArray.length > 1;
    childOperatorsTag = new int[childOperatorsArray.length];
    for (int i = 0; i < childOperatorsArray.length; i++) {
      List<Operator<? extends OperatorDesc>> parentOperators =
          childOperatorsArray[i].getParentOperators();
      childOperatorsTag[i] = parentOperators.indexOf(this);
      if (childOperatorsTag[i] == -1) {
        throw new HiveException("Hive internal error: cannot find parent in the child operator!");
      }
    }

    if (inputObjInspectors.length == 0) {
      throw new HiveException("Internal Error during operator initialization.");
    }

    // derived classes can set this to different object if needed
    outputObjInspector = inputObjInspectors[0];

    boolean isInitOk = false;
    try {
      initializeOp(hconf);
      // sanity checks
      if (!rootInitializeCalled
          || childOperatorsArray.length != childOperators.size()) {
        throw new AssertionError("Internal error during operator initialization");
      }

      LOG.debug("Initialization Done: {}", this);

      initializeChildren(hconf);
      isInitOk = true;
    } finally {
      // TODO: ugly hack because Java does not have dtors and Tez input
      // hangs on shutdown.
      if (!isInitOk) {
        cancelAsyncInitOps();
      }
    }

    LOG.debug("Initialization Done - Reset: {}", this);

    // let's wait on the async ops before continuing
    completeInitialization(asyncInitOperations);
  }
Initializes operators only if all parents have been initialized. Calls
operator specific initializer which then initializes child ops.

@param hconf
@param inputOIs
         input object inspector array indexes by tag id. null value is
         ignored.
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java