zabetak commented on code in PR #4545:
URL: https://github.com/apache/hive/pull/4545#discussion_r1289747280
##########
common/src/java/org/apache/hadoop/hive/common/type/Date.java:
##########
@@ -175,22 +178,16 @@ public void setTimeInMillis(long epochMilli) {
*/
public static Date valueOf(final String text) {
String s = Objects.requireNonNull(text).trim();
- int idx = s.indexOf(" ");
- if (idx != -1) {
- s = s.substring(0, idx);
- } else {
- idx = s.indexOf('T');
- if (idx != -1) {
- s = s.substring(0, idx);
- }
- }
- LocalDate localDate;
+ ParsePosition pos = new ParsePosition(0);
try {
- localDate = LocalDate.parse(s, PARSE_FORMATTER);
+ TemporalAccessor t = PARSE_FORMATTER.parseUnresolved(s, pos);
Review Comment:
I was thinking that the commit message was enough to understand why
`parseUnresolved` is used instead of `parse`.
Usually, I tend to add comments when the code is not easy to understand not
to justify why a change was done. I tend to document the "why part" in the
commit message/JIRA but this is an entirely personal contribution style.
Anyways more is usually better than less so I will add an appropriate
comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]