0

I am using teiid-wildfly servers. I followed the user defined functions example provided in teiid documentation. Below is my vdb file. Please let me know if I need to import any additional properties to view/access user defined functions. Metadata URL(http://localhost:8080/odata4/UDFTest/JavaCall/$metadata) does not list user defined function and no error in the server log. I created jar file which contains TempConv file implementation and completed the setup under module directory.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vdb name="UDFTest" version="1">
<property name ="lib" value ="org.test"></property>
<model visible="true" name="JavaCall" type="VIRTUAL">
<metadata   type="DDL">
<![CDATA[
CREATE VIRTUAL FUNCTION celsiusToFahrenheit(celsius double) RETURNS double OPTIONS (JAVA_CLASS 'org.test.TempConv',  JAVA_METHOD 'celsiusToFahrenheit');
]]> </metadata>
</model>
</vdb>
     
AMITESH
  • 5
  • 2

1 Answers1

0

OData has a known issue with exposing functions: see https://issues.redhat.com/browse/TEIID-5736

The workaround would be to use a procedure instead.

Steven Hawkins
  • 538
  • 1
  • 4
  • 7
  • Thanks Steven Hawkins. If I use procedure then needs an implementation for the procedure body. Actual implementation in the java file, So please advice what to be implemented in the procedure body. CREATE VIRTUAL PROCEDURE celsiusToFahrenheit(celsius double) RETURNS double OPTIONS (JAVA_CLASS 'org.test.TempConv', JAVA_METHOD 'celsiusToFahrenheit'); Server.log error TEIID31081 Virtual Procedure JavaCall.celsiusToFahrenheit was not defined by a procedure body in model JavaCall.celsiusToFahrenheit – AMITESH Jan 08 '21 at 14:22
  • You would just have the procedure call the function: create virtual procedure celsiusToFahenheit(celsius double) returns double return functions.celsiusToFahrenheit(celsius);; – Steven Hawkins Jan 10 '21 at 15:26