Implement writeObject and getObject for RealType and DoubleType#16209
Implement writeObject and getObject for RealType and DoubleType#16209yuanzhanhku wants to merge 1 commit intoprestodb:masterfrom
Conversation
With these util functions, we could remove some per function/operator specific implementations. This commit removes the ValueAccessor interfaces in ArrayNormalizeFunction.
highker
left a comment
There was a problem hiding this comment.
getObject or writeObject is actually not for primitive types. They are only for array, map, and row types. For primitive types, we always assume the caller knows the exact interface to call into on double, boolean, Slice, or long type. Of course, sometimes, the caller doesn't know; so we have helpers like readNativeValue and writeNativeValue to dispatch the underlying types.
In this case, readNativeValue or writeNativeValue could also be called to help a bit on the different type systems. But it won't provide the final readable values. The values returned are still in-memory representations. LiteralInterpreter has some helpers to do the decoding; but that is way beyond what is required in a function.
I would suggest discarding the patch. cc @kaikalur in case you find some other interesting util to workaround.
Thanks for looking into it, James. I will discard this patch. |
With these util functions, we could remove some per function/operator
specific implementations. This commit removes the ValueAccessor
interfaces in ArrayNormalizeFunction.
Test plan
Added unit tests in TestRealType and TestDoubleType. There are existing unit tests for ArrayNormalizeFunction.