Transport-Test: Expand test framework to allow creating structs with field names.#119
Open
mohit10verma wants to merge 6 commits intolinkedin:masterfrom
Open
Transport-Test: Expand test framework to allow creating structs with field names.#119mohit10verma wants to merge 6 commits intolinkedin:masterfrom
mohit10verma wants to merge 6 commits intolinkedin:masterfrom
Conversation
The current transport UDF test framework does not let us create and return structs with field names. To write tests, we use `AbstractStdUDFTest`. This class makes a `FunctionCall` which internally uses `TestTypeUtils`. `TestTypeUtils` creates struct using `TestTypeFactory` and `Row`. Currently `Row` which is used to represent structs in the test framework doesn't have a constructor that lets us create structs with field names. On the other hand, `TestTypeFactory` allows us to do this. So this is a gap in the test framework. This also shows up when paramaters of a `FunctionCall` are resolved in `GenericQueryExecutor::resolveStruct` method. This PR is a step towards allowing test writers to pass a list of string fieldNames along with the data when they want to create structs with data and field names.
ljfgem
reviewed
Jan 26, 2023
Contributor
ljfgem
left a comment
There was a problem hiding this comment.
Thanks @mohit10verma! Please add the unit test.
...ransportable-udfs-test-api/src/main/java/com/linkedin/transport/test/AbstractStdUDFTest.java
Outdated
Show resolved
Hide resolved
ljfgem
previously approved these changes
Jan 26, 2023
Contributor
ljfgem
left a comment
There was a problem hiding this comment.
LGTM, @wmoustafa do you want to take a look?
ljfgem
reviewed
Jan 27, 2023
...le-udfs-example-udfs/src/main/java/com/linkedin/transport/examples/DeleteFieldOfAStruct.java
Outdated
Show resolved
Hide resolved
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.
The current transport UDF test framework does not let us create and return structs with field names. To write tests, we use
AbstractStdUDFTest. This class makes aFunctionCallwhich internally usesTestTypeUtils.TestTypeUtilscreates struct usingTestTypeFactoryandRow. CurrentlyRowwhich is used to represent structs in the test framework doesn't have a constructor that lets us create structs with field names. On the other hand,TestTypeFactoryallows us to do this. So this is a gap in the test framework. This also shows up when paramaters of aFunctionCallare resolved inGenericQueryExecutor::resolveStructmethod. This PR is a step towards allowing test writers to pass a list of string fieldNames along with the data when they want to create structs with data and field names.