Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

JAVA SDK working with complex types in v11

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

Answers

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

  • moshegmosheg Administrator

    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

  • moshegmosheg Administrator

    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?

  • moshegmosheg Administrator

    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?

  • SruthiASruthiA Employee

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

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.