Hi,
Any updates on this. Need to understand this behavior before
our release which is scheduled next month.
Thanks in advance.
From: PradeepKumar Yadav
Sent: Tuesday, April 17, 2018 6:41 PM
To: 'Jason Dere' <[email protected]>; [email protected]
Subject: RE: Hive Custom UDF evaluate behavior when @UDFType is set
Hi,
Attaching logs with changes.
hiveDeterministicFalseLog - log for testUdf with @UDFType(
deterministic = false )
hiveNoUDFTypeAnnotationLog - log for testUdf with no @UDFType
Annotation
Thanks
From: Jason Dere [mailto:[email protected]]
Sent: Monday, April 16, 2018 11:18 PM
To: PradeepKumar Yadav
<[email protected]<mailto:[email protected]>>;
[email protected]<mailto:[email protected]>
Subject: Re: Hive Custom UDF evaluate behavior when @UDFType is set
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
<[email protected]<mailto:[email protected]>>
Sent: Monday, April 16, 2018 4:53 AM
To: [email protected]<mailto:[email protected]>
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:[email protected]]
Sent: Wednesday, April 11, 2018 12:02 AM
To: [email protected]<mailto:[email protected]>
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
<[email protected]<mailto:[email protected]>>
Sent: Monday, April 9, 2018 11:35 PM
To: [email protected]<mailto:[email protected]>
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