TrinoFunction - new unit tests and some fixes for bugs using certain parameter types#24
TrinoFunction - new unit tests and some fixes for bugs using certain parameter types#24smcl wants to merge 2 commits intotrinodb:mainfrom
Conversation
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Sean McLemon | LOGEX.
|
|
I've added the email address these changes were made under to my GitHub account. |
|
@cla-bot check |
|
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
|
The cla-bot has been summoned, and re-checked this pull request! |
I wanted to do a little more than just ask questions (here and here) so I looked around the codebase to see if I could contribute anything. I noticed the TrinoFunction class was missing unit tests and drafted some.
In doing so I've observed that there are a handful of bugs:
catalog.myfunction("1", "2.0")rather thancatalog.myfunction(1, 2.0)):sbytebyteshortushortuintulongSystem.IntPtr/nintSystem.UIntPtr/uintdecimaltypes are quoted when they shouldn't beboolparameters are quoted as "true/false" rather than as 1/0 'bit' types (I am less certain of this one)This PR contains the following changes:
TrinoFunctionTests, many of which (four out of nine) failed with the existing implementation ofTrinoFunctionTrinoFunctionthat causes the tests to pass. I have adjusted it slightly because the existing implementation was slightly non-idiomatic - now usingforeach (var parameter in Parameters)rather thanfor (int i = 0; i < Parameters.Count; i++)for example.Before you begin think about merging this could someone please just double check that my assumptions below are correct:
booltyped params should be 1/0 rather than "true"/"false"TrinoFunctionin order to access the protectedBuildFunctionStatement()method rather than:IRecordExecutorFactoryinterface, injecting that on instantiation and testing alsoTrinoFunction.Execute(feels a bit unnecessarily "AbstractEnterpriseSingletonProxyFactory")