[SYSTEMDS-3857] Set/GetNames on Data Frames#2281
Open
YenFuChen wants to merge 4 commits intoapache:mainfrom
Open
[SYSTEMDS-3857] Set/GetNames on Data Frames#2281YenFuChen wants to merge 4 commits intoapache:mainfrom
YenFuChen wants to merge 4 commits intoapache:mainfrom
Conversation
Contributor
|
Thanks @YenFuChen, for the changes. Can you please add a test with a dml script calling setNames and getNames? |
Author
|
Hi, The cause appears to be that the parser doesn't recognize these as builtin functions and instead tries to resolve them as user defined functions, which fails Can you confirm if I need to explicitly register these new built-ins in something like DmlSyntacticValidator.isBuiltinFunction() or another part of the parser? Thanks for your assistance. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
SYSTEMDS-3857: Set/Get Column Names
Brief Description
This PR adds two new DML builtin functions,
getNames()andsetNames(), to manage column names in Frame objects, addressing the need for programmatic column name manipulation in DML scripts.Detailed Description
This contribution enhances flexibility for working with
Frameobjects in DML scripts by providing programmatic access to their column names.The following changes have been implemented:
FrameBlock Class:
public FrameBlock getNames()method: Returns a single-rowFrameBlockwith current column names (default "C1", "C2", ... or user defined), based ongetColumnNamesAsFrame().public void setNames(FrameBlock names)method: Sets custom column names for theFrameBlock, with strict validation checking for null input, single-row requirement, and matching column count.DML Builtin Functions Integration:
getNamesandsetNamesas newBuiltinfunctions inBuiltinFunctionExpression, with integrated validation (e.g, type checking and argument count) during compilation to ensure correct usage in DML scripts.Testing
Unit tests are implemented in
org.apache.sysds.test.functions.builtin.BuiltinGetSetNamesTest.javato validate the correctness Covering:getNames()returns default names ("C1", "C2", ...).setNames()applies custom column names (e.g, 2 columns like "name", "age") andgetNames()retrieves them as expected.setNames():nullinput tosetNames().FrameBlockwith incorrect row count (e.g, 2 rows with 2 columns).Frame(e.g, 3 vs. 2 columns).Tests validate core functionality and pass successfully.