Skip to content

Conversation

@MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Sep 15, 2019

What changes were proposed in this pull request?

In the PR, I propose to fix comments of date-time expressions, and replace the yyyy pattern by uuuu when the implementation supposes the former one.

Why are the changes needed?

To make comments consistent to implementations.

Does this PR introduce any user-facing change?

No

How was this patch tested?

By running Scala Style checker.

* See [https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html].
* Note that hive Language Manual says it returns 0 if fail, but in fact it returns null.
* If the second parameter is missing, use "yyyy-MM-dd HH:mm:ss".
* If the second parameter is missing, use "uuuu-MM-dd HH:mm:ss".
Copy link
Member Author

Choose a reason for hiding this comment

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


/**
* The formatter parses/formats timestamps according to the pattern `yyyy-MM-dd HH:mm:ss.[..fff..]`
* The formatter parses/formats timestamps according to the pattern `uuuu-MM-dd HH:mm:ss.[..fff..]`
Copy link
Member Author

@MaxGekk MaxGekk Sep 15, 2019

Choose a reason for hiding this comment

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

ISO_LOCAL_DATE (

) supports negative years, and in this mean it is equal to uuuu

* @param dateExpr A date, timestamp or string. If a string, the data must be in a format that
* can be cast to a timestamp, such as `yyyy-MM-dd` or `yyyy-MM-dd HH:mm:ss.SSSS`
* @param format A pattern `dd.MM.yyyy` would return a string like `18.03.1993`
* can be cast to a timestamp, such as `uuuu-MM-dd` or `uuuu-MM-dd HH:mm:ss.SSSS`
Copy link
Member Author

Choose a reason for hiding this comment

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

It uses TimestampFormatter which can output negative years using the uuuu pattern.

@SparkQA
Copy link

SparkQA commented Sep 15, 2019

Test build #110621 has finished for PR 25796 at commit d021210.

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

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM. Thank you, @MaxGekk .
Merged to master.

@MaxGekk MaxGekk deleted the year-pattern-uuuu-followup branch October 5, 2019 19:17
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.

3 participants