How to make AnalyticPartitionWriter produce arbitrary fixed-point numeric data?
Anyone have any tips for outputing numerics (i.e. with precision and scale) from AnalyticPartitionWriter? It seems there is no setNumeric() method.
https://docs.vertica.com/24.4.x/sdkdocs/CppSDK/class_vertica_1_1_analytic_partition_writer.htm
I'm writing a UDx and it would be very handy to produce VNumerics. Instead I'm using floats which make me nervous. Seems Java has it... why not C++? Is there some other method?
Tagged:
0
Comments
You should be able to create a VNumeric and pass the pointer in the C++ SDK:
VNumeric * getColPtrForWrite (size_t idx)
Thanks. I'm struggling to get that function to work though, getting strange values like
1402984621720.88
. Probably I'm using it wrong. Do you have an example of how it should be used? Attaching a reproducer.Ok, figured it out with the help of
InvertedIndex.cpp
example from the SDK.Just to point out, conversions to/from string are outrageously expensive.
I remember solving problem, by creating var of required datatype, for example NUMERIC(10,2). Then, overriding 8-byte array with my value. That performs quite reasonable.