hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Lee <>
Subject Use Hive reflect() method to call non-static JDK fuctions
Date Tue, 19 Mar 2013 00:00:10 GMT
It's relatively straight forward to call static functions in JDK using
reflect.  For example,

select reflect("java.lang.Math", "max", 2, 3) from mytable limit 1;

However,  how do I use reflect to call non-static functions (e.g.,
indexOf() method in java.lang.String class)?
None of the following usage of reflect is correct.  Assuming that mytable
has column called text.

select text, reflect('java.lang.String', 'indexOf', 'school
today'), reflect('java.lang.String', 'indexOf', text, 'school
today'), reflect('java.lang.String', 'indexOf', 'school today', text)
from mytable
limit 1;

View raw message