Skip to content

Conversation

@kevincox
Copy link
Contributor

This fixes https://issues.apache.org/jira/browse/SPARK-9794 by using a real ISO8601 parser. (courtesy of the xml component of the standard java library)

cc: @angelini

@srowen
Copy link
Member

srowen commented Aug 24, 2015

See https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark for how to name pull requests, which would automatically link them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might bear explanation -- why does it implementing parsing correctly and why is GMT special-cased?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because XML dates are ISO8601 so the XML date parser parses ISO8601 dates. The reason why GMT is special cased is because this method handles a number of date formats so I preserved the special casing from the previous version.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, that's guaranteed by the method in the sense that XML dates must be in ISO8601 format? Do we have tests for this?

Nits: import DatatypeConverter and I think you can avoid the return keyword in the code you added, for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no return, do you still want it to be imported?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the return in the first branch of the if-else above; it's not related to imports. Yes I think the right default is to import classes that are used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I have updated the PR with those two fixes.

@kevincox kevincox changed the title Fix datetime parsing in SparkSQL. [SPARK-9794] [SQL] Fix datetime parsing in SparkSQL. Aug 24, 2015
@srowen
Copy link
Member

srowen commented Sep 7, 2015

@kevincox can you follow up on this, adding tests (or else point out the tests I missed)? I think this deserves some basic coverage.

@kevincox
Copy link
Contributor Author

kevincox commented Sep 8, 2015

Sorry, had a busy week. I can definitely add a couple of tests. The existing tests also verify that this is working with the previously tested formats (assuming that there were tests). I'll update this PR and ping you as soon as I get a chance.

@kevincox
Copy link
Contributor Author

kevincox commented Sep 8, 2015

Tests added (there weren't any previously). I tried to ensure they covered all supported cases.

@marmbrus
Copy link
Contributor

marmbrus commented Sep 8, 2015

ok to test

@SparkQA
Copy link

SparkQA commented Sep 8, 2015

Test build #42161 has finished for PR 8396 at commit a6bd6ab.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Sep 10, 2015

Test build #1736 has finished for PR 8396 at commit a6bd6ab.

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

@srowen
Copy link
Member

srowen commented Sep 16, 2015

OK this looks pretty good. @marmbrus any objections? the logic looks reasonable as do the tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't include the comma here - but it's ok i will fix it after merging it.

@asfgit asfgit closed this in d39f15e Sep 16, 2015
@kevincox kevincox deleted the kevincox-sql-time-parsing branch September 16, 2015 22:33
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