okumin commented on code in PR #5421:
URL: https://github.com/apache/hive/pull/5421#discussion_r1740664028
##########
common/src/test/org/apache/hive/common/util/TestDateParser.java:
##########
@@ -45,19 +45,19 @@ void checkInvalidCase(String strValue) {
@Test
public void testValidCases() throws Exception {
- checkValidCase("1945-12-31", Date.valueOf("1945-12-31"));
- checkValidCase("1946-01-01", Date.valueOf("1946-01-01"));
- checkValidCase("2001-11-12", Date.valueOf("2001-11-12"));
- checkValidCase("0004-05-06", Date.valueOf("0004-05-06"));
- checkValidCase("1678-09-10", Date.valueOf("1678-09-10"));
- checkValidCase("9999-10-11", Date.valueOf("9999-10-11"));
+ checkValidCase("1945-12-31", Date.of(1945,12,31));
+ checkValidCase("1946-01-01", Date.of(1946,1,1));
+ checkValidCase("2001-11-12", Date.of(2001,11,12));
+ checkValidCase("0004-05-06", Date.of(4,5,6));
+ checkValidCase("1678-09-10", Date.of(1678,9,10));
+ checkValidCase("9999-10-11", Date.of(9999,10,11));
Review Comment:
I wonder if this is just a clean-up or if the test fails without this change
##########
common/src/test/org/apache/hive/common/util/TestDateParser.java:
##########
@@ -71,9 +71,6 @@ public void
testParseDateFromTimestampWithCommonTimeDelimiter() {
@Test
public void testParseDateFromValidDateLiteralWithTrailingDigits() {
assertEquals(Date.of(2023, 8, 8), DateParser.parseDate("2023-08-0800"));
- // The result may seem unexpected but for many "08-08-20" is a valid date
so there is no reason to reject
- // "08-08-2023" and return null unless in the future Hive becomes stricter
in terms of parsing dates.
- assertEquals(Date.of(8, 8, 20), DateParser.parseDate("08-08-2023"));
Review Comment:
I prefer the new behavior, but it looks intentional. I have no objections to
change it
--
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]