Maybe your intention is the following: reflect("java.util.UUID", "randomUUID")
On Thu, Apr 3, 2014 at 2:33 AM, Szehon Ho <sze...@cloudera.com> wrote: > Hi, according to the description of the reflect UDF, you are trying to > call java.util.UUID.hashcode(uidString), which doesnt seem to be an > existing method on either java 6/7. > > http://docs.oracle.com/javase/7/docs/api/java/util/UUID.html#hashCode() > > Thanks > Szehon > > > > > On Wed, Apr 2, 2014 at 2:13 PM, Andy Srine <andy.sr...@gmail.com> wrote: > >> Hi guys, >> >> >> I am trying to use the reflect UDF for an UUID method and am getting an >> exception. I believe this function should be available in java 1.6.0_31 the >> system is running. >> >> >> select reflect("java.util.UUID", "hashCode", uid_str) my_uid, >> >> ... >> >> >> My suspicion is, this is because the hive column I am calling this on is >> a string and not an UUID. So I nested the reflects as shown below to go >> from a string to an UUID first and then to "hashCode" it. >> >> >> reflect("java.util.UUID", "hashCode", reflect("java.util.UUID", >> "fromString", uid_str)) my_uid, >> >> >> In either case, I always get the exception below though the row of data >> it prints has no null for the uid_str column. Any ideas? >> >> >> at >> org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:565) >> >> at org.apache.hadoop.hive.ql.exec.ExecMapper.map(ExecMapper.java:143) >> >> ... 8 more >> >> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: UDFReflect >> getMethod >> >> at >> org.apache.hadoop.hive.ql.udf.generic.GenericUDFReflect.evaluate(GenericUDFReflect.java:164) >> >> at >> org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator.evaluate(ExprNodeGenericFuncEvaluator.java:163) >> >> at >> org.apache.hadoop.hive.ql.exec.KeyWrapperFactory$ListKeyWrapper.getNewKey(KeyWrapperFactory.java:113) >> >> at >> org.apache.hadoop.hive.ql.exec.GroupByOperator.processOp(GroupByOperator.java:794) >> >> at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:474) >> >> at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:800) >> >> at >> org.apache.hadoop.hive.ql.exec.SelectOperator.processOp(SelectOperator.java:84) >> >> at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:474) >> >> at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:800) >> >> at >> org.apache.hadoop.hive.ql.exec.TableScanOperator.processOp(TableScanOperator.java:83) >> >> at org.apache.hadoop.hive.ql.exec.Operator.process(Operator.java:474) >> >> at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:800) >> >> at >> org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:548) >> >> ... 9 more >> >> Caused by: java.lang.NoSuchMethodException: java.util.UUID.hashCode(null) >> >> at java.lang.Class.getMethod(Class.java:1605) >> >> at >> org.apache.hadoop.hive.ql.udf.generic.GenericUDFReflect.evaluate(GenericUDFReflect.java:160) >> >> >> Thanks, >> >> Andy >> >> >> >