Skip to content

Conversation

@kev-inn
Copy link
Contributor

@kev-inn kev-inn commented Aug 18, 2020

Adds decode support for recode, pass-through and composite (containing only those two).

return new FederatedResponse(ResponseType.ERROR, ex.getMessage());
return new FederatedResponse(ResponseType.ERROR, new FederatedWorkerHandlerException(
"Exception of type " + ex.getClass() + " thrown when processing request", ex));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ex.getMessage() would sometimes not suffice and instead be confusing. A ArrayIndexOutOfBoundsException would have for example just have the index as a message, therefore our response would just contain an arbitrary number and the problem would not be explained

Comment on lines 53 to -86
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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I formatted this file (sorry reviewer), but I think since those files are quite new we should start by abiding to our code style.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

protected void mergeColumnInfo(Encoder other, int col) {
// update number of columns
_clen = Math.max(_colList.length, col - 1 + other.getNumCols());
_clen = Math.max(_clen, col - 1 + other._clen);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was my mistake in the last PR _colList.length is something different to _clen and .getNumCols() will be wrong once we add dummycoding (it gives us the cols after encoding).

@kev-inn kev-inn changed the title [SYSTEMDS-2558][SYSTEMDS-2554][SYSTEMDS-2561] Fed frame recode transform (decode) support [SYSTEMDS-2558,2554,2561] Fed frame recode transform (decode) support Aug 20, 2020
@mboehm7
Copy link
Contributor

mboehm7 commented Aug 20, 2020

LGTM - thanks for the patch @kev-inn. Overall this is nice, I just made some minor modifications: (1) fixed the export in CacheableData which did not handle federated objects (it might have worked due to previous transfer to the coordinator by chance), (2) fixed the removed replace handling in parsing of parameterized builtin instructions, (3) generalized the improved exception handling from UDFs to instruction execution and clear commands, and (4) fixed a javadoc issue I introduced in a previous commit.

@asfgit asfgit closed this in 7eccbfe Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants