Skip to main content
Question

JAVA SDK working with complex types in v11

  • April 27, 2022
  • 13 replies
  • 15 views

BHIFP
Forum|alt.badge.img+1
  • Participating Frequently

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

13 replies

mosheg
Forum|alt.badge.img+2
  • Participating Frequently
  • April 27, 2022

BHIFP
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • April 27, 2022

thanks, is there an example for UDx in Java? Thanks


mosheg
Forum|alt.badge.img+2
  • Participating Frequently
  • April 27, 2022

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/


BHIFP
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • April 28, 2022

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


mosheg
Forum|alt.badge.img+2
  • Participating Frequently
  • April 28, 2022

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.


BHIFP
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • April 28, 2022

Do you have an ETA on JAVA SDK?


mosheg
Forum|alt.badge.img+2
  • Participating Frequently
  • April 28, 2022

We don't have an ETA for that yet.


BHIFP
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • April 28, 2022

What is the ETA for python then?

For JAVA, is there anything a client can do to make the request, so it starts earlier?


SruthiA
Forum|alt.badge.img+1
  • Participating Frequently
  • April 28, 2022

@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.


Sergey_Cherepan_1
Forum|alt.badge.img+2

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.


KennethAman
  • New Participant
  • November 8, 2022

Which version of Java 11 should I use?


Bryan_H
Forum|alt.badge.img+2
  • Participating Frequently
  • November 8, 2022

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/


KennethAman
  • New Participant
  • November 8, 2022

@Bryan_H said:
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