JAVA SDK working with complex types in v11
BHIFP
Vertica Customer ✭
It looks like for UDx, one can use C++ SDK to read and write complex types, but I am not seeing such capability in Java.
Can u please confirm that is the case? If so, what is the plan and ETA for making it available?
Thanks
Tagged:
0
Answers
Complex Types are supported as mentioned here:
https://www.vertica.com/docs/11.1.x/HTML/Content/Authoring/ConnectingToVertica/ClientJDBC/ComplexTypesInJDBC.htm
thanks, is there an example for UDx in Java? Thanks
After you install Vertica check the files under /opt/vertica/sdk/examples
And /opt/vertica/sdk/examples/JavaUDx
There are also sql examples which use Java functions:
/opt/vertica/sdk/examples/JavaUDLFunctions.sql
/opt/vertica/sdk/examples/JavaFunctions.sql
See also this blog:
https://www.vertica.com/blog/using-java-udx-vertica/
Thanks, @mosheg. My question is really JAVA API for Complex type under UDTF setting.
In c++, one can read complex types through BlockReader, such as, Array::ArrayReader getArrayRef (size_t idx) const
however, in java, getArrayRef does not exist:
https://www.vertica.com/docs/11.1.x/HTML/CppSDK/class_vertica_1_1_block_reader.htm
https://www.vertica.com/docs/11.1.x/HTML/JavaSDK/classcom_1_1vertica_1_1sdk_1_1_block_reader.htm
Complex Types for C++ SDK is ready for use, but for Java SDK it's not available yet.
Complex Types for Python SDK will come sooner.
Do you have an ETA on JAVA SDK?
We don't have an ETA for that yet.
What is the ETA for python then?
For JAVA, is there anything a client can do to make the request, so it starts earlier?
@BHIFP : Sure. Please open a support case and mention share the details of using complex types with JAVA SDK. we can raise a request with Engineering and take it from there.
There is no need to wait for Vertica to release support for complex types in Java UDx API.
Idea is to cast arrays into varbinary and back, and pass to/from Java UDx varbinary instead arrays.
You can rather easy cast arrays back and forth to varbinary. It is done with type converting c++ UDx scalar function that takes one argument and return one, without value change, just change type array->varbinary.
Now, you can get array arguments in Java UDx as varbinary, by converting argument with help of c++ function. If you want to output result as array, output as varbinary, convert to array with help of same c++ function.
Performance of c++ type conversion function would be fine, especially in non-fenced mode. Java UDx is slow enough so you won't see difference with use of c++ type conversion functions and future native support of arrays in Java UDx.
Type converting arrays - varbinary in c++ are trivial, code can be done in couple hours.
Which version of Java 11 should I use?
You can use any recent Java version, and you'll need the JDBC driver v11.1 or later, which can be obtained here: https://www.vertica.com/download/vertica/client-drivers/
Sure thank you