1 Reply Latest reply on Jul 27, 2017 9:20 AM by Ramesh Reddy

    Teiid embedded with UDF and UDAF

    Hend Amin Novice

      hello

      I am using teiid embedded and i have some slow queries, need to use java logic to enhance the performance.

       

      1- I have checked the documentation and found this:

      "The use of the zip lib for dependency loading is not enabled in Embedded." what does it mean ?

       

      2-I have tried to make a zip file as mentioned here: https://docs.jboss.org/author/display/TEIID/Dynamic+VDBs

      Dynamic VDBs - Teiid 9.0 (draft) - Project Documentation Editor

      My VDB looks like that:

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <vdb name="udf" version="1">

      <description>UDF VDB</description>

      <model name="custom-functions" type="VIRTUAL">

               <metadata type="DDL"><![CDATA[

                   CREATE VIRTUAL FUNCTION celsiusToFahrenheit(celsius decimal) RETURNS decimal OPTIONS (JAVA_CLASS 'pocUDF.TempConv',  JAVA_METHOD 'celsiusToFahrenheit'); ]]> </metadata>

          </model>

      </vdb>

      and the class file jar is attached,

       

      package org.something;

       

       

      public class TempConv

      {

         /**

         * Converts the given Celsius temperature to Fahrenheit, and returns the

         * value.

         * @param doubleCelsiusTemp

         * @return Fahrenheit

         */

         public static Double celsiusToFahrenheit(Double doubleCelsiusTemp)

         {

            if (doubleCelsiusTemp == null)

            {

               return null;

            }

            return (doubleCelsiusTemp)*9/5 + 32;

         }

      }

      i get exception:

      TEIID30387 Could not load UDF "celsiusToFahrenheit", since its invocation class "pocUDF.TempConv" could not be found.

      What did i miss?