-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-12258] [SQL] Hive Timestamp UDF is binded with '1969-12-31 15:59:59.999999' for null value #10249
Conversation
Can you add more details to explain why Hive Timestamp UDF is binded with '1969-12-31 15:59:59.999999' for null value? It looks weird to me and is diffrent from the primitive problems I fixed in that PR. For primitive types, there is no way to express |
Test build #47522 has finished for PR 10249 at commit
|
The timestamp is bound to this specific number because CodeGen uses -1L as its default (null) value for Timestamp (assuming that your timezone is GMT-8) |
I think the root cause is that the UDF does not handle null value for DateType/TimestampType/DecimalType correctly, we should pass |
Thank you for your comments! @cloud-fan @hvanhovell @davies After digging it further, I just realized BigDecimal does not have such an issue. In the def javaType(dt: DataType): String = dt match {
case BooleanType => JAVA_BOOLEAN
case ByteType => JAVA_BYTE
case ShortType => JAVA_SHORT
case IntegerType | DateType => JAVA_INT
case LongType | TimestampType => JAVA_LONG
case FloatType => JAVA_FLOAT In all the codegen codes, we do not have separate logic for processing Thank you again! |
test this please |
@gatorsmile Do we have other data types that still have this issue? |
Let me do more tests. Will let you know soon. |
test this please |
@gatorsmile @davies has a fix that should fix the problem fundamentally (#10259). You can take a look and try it out. |
Let me close it. Thanks! |
Test build #47547 has finished for PR 10249 at commit
|
This PR is for fixing the following test case:
If users use BigDecimal, Date and Timestamp in UDF, UDF returns null if the input is null.
@cloud-fan I just followed your PR #9770 and add three more types. Could you review this PR?
Thank you!