/** * @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); } }