public RDDFlatMapMMFunction(CacheType type, PartitionedBroadcastMatrix binput) {
      _type = type;
      _pbc = binput;

      // created operator for reuse
      AggregateOperator agg = new AggregateOperator(0, Plus.getPlusFnObject());
      _op = new AggregateBinaryOperator(Multiply.getMultiplyFnObject(), agg);
    }
  public CumulativeOffsetInstruction(byte in1, byte in2, byte out, String opcode, String istr) {
    super(null, in1, in2, out, istr);

    if ("bcumoffk+".equals(opcode)) {
      _bop = new BinaryOperator(Plus.getPlusFnObject());
      _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucumk+"));
    } else if ("bcumoff*".equals(opcode)) {
      _bop = new BinaryOperator(Multiply.getMultiplyFnObject());
      _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucum*"));
    } else if ("bcumoffmin".equals(opcode)) {
      _bop = new BinaryOperator(Builtin.getBuiltinFnObject("min"));
      _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucummin"));
    } else if ("bcumoffmax".equals(opcode)) {
      _bop = new BinaryOperator(Builtin.getBuiltinFnObject("max"));
      _uop = new UnaryOperator(Builtin.getBuiltinFnObject("ucummax"));
    }
  }
Exemplo n.º 3
0
  /**
   * @param str
   * @return
   * @throws DMLRuntimeException
   */
  public static PmmSPInstruction parseInstruction(String str) throws DMLRuntimeException {
    String parts[] = InstructionUtils.getInstructionPartsWithValueType(str);
    String opcode = InstructionUtils.getOpCode(str);

    if (opcode.equalsIgnoreCase(PMMJ.OPCODE)) {
      CPOperand in1 = new CPOperand(parts[1]);
      CPOperand in2 = new CPOperand(parts[2]);
      CPOperand nrow = new CPOperand(parts[3]);
      CPOperand out = new CPOperand(parts[4]);
      CacheType type = CacheType.valueOf(parts[5]);

      AggregateOperator agg = new AggregateOperator(0, Plus.getPlusFnObject());
      AggregateBinaryOperator aggbin =
          new AggregateBinaryOperator(Multiply.getMultiplyFnObject(), agg);
      return new PmmSPInstruction(aggbin, in1, in2, out, nrow, type, opcode, str);
    } else {
      throw new DMLRuntimeException(
          "PmmSPInstruction.parseInstruction():: Unknown opcode " + opcode);
    }
  }
  /**
   * @param str
   * @return
   * @throws DMLRuntimeException
   */
  public static MapmmSPInstruction parseInstruction(String str) throws DMLRuntimeException {
    String parts[] = InstructionUtils.getInstructionPartsWithValueType(str);
    String opcode = parts[0];

    if (opcode.equalsIgnoreCase(MapMult.OPCODE)) {
      CPOperand in1 = new CPOperand(parts[1]);
      CPOperand in2 = new CPOperand(parts[2]);
      CPOperand out = new CPOperand(parts[3]);
      CacheType type = CacheType.valueOf(parts[4]);
      boolean outputEmpty = Boolean.parseBoolean(parts[5]);
      SparkAggType aggtype = SparkAggType.valueOf(parts[6]);

      AggregateOperator agg = new AggregateOperator(0, Plus.getPlusFnObject());
      AggregateBinaryOperator aggbin =
          new AggregateBinaryOperator(Multiply.getMultiplyFnObject(), agg);
      return new MapmmSPInstruction(aggbin, in1, in2, out, type, outputEmpty, aggtype, opcode, str);
    } else {
      throw new DMLRuntimeException(
          "MapmmSPInstruction.parseInstruction():: Unknown opcode " + opcode);
    }
  }