-
Notifications
You must be signed in to change notification settings - Fork 541
[SYSTEMDS-3857] set get names on dataframes #2495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1cffaa2
94d7fad
2a2bb6f
cdb8d67
2aa0e6f
c6cfa26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2762,6 +2762,22 @@ else if ( in.length == 2 ) | |
| case TYPEOF: | ||
| case DET: | ||
| case DETECTSCHEMA: | ||
| case SET_NAMES: | ||
| currBuiltinOp = new BinaryOp( | ||
| target.getName(), | ||
| target.getDataType(), | ||
| target.getValueType(), | ||
| OpOp2.SET_COLNAMES, expr, expr2 | ||
| ); | ||
| break; | ||
|
Comment on lines
+2765
to
+2772
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of the above cases will now be mapped to a |
||
| case GET_NAMES: | ||
| currBuiltinOp = new UnaryOp( | ||
| target.getName(), | ||
| target.getDataType(), | ||
| target.getValueType(), | ||
| OpOp1.COLNAMES, expr | ||
| ); | ||
| break; | ||
| case COLNAMES: | ||
| currBuiltinOp = new UnaryOp(target.getName(), target.getDataType(), | ||
| target.getValueType(), OpOp1.valueOf(source.getOpCode().name()), expr); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -686,6 +686,8 @@ else if( opcode.equalsIgnoreCase(Opcodes.VALUESWAP.toString())) | |
| return new BinaryOperator(Builtin.getBuiltinFnObject("valueSwap")); | ||
| else if( opcode.equalsIgnoreCase(Opcodes.FREPLICATE.toString())) | ||
| return new BinaryOperator(Builtin.getBuiltinFnObject("freplicate")); | ||
| else if( opcode.equalsIgnoreCase(Opcodes.SET_COLNAMES.toString())) | ||
| return new BinaryOperator(Builtin.getBuiltinFnObject("set_colnames")); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this return a proper function object currently? |
||
|
|
||
| throw new RuntimeException("Unknown binary opcode " + opcode); | ||
| } | ||
|
|
@@ -923,6 +925,9 @@ else if ( opcode.equalsIgnoreCase(Opcodes.DROPINVALIDLENGTH.toString()) || opcod | |
| return new BinaryOperator(Builtin.getBuiltinFnObject("dropInvalidLength")); | ||
| else if ( opcode.equalsIgnoreCase(Opcodes.VALUESWAP.toString()) || opcode.equalsIgnoreCase("mapValueSwap") ) | ||
| return new BinaryOperator(Builtin.getBuiltinFnObject("valueSwap")); | ||
| //TODO: Check what "|| opcode.equalsIgnoreCase("mapValueSwap"))" does | ||
| else if (opcode.equalsIgnoreCase(Opcodes.SET_COLNAMES.toString()) || opcode.equalsIgnoreCase("mapValueSwap")) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should not be |
||
| return new BinaryOperator(Builtin.getBuiltinFnObject("set_colnames")); | ||
|
|
||
| throw new DMLRuntimeException("Unknown binary opcode " + opcode); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,28 @@ else if(getOpcode().equals(Opcodes.APPLYSCHEMA.toString())) { | |
| final int k = ((MultiThreadedOperator)_optr).getNumThreads(); | ||
| final FrameBlock out = FrameLibApplySchema.applySchema(inBlock1, inBlock2, k); | ||
| ec.setFrameOutput(output.getName(), out); | ||
| } | ||
| else if(getOpcode().equals(Opcodes.SET_COLNAMES.toString())) { | ||
|
|
||
| FrameBlock in = ec.getFrameInput(input1.getName()); | ||
| FrameBlock names = ec.getFrameInput(input2.getName()); | ||
|
|
||
| String[] colNames = new String[(int) names.getNumColumns()]; | ||
| for(int i = 0; i < colNames.length; i++){ | ||
| colNames[i] = names.get(0, i).toString(); | ||
| } | ||
|
Comment on lines
+71
to
+74
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No size/data validation happening |
||
|
|
||
| FrameBlock out = new FrameBlock(in); | ||
|
|
||
| out.setColumnNames(colNames); | ||
|
|
||
| ec.setFrameOutput(output.getName(), out); | ||
|
|
||
| ec.releaseFrameInput(input1.getName()); | ||
|
|
||
| ec.releaseFrameInput(input2.getName()); | ||
|
|
||
|
|
||
| } | ||
| else { | ||
| // Execute binary operations | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,14 @@ else if(getOpcode().equals(Opcodes.COLNAMES.toString())) { | |
| ec.releaseFrameInput(input1.getName()); | ||
| ec.setFrameOutput(output.getName(), retBlock); | ||
| } | ||
| //TODO: Check if new OPcode handling has to be implemented | ||
| else if(getOpcode().equals(Opcodes.COLNAMES.toString())) { | ||
| FrameBlock inBlock = ec.getFrameInput(input1.getName()); | ||
| FrameBlock retBlock = inBlock.getColumnNamesAsFrame(); | ||
| ec.releaseFrameInput(input1.getName()); | ||
| ec.setFrameOutput(output.getName(), retBlock); | ||
| } | ||
|
|
||
|
Comment on lines
+55
to
+62
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicate code, not needed. |
||
| else | ||
| throw new DMLScriptException("Opcode '" + getOpcode() + "' is not a valid UnaryFrameCPInstruction"); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setNamedoes not haveSTRINGas a return type