Package org.apache.flink.api.common

Examples of org.apache.flink.api.common.InvalidProgramException


   *        FileDataSource that is checked.
   */
  private void checkFileDataSource(FileDataSourceBase<?> fileSource) {
    String path = fileSource.getFilePath();
    if (path == null) {
      throw new InvalidProgramException("File path of FileDataSource is null.");
    }
    if (path.length() == 0) {
      throw new InvalidProgramException("File path of FileDataSource is empty string.");
    }
   
    try {
      Path p = new Path(path);
      String scheme = p.toUri().getScheme();
     
      if (scheme == null) {
        throw new InvalidProgramException("File path \"" + path + "\" of FileDataSource has no file system scheme (like 'file:// or hdfs://').");
      }
    } catch (Exception e) {
      throw new InvalidProgramException("File path \"" + path + "\" of FileDataSource is an invalid path: " + e.getMessage());
    }
  }
View Full Code Here


      else if (c instanceof PartitionOperatorBase) {
        n = new PartitionNode((PartitionOperatorBase<?>) c);
      }
      else if (c instanceof PartialSolutionPlaceHolder) {
        if (this.parent == null) {
          throw new InvalidProgramException("It is currently not supported to create data sinks inside iterations.");
        }
       
        final PartialSolutionPlaceHolder<?> holder = (PartialSolutionPlaceHolder<?>) c;
        final BulkIterationBase<?> enclosingIteration = holder.getContainingBulkIteration();
        final BulkIterationNode containingIterationNode =
              (BulkIterationNode) this.parent.con2node.get(enclosingIteration);
       
        // catch this for the recursive translation of step functions
        BulkPartialSolutionNode p = new BulkPartialSolutionNode(holder, containingIterationNode);
        p.setDegreeOfParallelism(containingIterationNode.getDegreeOfParallelism());
        n = p;
      }
      else if (c instanceof WorksetPlaceHolder) {
        if (this.parent == null) {
          throw new InvalidProgramException("It is currently not supported to create data sinks inside iterations.");
        }
       
        final WorksetPlaceHolder<?> holder = (WorksetPlaceHolder<?>) c;
        final DeltaIterationBase<?, ?> enclosingIteration = holder.getContainingWorksetIteration();
        final WorksetIterationNode containingIterationNode =
              (WorksetIterationNode) this.parent.con2node.get(enclosingIteration);
       
        // catch this for the recursive translation of step functions
        WorksetNode p = new WorksetNode(holder, containingIterationNode);
        p.setDegreeOfParallelism(containingIterationNode.getDegreeOfParallelism());
        n = p;
      }
      else if (c instanceof SolutionSetPlaceHolder) {
        if (this.parent == null) {
          throw new InvalidProgramException("It is currently not supported to create data sinks inside iterations.");
        }
       
        final SolutionSetPlaceHolder<?> holder = (SolutionSetPlaceHolder<?>) c;
        final DeltaIterationBase<?, ?> enclosingIteration = holder.getContainingWorksetIteration();
        final WorksetIterationNode containingIterationNode =
View Full Code Here

    }
   
    public void checkJoinKeyFields(int[] keyFields) {
      int[] ssKeys = deltaIteration.keys.computeLogicalKeyPositions();
      if (!Arrays.equals(ssKeys, keyFields)) {
        throw new InvalidProgramException("The solution can only be joined/co-grouped with the same keys as the elements are identified with (here: " + Arrays.toString(ssKeys) + ").");
      }
    }
View Full Code Here

    if (input1 instanceof SolutionSetPlaceHolder) {
      if (keys1 instanceof ExpressionKeys) {
        int[] positions = ((ExpressionKeys<?>) keys1).computeLogicalKeyPositions();
        ((SolutionSetPlaceHolder<?>) input1).checkJoinKeyFields(positions);
      } else {
        throw new InvalidProgramException("Currently, the solution set may only be joined with using tuple field positions.");
      }
    }
    if (input2 instanceof SolutionSetPlaceHolder) {
      if (keys2 instanceof ExpressionKeys) {
        int[] positions = ((ExpressionKeys<?>) keys2).computeLogicalKeyPositions();
        ((SolutionSetPlaceHolder<?>) input2).checkJoinKeyFields(positions);
      } else {
        throw new InvalidProgramException("Currently, the solution set may only be joined with using tuple field positions.");
      }
    }

    this.keys1 = keys1;
    this.keys2 = keys2;
View Full Code Here

      String name = getName() != null ? getName() : function.getClass().getName();
      try {
        keys1.areCompatible(super.keys2);
      } catch(IncompatibleKeysException ike) {
        throw new InvalidProgramException("The types of the key fields do not match.", ike);
      }

      final JoinOperatorBase<?, ?, OUT, ?> translated;
     
      if (keys1 instanceof Keys.SelectorFunctionKeys
View Full Code Here

          returnType, hint);
    }

    @Override
    public JoinOperator<I1, I2, OUT> withConstantSetFirst(String... constantSetFirst) {
      throw new InvalidProgramException("The semantic properties (constant fields and forwarded fields) are automatically calculated.");
    }
View Full Code Here

      throw new InvalidProgramException("The semantic properties (constant fields and forwarded fields) are automatically calculated.");
    }

    @Override
    public JoinOperator<I1, I2, OUT> withConstantSetSecond(String... constantSetSecond) {
      throw new InvalidProgramException("The semantic properties (constant fields and forwarded fields) are automatically calculated.");
    }
View Full Code Here

        if (keys1 == null) {
          throw new NullPointerException();
        }
       
        if (keys1.isEmpty()) {
          throw new InvalidProgramException("The join keys must not be empty.");
        }
       
        this.keys1 = keys1;
      }
View Full Code Here

        if (keys2 == null) {
          throw new NullPointerException("The join keys may not be null.");
        }
       
        if (keys2.isEmpty()) {
          throw new InvalidProgramException("The join keys may not be empty.");
        }
       
        try {
          keys1.areCompatible(keys2);
        } catch (IncompatibleKeysException e) {
          throw new InvalidProgramException("The pair of join keys are not compatible with each other.",e);
        }

        return new DefaultJoin<I1, I2>(input1, input2, keys1, keys2, joinHint);
      }
View Full Code Here

   * is in fact a tuple type.
   */
  @Override
  public void setInputType(TypeInformation<?> type) {
    if (!type.isTupleType()) {
      throw new InvalidProgramException("The " + CsvOutputFormat.class.getSimpleName() +
        " can only be used to write tuple data sets.");
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.api.common.InvalidProgramException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.