-
Notifications
You must be signed in to change notification settings - Fork 544
[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
Open
t99-i
wants to merge
7
commits into
apache:main
Choose a base branch
from
t99-i:SYSTEMDS-3857-set-get-names-on-dataframes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+626
−5
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1cffaa2
WIP: add setName and getName first basics
94d7fad
WIP:
2a2bb6f
WIP:
cdb8d67
Add column name propagation tests for cbind, rbind and slice
2aa0e6f
[SYSTEMDS-3857] Set/GetNames on Data Frames
c6cfa26
Merge branch 'main' into SYSTEMDS-3857-set-get-names-on-dataframes
t99-i 1a3d448
[SYSTEMDS-3857] Set/GetNames on Data Frames
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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,8 @@ 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")); | ||
| else if (opcode.equalsIgnoreCase(Opcodes.SET_COLNAMES.toString())) | ||
| return new BinaryOperator(Builtin.getBuiltinFnObject("set_colnames")); | ||
|
|
||
| throw new DMLRuntimeException("Unknown binary opcode " + opcode); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
|
|
||
| import org.apache.sysds.common.Opcodes; | ||
| import org.apache.sysds.runtime.controlprogram.context.ExecutionContext; | ||
| import org.apache.sysds.runtime.DMLRuntimeException; | ||
| import org.apache.sysds.runtime.frame.data.FrameBlock; | ||
| import org.apache.sysds.runtime.frame.data.lib.FrameLibApplySchema; | ||
| import org.apache.sysds.runtime.matrix.operators.BinaryOperator; | ||
|
|
@@ -62,6 +63,40 @@ 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()); | ||
|
|
||
| if (names == null) | ||
| throw new DMLRuntimeException("Column names cannot be null."); | ||
|
|
||
| if (names.getNumRows() != 1) | ||
| throw new DMLRuntimeException( | ||
| "Column names must be provided as a 1 x n frame."); | ||
|
|
||
| if (names.getNumColumns() != in.getNumColumns()) | ||
| throw new DMLRuntimeException( | ||
| "Expected " + in.getNumColumns() + | ||
| " column names but got " + names.getNumColumns()); | ||
|
|
||
| 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
+84
to
+87
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 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
All of the above cases will now be mapped to a
BinaryOpof typeSET_COLNAMES. This is incorrect and the reason why the tests fail (see for example: https://github.com/apache/systemds/actions/runs/27905840894/job/82663839671?pr=2495#step:3:3857).