In UDF, in the implemented evaluate(tuple,ptr) method, i could access the expression object of the columns passed to the UDF, by invoking getChildren.get(index). and then by invoking expression.evaluate(tuple,ptr), i can get the value copied to the ptr object. But, how do i access other elements of the tuple by passing its column name. I don't have access to the expression object of other columns in the select query within the UDF implementation method. Please suggest what we should do to get the value of other columns from the tuple by passing the column name.
CREATE TABLE TESTTABLE (ID VARCHAR, NAME VARCHAR, PREFIX VARCHAR)
CREATE FUNCTION MYFUNCTION(VARCHAR) RETURNS VARCHAR WITH 'com.test.CF
' using jar '/tmp/cf.jar'
SELECT ID,MYFUNCTION(NAME),PREFIX FROM TESTTABLE
MYFUNCTION - is expected to concatenate PREFIX columns value and the NAME columns value in each row.
In the evaluate method, as i pass the NAME column as argument to the function, i get the expression object of it by invoking nameExpr=getChildren.get(0) and then by invoking nameExpr.evaluate(tuple,ptr) i can have the value copied to ptr. In this case, is there a way to access the prefix columns value from the tuple, as its also present in the SELECT clause.