TrinoFunction - new unit tests and some fixes for bugs using certain parameter types #24
+156
−18
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.
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)
):sbyte
byte
short
ushort
uint
ulong
System.IntPtr
/nint
System.UIntPtr
/uint
decimal
types are quoted when they shouldn't bebool
parameters 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 ofTrinoFunction
TrinoFunction
that 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:
bool
typed params should be 1/0 rather than "true"/"false"TrinoFunction
in order to access the protectedBuildFunctionStatement()
method rather than:IRecordExecutorFactory
interface, injecting that on instantiation and testing alsoTrinoFunction.Execute
(feels a bit unnecessarily "AbstractEnterpriseSingletonProxyFactory")