You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@systemds.apache.org by GitBox <gi...@apache.org> on 2020/08/20 19:57:16 UTC

[GitHub] [systemds] mboehm7 commented on a change in pull request #1027: [SYSTEMDS-2558,2554,2561] Fed frame recode transform (decode) support

mboehm7 commented on a change in pull request #1027:
URL: https://github.com/apache/systemds/pull/1027#discussion_r474238261



##########
File path: src/main/java/org/apache/sysds/runtime/instructions/fed/ParameterizedBuiltinFEDInstruction.java
##########
@@ -19,103 +19,217 @@
 
 package org.apache.sysds.runtime.instructions.fed;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
+
+import org.apache.sysds.common.Types;
 import org.apache.sysds.common.Types.DataType;
 import org.apache.sysds.common.Types.ValueType;
+import org.apache.sysds.hops.OptimizerUtils;
 import org.apache.sysds.lops.Lop;
 import org.apache.sysds.runtime.DMLRuntimeException;
+import org.apache.sysds.runtime.controlprogram.caching.FrameObject;
 import org.apache.sysds.runtime.controlprogram.caching.MatrixObject;
 import org.apache.sysds.runtime.controlprogram.context.ExecutionContext;
 import org.apache.sysds.runtime.controlprogram.federated.FederatedRequest;
-import org.apache.sysds.runtime.functionobjects.ParameterizedBuiltin;
-import org.apache.sysds.runtime.functionobjects.ValueFunction;
+import org.apache.sysds.runtime.controlprogram.federated.FederatedResponse;
+import org.apache.sysds.runtime.controlprogram.federated.FederatedUDF;
+import org.apache.sysds.runtime.controlprogram.federated.FederationMap;
 import org.apache.sysds.runtime.controlprogram.federated.FederationUtils;
+import org.apache.sysds.runtime.functionobjects.ValueFunction;
 import org.apache.sysds.runtime.instructions.InstructionUtils;
 import org.apache.sysds.runtime.instructions.cp.CPOperand;
+import org.apache.sysds.runtime.instructions.cp.Data;
+import org.apache.sysds.runtime.matrix.data.FrameBlock;
+import org.apache.sysds.runtime.matrix.data.MatrixBlock;
 import org.apache.sysds.runtime.matrix.operators.Operator;
-import org.apache.sysds.runtime.matrix.operators.SimpleOperator;
+import org.apache.sysds.runtime.meta.MatrixCharacteristics;
+import org.apache.sysds.runtime.meta.MetaDataFormat;
+import org.apache.sysds.runtime.privacy.PrivacyMonitor;
+import org.apache.sysds.runtime.transform.decode.Decoder;
+import org.apache.sysds.runtime.transform.decode.DecoderFactory;
 
 public class ParameterizedBuiltinFEDInstruction extends ComputationFEDInstruction {
-
 	protected final LinkedHashMap<String, String> params;
-	
-	protected ParameterizedBuiltinFEDInstruction(Operator op,
-		LinkedHashMap<String, String> paramsMap, CPOperand out, String opcode, String istr)
-	{
+
+	protected ParameterizedBuiltinFEDInstruction(Operator op, LinkedHashMap<String, String> paramsMap, CPOperand out,
+		String opcode, String istr) {
 		super(FEDType.ParameterizedBuiltin, op, null, null, out, opcode, istr);
 		params = paramsMap;
 	}
-	
-	public HashMap<String,String> getParameterMap() { 
-		return params; 
+
+	public HashMap<String, String> getParameterMap() {
+		return params;
 	}
-	
+
 	public String getParam(String key) {
 		return getParameterMap().get(key);
 	}
-	
+
 	public static LinkedHashMap<String, String> constructParameterMap(String[] params) {
 		// process all elements in "params" except first(opcode) and last(output)
-		LinkedHashMap<String,String> paramMap = new LinkedHashMap<>();
-		
+		LinkedHashMap<String, String> paramMap = new LinkedHashMap<>();
+
 		// all parameters are of form <name=value>
 		String[] parts;
-		for ( int i=1; i <= params.length-2; i++ ) {
+		for(int i = 1; i <= params.length - 2; i++) {
 			parts = params[i].split(Lop.NAME_VALUE_SEPARATOR);
 			paramMap.put(parts[0], parts[1]);
 		}
-		
+
 		return paramMap;
 	}
-	
-	public static ParameterizedBuiltinFEDInstruction parseInstruction ( String str ) {
+
+	public static ParameterizedBuiltinFEDInstruction parseInstruction(String str) {
 		String[] parts = InstructionUtils.getInstructionPartsWithValueType(str);
 		// first part is always the opcode
 		String opcode = parts[0];
 		// last part is always the output
-		CPOperand out = new CPOperand( parts[parts.length-1] ); 
-	
+		CPOperand out = new CPOperand(parts[parts.length - 1]);
+
 		// process remaining parts and build a hash map
-		LinkedHashMap<String,String> paramsMap = constructParameterMap(parts);
-	
+		LinkedHashMap<String, String> paramsMap = constructParameterMap(parts);
+
 		// determine the appropriate value function
 		ValueFunction func = null;
-		if( opcode.equalsIgnoreCase("replace") ) {
-			func = ParameterizedBuiltin.getParameterizedBuiltinFnObject(opcode);
-			return new ParameterizedBuiltinFEDInstruction(new SimpleOperator(func), paramsMap, out, opcode, str);

Review comment:
       don't worry about the formatting - more severe was the above deletion of the recently added replace. ;-)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org