Package org.apache.flink.compiler

Examples of org.apache.flink.compiler.CompilerException


    if (in1 instanceof SinkPlanNode) {
      sinks.add((SinkPlanNode) in1);
    } else if (in1 instanceof SinkJoinerPlanNode) {
      ((SinkJoinerPlanNode) in1).getDataSinks(sinks);
    } else {
      throw new CompilerException("Illegal child node for a sink joiner utility node: Neither Sink nor Sink Joiner");
    }
   
    if (in2 instanceof SinkPlanNode) {
      sinks.add((SinkPlanNode) in2);
    } else if (in2 instanceof SinkJoinerPlanNode) {
      ((SinkJoinerPlanNode) in2).getDataSinks(sinks);
    } else {
      throw new CompilerException("Illegal child node for a sink joiner utility node: Neither Sink nor Sink Joiner");
    }
  }
View Full Code Here


      } else if (Key.class.isAssignableFrom(type)) {
        @SuppressWarnings("unchecked")
        Class<? extends Key<?>> keyType = (Class<? extends Key<?>>) type;
        keyTypes[i] = keyType;
      } else {
        throw new CompilerException("The field type " + type.getName() +
            " cannot be used as a key because it does not implement the interface 'Key'");
      }
    }
   
    return keyTypes;
View Full Code Here

    int[] localPositions1 = contract.getKeyColumns(0);
    int[] localPositions2 = contract.getKeyColumns(1);
    Class<? extends Key<?>>[] types = recContract.getKeyClasses();
   
    if (localPositions1.length != localPositions2.length) {
      throw new CompilerException("Error: The keys for the first and second input have a different number of fields.");
    }
   
    for (int i = 0; i < localPositions1.length; i++) {
      input1Schema.addType(localPositions1[i], types[i]);
    }
View Full Code Here

          break;
        case PARTITION_FORCED_REBALANCE:
          this.globalProps.setForcedRebalanced();
          break;
        case NONE:
          throw new CompilerException("Cannot produce GlobalProperties before ship strategy is set.");
      }
    }
   
    return this.globalProps;
  }
View Full Code Here

        case SORT:
        case COMBININGSORT:
          this.localProps = LocalProperties.forOrdering(Utils.createOrdering(this.localKeys, this.localSortOrder));
          break;
        default:
          throw new CompilerException("Unsupported local strategy for channel.");
      }
    }
   
    return this.localProps;
  }
View Full Code Here

    }
    else if (node instanceof BulkIterationPlanNode) {
      BulkIterationPlanNode iterationNode = (BulkIterationPlanNode) node;

      if (iterationNode.getRootOfStepFunction() instanceof NAryUnionPlanNode) {
        throw new CompilerException("Optimizer cannot compile an iteration step function where next partial solution is created by a Union node.");
      }
     
      // traverse the termination criterion for the first time. create schema only, no utilities. Needed in case of intermediate termination criterion
      if (iterationNode.getRootOfTerminationCriterion() != null) {
        SingleInputPlanNode addMapper = (SingleInputPlanNode) iterationNode.getRootOfTerminationCriterion();
        traverseChannel(addMapper.getInput());
      }

      BulkIterationBase<?> operator = (BulkIterationBase<?>) iterationNode.getPactContract();

      // set the serializer
      iterationNode.setSerializerForIterationChannel(createSerializer(operator.getOperatorInfo().getOutputType()));

      // done, we can now propagate our info down
      traverseChannel(iterationNode.getInput());
      traverse(iterationNode.getRootOfStepFunction());
    }
    else if (node instanceof WorksetIterationPlanNode) {
      WorksetIterationPlanNode iterationNode = (WorksetIterationPlanNode) node;
     
      if (iterationNode.getNextWorkSetPlanNode() instanceof NAryUnionPlanNode) {
        throw new CompilerException("Optimizer cannot compile a workset iteration step function where the next workset is produced by a Union node.");
      }
      if (iterationNode.getSolutionSetDeltaPlanNode() instanceof NAryUnionPlanNode) {
        throw new CompilerException("Optimizer cannot compile a workset iteration step function where the solution set delta is produced by a Union node.");
      }
     
      DeltaIterationBase<?, ?> operator = (DeltaIterationBase<?, ?>) iterationNode.getPactContract();
     
      // set the serializers and comparators for the workset iteration
View Full Code Here

      // that way, later FORWARDS are more expensive than earlier forwards.
      // Note that this only applies to the heuristic costs.
     
      switch (channel.getShipStrategy()) {
      case NONE:
        throw new CompilerException(
          "Cannot determine costs: Shipping strategy has not been set for an input.");
      case FORWARD:
//        costs.addHeuristicNetworkCost(channel.getMaxDepth());
        break;
      case PARTITION_RANDOM:
        addRandomPartitioningCost(channel, costs);
        break;
      case PARTITION_HASH:
        addHashPartitioningCost(channel, costs);
        break;
      case PARTITION_RANGE:
        addRangePartitionCost(channel, costs);
        break;
      case BROADCAST:
        addBroadcastCost(channel, channel.getReplicationFactor(), costs);
        break;
      case PARTITION_FORCED_REBALANCE:
        addRandomPartitioningCost(channel, costs);
        break;
      default:
        throw new CompilerException("Unknown shipping strategy for input: " + channel.getShipStrategy());
      }
     
      switch (channel.getLocalStrategy()) {
      case NONE:
        break;
      case SORT:
      case COMBININGSORT:
        addLocalSortCost(channel, costs);
        break;
      default:
        throw new CompilerException("Unsupported local strategy for input: " + channel.getLocalStrategy());
      }
     
      if (channel.getTempMode() != null && channel.getTempMode() != TempMode.NONE) {
        addArtificialDamCost(channel, 0, costs);
      }
     
      // adjust with the cost weight factor
      if (channel.isOnDynamicPath()) {
        costs.multiplyWith(channel.getCostWeight());
      }
     
      totalCosts.addCosts(costs);
    }
   
    Channel firstInput = null;
    Channel secondInput = null;
    Costs driverCosts = new Costs();
    int costWeight = 1;
   
    // adjust with the cost weight factor
    if (n.isOnDynamicPath()) {
      costWeight = n.getCostWeight();
    }
   
    // get the inputs, if we have some
    {
      Iterator<Channel> channels = n.getInputs().iterator();
      if (channels.hasNext()) {
        firstInput = channels.next();
      }
      if (channels.hasNext()) {
        secondInput = channels.next();
      }
    }

    // determine the local costs
    switch (n.getDriverStrategy()) {
    case NONE:
    case UNARY_NO_OP:
    case BINARY_NO_OP: 
    case COLLECTOR_MAP:
    case MAP:
    case MAP_PARTITION:
    case FLAT_MAP:
     
    case ALL_GROUP_REDUCE:
    case ALL_REDUCE:
      // this operations does not do any actual grouping, since every element is in the same single group
     
    case CO_GROUP:
    case SORTED_GROUP_REDUCE:
    case SORTED_REDUCE:
      // grouping or co-grouping over sorted streams for free
     
    case SORTED_GROUP_COMBINE:
      // partial grouping is always local and main memory resident. we should add a relative cpu cost at some point
   
    case UNION:
      // pipelined local union is for free
     
      break;
    case MERGE:
      addLocalMergeCost(firstInput, secondInput, driverCosts, costWeight);
      break;
    case HYBRIDHASH_BUILD_FIRST:
      addHybridHashCosts(firstInput, secondInput, driverCosts, costWeight);
      break;
    case HYBRIDHASH_BUILD_SECOND:
      addHybridHashCosts(secondInput, firstInput, driverCosts, costWeight);
      break;
    case HYBRIDHASH_BUILD_FIRST_CACHED:
      addCachedHybridHashCosts(firstInput, secondInput, driverCosts, costWeight);
      break;
    case HYBRIDHASH_BUILD_SECOND_CACHED:
      addCachedHybridHashCosts(secondInput, firstInput, driverCosts, costWeight);
      break;
    case NESTEDLOOP_BLOCKED_OUTER_FIRST:
      addBlockNestedLoopsCosts(firstInput, secondInput, availableMemory, driverCosts, costWeight);
      break;
    case NESTEDLOOP_BLOCKED_OUTER_SECOND:
      addBlockNestedLoopsCosts(secondInput, firstInput, availableMemory, driverCosts, costWeight);
      break;
    case NESTEDLOOP_STREAMED_OUTER_FIRST:
      addStreamedNestedLoopsCosts(firstInput, secondInput, availableMemory, driverCosts, costWeight);
      break;
    case NESTEDLOOP_STREAMED_OUTER_SECOND:
      addStreamedNestedLoopsCosts(secondInput, firstInput, availableMemory, driverCosts, costWeight);
      break;
    default:
      throw new CompilerException("Unknown local strategy: " + n.getDriverStrategy().name());
    }
   
    totalCosts.addCosts(driverCosts);
    n.setCosts(totalCosts);
  }
View Full Code Here

    } else if (dirs.length > numFields) {
      final boolean[] subSet = new boolean[numFields];
      System.arraycopy(dirs, 0, subSet, 0, numFields);
      return subSet;
    } else {
      throw new CompilerException();
    }
  }
View Full Code Here

        if(rootOfStepFunction.branchPlan != null){
          selectedCandidate = rootOfStepFunction.branchPlan.get(brancher);
        }

        if (selectedCandidate == null) {
          throw new CompilerException(
              "Candidates for a node with open branches are missing information about the selected candidate ");
        }

        this.branchPlan.put(brancher, selectedCandidate);
      }
View Full Code Here

      return props.getPartitioning() == PartitioningProperty.RANGE_PARTITIONED &&
          props.matchesOrderedPartitioning(this.ordering);
    } else if (this.partitioning == PartitioningProperty.FORCED_REBALANCED) {
      return props.getPartitioning() == PartitioningProperty.FORCED_REBALANCED;
    } else {
      throw new CompilerException("Bug in properties matching logic.");
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.compiler.CompilerException

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.