Skip to content

[SPARK-17884][SQL] To resolve Null pointer exception when casting from empty string to interval type #15479

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

Conversation

priyankagargnitk
Copy link

What changes were proposed in this pull request?

This change adds a check in castToInterval method of Cast expression , such that if converted value is null , then isNull variable should be set to true.

Earlier, the expression Cast(Literal(), CalendarIntervalType) was throwing NullPointerException because of the above mentioned reason.

How was this patch tested?

Added test case in CastSuite.scala

jira entry for detail: https://issues.apache.org/jira/browse/SPARK-17884

…m empty string to interval type.

## What changes were proposed in this pull request?
This change adds a check in castToInterval method of Cast expression , such that if converted value is null , then isNull variable should be set to true.

Earlier, the expression Cast(Literal(), CalendarIntervalType) was throwing NullPointerException because of the above mentioned reason.

## How was this patch tested?
Added test case in CastSuite.scala

jira entry for detail: https://issues.apache.org/jira/browse/SPARK-17884

Author: prigarg <prigarg@adobe.com>

Closes apache#15449 from priyankagargnitk/SPARK-17884.
@SparkQA
Copy link

SparkQA commented Oct 14, 2016

Test build #3341 has finished for PR 15479 at commit 6bdbe7d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rxin
Copy link
Contributor

rxin commented Oct 14, 2016

Thanks - merging. Can you close the ticket?

asfgit pushed a commit that referenced this pull request Oct 14, 2016
…m empty string to interval type

## What changes were proposed in this pull request?
This change adds a check in castToInterval method of Cast expression , such that if converted value is null , then isNull variable should be set to true.

Earlier, the expression Cast(Literal(), CalendarIntervalType) was throwing NullPointerException because of the above mentioned reason.

## How was this patch tested?
Added test case in CastSuite.scala

jira entry for detail: https://issues.apache.org/jira/browse/SPARK-17884

Author: prigarg <prigarg@adobe.com>

Closes #15479 from priyankagargnitk/cast_empty_string_bug.
zzcclp pushed a commit to zzcclp/spark that referenced this pull request Oct 17, 2016
…m empty string to interval type

## What changes were proposed in this pull request?
This change adds a check in castToInterval method of Cast expression , such that if converted value is null , then isNull variable should be set to true.

Earlier, the expression Cast(Literal(), CalendarIntervalType) was throwing NullPointerException because of the above mentioned reason.

## How was this patch tested?
Added test case in CastSuite.scala

jira entry for detail: https://issues.apache.org/jira/browse/SPARK-17884

Author: prigarg <prigarg@adobe.com>

Closes apache#15479 from priyankagargnitk/cast_empty_string_bug.

(cherry picked from commit 745c5e7)
@HyukjinKwon
Copy link
Member

@priyankagargnitk Could maybe we then close this?

@priyankagargnitk
Copy link
Author

Yeah.. closing this.

@priyankagargnitk priyankagargnitk deleted the cast_empty_string_bug branch October 28, 2016 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants