Skip to content

Conversation

@rahulsmahadev
Copy link
Contributor

@rahulsmahadev rahulsmahadev commented Oct 18, 2019

What changes were proposed in this pull request?

  • Adding an additional check in stringToTimestamp to handle cases where the input has trailing ':'
  • Added a test to make sure this works.

Why are the changes needed?

In a couple of scenarios while converting from String to Timestamp DateTimeUtils.stringToTimestamp throws an array out of bounds exception if there is trailing ':'. The behavior of this method requires it to return None in case the format of the string is incorrect.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Added a test in the DateTimeTestUtils suite to test if my fix works.

@rahulsmahadev
Copy link
Contributor Author

cc @zsxwing

@zsxwing
Copy link
Member

zsxwing commented Oct 18, 2019

ok to test

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-29494][SQL] Fix for ArrayOutofBoundsException while converting string to timestamp (2.4) [SPARK-29494][SQL][2.4] Fix for ArrayOutofBoundsException while converting string to timestamp Oct 18, 2019
@SparkQA
Copy link

SparkQA commented Oct 19, 2019

Test build #112305 has finished for PR 26171 at commit 4376b88.

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

srowen pushed a commit that referenced this pull request Oct 19, 2019
…rting string to timestamp

### What changes were proposed in this pull request?
* Adding an additional check in `stringToTimestamp` to handle cases where the input has trailing ':'
* Added a test to make sure this works.

### Why are the changes needed?
In a couple of scenarios while converting from String to Timestamp `DateTimeUtils.stringToTimestamp` throws an array out of bounds exception if there is trailing  ':'. The behavior of this method requires it to return `None` in case the format of the string is incorrect.

### Does this PR introduce any user-facing change?
No

### How was this patch tested?
Added a test in the `DateTimeTestUtils` suite to test if my fix works.

Closes #26171 from rahulsmahadev/araryOB.

Authored-by: Rahul Mahadev <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
@srowen
Copy link
Member

srowen commented Oct 19, 2019

Merged to 2.4. Thank you @rahulsmahadev @zsxwing

@dongjoon-hyun
Copy link
Member

Thank you all!

scunniff pushed a commit to scunniff/nomad-spark that referenced this pull request Nov 10, 2020
…rting string to timestamp

### What changes were proposed in this pull request?
* Adding an additional check in `stringToTimestamp` to handle cases where the input has trailing ':'
* Added a test to make sure this works.

### Why are the changes needed?
In a couple of scenarios while converting from String to Timestamp `DateTimeUtils.stringToTimestamp` throws an array out of bounds exception if there is trailing  ':'. The behavior of this method requires it to return `None` in case the format of the string is incorrect.

### Does this PR introduce any user-facing change?
No

### How was this patch tested?
Added a test in the `DateTimeTestUtils` suite to test if my fix works.

Closes apache#26171 from rahulsmahadev/araryOB.

Authored-by: Rahul Mahadev <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants