Skip to content

Conversation

@mohit10verma
Copy link

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.

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.
Copy link
Contributor

@ljfgem ljfgem left a comment

Choose a reason for hiding this comment

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

Thanks @mohit10verma! Please add the unit test.

ljfgem
ljfgem previously approved these changes Jan 26, 2023
Copy link
Contributor

@ljfgem ljfgem left a comment

Choose a reason for hiding this comment

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

LGTM, @wmoustafa do you want to take a look?

@ljfgem ljfgem changed the title Expand test framework to allow creating structs with field names. Transport-Test: Expand test framework to allow creating structs with field names. Jan 27, 2023
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