[
https://issues.jboss.org/browse/TEIID-4297?page=com.atlassian.jira.plugin...
]
JieRen JieRen edited comment on TEIID-4297 at 6/27/16 6:34 AM:
---------------------------------------------------------------
Hi Ramesh:
I am not sure whether I understand this task . I would like to show my steps that you can
check whether I am correct.
* Create Maskutil class
Create Maskutil class as above
* Install Module
Build Maskutil ,Install Maskutil module
* Define virtual function
Define virtual function in VDB deploy file.
----
<model name="VituralFunction" type="VIRTUAL">
<metadata type="DDL"><![CDATA[
CREATE VIRTUAL FUNCTION random(className string) RETURNS string OPTIONS (JAVA_CLASS
'org.teiid.Maskutil', JAVA_METHOD 'toRandomValue');
CREATE VIRTUAL FUNCTION hash(className string) RETURNS string OPTIONS (JAVA_CLASS
'org.teiid.Maskutil', JAVA_METHOD 'toHashValue');
CREATE VIRTUAL FUNCTION digit(className string) RETURNS string OPTIONS (JAVA_CLASS
'org.teiid.Maskutil', JAVA_METHOD 'toDigitValue');
]]> </metadata>
</model>
----
* Test UDF
~~~
mvn -s ../settings.xml exec:java -Dvdb="Portfolio" -Dsql="select * from
product where symbol=hash()" -Dusername="odataUser"
-Dpassword="password1!"
~~~
That's all.
If I don't get your point, please forgive me and describe this issue in detail. Thank
you a lot.
was (Author: jren):
Hi Ramesh:
I am not sure whether I understand this task . I would like to show my steps that you can
check whether I am correct.
* Create Maskutil class
Create Maskutil class as above
* Install Module
Build Maskutil ,Install Maskutil module
* Define virtual function
Define virtual function in VDB deploy file.
~~~
<model name="VituralFunction" type="VIRTUAL">
<metadata type="DDL"><![CDATA[
CREATE VIRTUAL FUNCTION random(className string) RETURNS string OPTIONS (JAVA_CLASS
'org.teiid.Maskutil', JAVA_METHOD 'toRandomValue');
CREATE VIRTUAL FUNCTION hash(className string) RETURNS string OPTIONS (JAVA_CLASS
'org.teiid.Maskutil', JAVA_METHOD 'toHashValue');
CREATE VIRTUAL FUNCTION digit(className string) RETURNS string OPTIONS (JAVA_CLASS
'org.teiid.Maskutil', JAVA_METHOD 'toDigitValue');
]]> </metadata>
</model>
~~~
* Test UDF
~~~
mvn -s ../settings.xml exec:java -Dvdb="Portfolio" -Dsql="select * from
product where symbol=hash()" -Dusername="odataUser"
-Dpassword="password1!"
~~~
That's all.
If I don't get your point, please forgive me and describe this issue in detail. Thank
you a lot.
Add UDF functions based on OSDQ for POC
---------------------------------------
Key: TEIID-4297
URL:
https://issues.jboss.org/browse/TEIID-4297
Project: Teiid
Issue Type: Enhancement
Components: Query Engine
Reporter: Ramesh Reddy
Assignee: JieRen JieRen
Fix For: 9.1
Please add following UDF functions to Teiid library based on maven module
http://search.maven.org/#search%7Cga%7C1%7Carrahtec
The UDF functions needs to from this class below
{code}
public class Maskutil {
/**
* @param a
* The string that need to randomize
* vivek singh' will become 'ihg vkeivh'
*/
public static String toRandomValue(String a) {
return ShuffleRTM.shuffleString(a);
}
/**
* @param a
* This function will retrun MD5 hashcode of the string
* @return String
*/
public static String toHashValue(String a) {
if (a == null)
return "d41d8cd98f00b204e9800998ecf8427e"; // null MD5 value
return ResultsetToRTM.getMD5(a).toString();
}
/**
* @param a
* This function will return digit characters of the string
* @return
*
*/
public static String toDigitValue(String a) {
return StringCaseFormatUtil.digitString(a);
}
}
{code}
for example Teiid should have UDF functions like
{code}
string random(string)
string hash(string)
string digit(string)
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)