I'd suggested logging the stack trace of the call, the logs attached don't really give much information of where the calls are occurring during query compilation/execution.
Try logger.info("************Inside testUdf Initialize***************", new Exception("initialize"); ________________________________ From: PradeepKumar Yadav <pradeep.ya...@protegrity.com> Sent: Monday, April 16, 2018 4:53 AM To: user@hive.apache.org Cc: Jason Dere Subject: FW: Hive Custom UDF evaluate behavior when @UDFType is set Hi, Regarding the previous mail sent, I have attached following observation documents - 1. testUdfNoAnnotation.java - contains UDF code with no @UDFType annotation. 2. hive-default-No-annotation-log.txt - HiveServer2 logs after executing the UDF created through the above class 3. hive-default-udf-annotation.jpg - The beeline output after creating and executing UDF created through above class 4. testUdf.java - contains UDF code with no @UDFType( deterministic = false ) 5. hive-deterministic-false-log.txt - JobHistory logs after executing the UDF created through the above class 6. hive-deterministic-false.jpg - The beeline output after creating and executing UDF created through above class Thanks, PradeepKumar Yadav From: Jason Dere [mailto:jd...@hortonworks.com] Sent: Wednesday, April 11, 2018 12:02 AM To: user@hive.apache.org<mailto:user@hive.apache.org> Subject: Re: Hive Custom UDF evaluate behavior when @UDFType is set Might have to do with constant propagation because the function was listed as deterministic. You can try logging the stack trace during execution and pasting both stack traces here, may help give more clues as to what is going on. ________________________________ From: PradeepKumar Yadav <pradeep.ya...@protegrity.com<mailto:pradeep.ya...@protegrity.com>> Sent: Monday, April 9, 2018 11:35 PM To: user@hive.apache.org<mailto:user@hive.apache.org> Subject: Hive Custom UDF evaluate behavior when @UDFType is set Hi, Recently while creating a custom generic hive UDF I came across a different behavior for the Evaluate method. The custom UDF had a logic to increment the counter and write it to a file. Now when I execute it directly without involving any table it always returns an extra count i.e. 2. Now when I added some logs to inside the evaluate method I observed that the logs (sysout) were printed twice. Now on further research I came across the @UDFType annotation and found out that if we do not provide this annotation in our custom UDF, default value is deterministic true. When I provide this annotation in my custom UDF and set @UDFType( deterministic = false ), I observed that my logs were printed only once and my UDF was returning the accurate count i.e. 1 therefore implying my evaluate was called only once when @UDFType( deterministic = false ). Now I wanted to understand what is the connection between @UDFType and Evaluate method when UDF is invoked directly without a table. Note : When I invoke my UDF on a table I get the appropriate count even with @UDFType( deterministic = true ). Thanks in advance. :) Regards, PradeepKumar Yadav