odps-sdk-impl/odps-mapred-bridge/src/main/java/com/aliyun/odps/mapred/bridge/utils/ValidatorFactory.java [406:461]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        throwException(ErrorCode.TOO_MANY_RESOURCE_ITEMS,
                       "Acturally " + String.valueOf(res.length));
      }
    }
  }

  static class PipelineValidtor implements Validator {

    private Pipeline pipeline;

    public PipelineValidtor(JobConf job) {
      this.pipeline = Pipeline.fromJobConf(job);
    }

    @Override
    public void validate() throws OdpsException {
      if (pipeline == null) {
        throwException(ErrorCode.ILLEGAL_CONFIG, "Pipeline not specified.");
      }
      if (pipeline.getNodeNum() == 0) {
        throwException(ErrorCode.ILLEGAL_CONFIG, "Pipeline is empty.");
      }
      if (pipeline.getFirstNode().getType().equals("reduce")) {
        throwException(ErrorCode.ILLEGAL_CONFIG, "First operator of pipeline must be mapper");
      }
      for (int i = 0; i < pipeline.getNodeNum(); i++) {
        if (i > 0 && pipeline.getNode(i).getType().equals("map")) {
          throwException(ErrorCode.ILLEGAL_CONFIG, "Operators after first node must be reducer");
        }
        if (i < pipeline.getNodeNum() - 1) {
          if (pipeline.getNode(i).getOutputKeySchema() == null) {
            throwException(ErrorCode.ILLEGAL_CONFIG, "Operator ouput key schema not set");
          }
          if (pipeline.getNode(i).getOutputValueSchema() == null) {
            throwException(ErrorCode.ILLEGAL_CONFIG, "Operator ouput value schema not set");
          }
        }
      }
      StringBuilder errorMsg = new StringBuilder();
      if (!validatePartitionColumns(pipeline, errorMsg)) {
        throwException(ErrorCode.ILLEGAL_CONFIG,
            "Key partition columns should be inside of output key columns. " + errorMsg);
      }
    }

    private boolean validatePartitionColumns(Pipeline pipeline, StringBuilder errorMsg) {
      TransformNode node = null;
      for (int i = 0; i < pipeline.getNodeNum() - 1; ++i) {
        node = pipeline.getNode(i);
        if (node.getPartitionerClass() == null
            && !validateColumns(node.getPartitionColumns(), node.getOutputKeySchema(), errorMsg)) {
          return false;
        }
      }

      return true;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



odps-sdk-impl/odps-mapred-local/src/main/java/com/aliyun/odps/mapred/local/utils/LocalValidatorFactory.java [328:383]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        throwException(ErrorCode.TOO_MANY_RESOURCE_ITEMS,
                       "Acturally " + String.valueOf(res.length));
      }
    }
  }

  static class PipelineValidtor implements Validator {

    private Pipeline pipeline;

    public PipelineValidtor(JobConf job) {
      this.pipeline = Pipeline.fromJobConf(job);
    }

    @Override
    public void validate() throws OdpsException {
      if (pipeline == null) {
        throwException(ErrorCode.ILLEGAL_CONFIG, "Pipeline not specified.");
      }
      if (pipeline.getNodeNum() == 0) {
        throwException(ErrorCode.ILLEGAL_CONFIG, "Pipeline is empty.");
      }
      if (pipeline.getFirstNode().getType().equals("reduce")) {
        throwException(ErrorCode.ILLEGAL_CONFIG, "First operator of pipeline must be mapper");
      }
      for (int i = 0; i < pipeline.getNodeNum(); i++) {
        if (i > 0 && pipeline.getNode(i).getType().equals("map")) {
          throwException(ErrorCode.ILLEGAL_CONFIG, "Operators after first node must be reducer");
        }
        if (i < pipeline.getNodeNum() - 1) {
          if (pipeline.getNode(i).getOutputKeySchema() == null) {
            throwException(ErrorCode.ILLEGAL_CONFIG, "Operator ouput key schema not set");
          }
          if (pipeline.getNode(i).getOutputValueSchema() == null) {
            throwException(ErrorCode.ILLEGAL_CONFIG, "Operator ouput value schema not set");
          }
        }
      }
      StringBuilder errorMsg = new StringBuilder();
      if (!validatePartitionColumns(pipeline, errorMsg)) {
        throwException(ErrorCode.ILLEGAL_CONFIG,
            "Key partition columns should be inside of output key columns. " + errorMsg);
      }
    }

    private boolean validatePartitionColumns(Pipeline pipeline, StringBuilder errorMsg) {
      TransformNode node = null;
      for (int i = 0; i < pipeline.getNodeNum() - 1; ++i) {
        node = pipeline.getNode(i);
        if (node.getPartitionerClass() == null
            && !validateColumns(node.getPartitionColumns(), node.getOutputKeySchema(), errorMsg)) {
          return false;
        }
      }

      return true;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



