dongjoon-hyun commented on a change in pull request #25000: [SPARK-28107][SQL]
Support 'day to hour', 'day to minute', 'hour to minute' and 'minute to second'
URL: https://github.com/apache/spark/pull/25000#discussion_r301305605
##########
File path:
common/unsafe/src/main/java/org/apache/spark/unsafe/types/CalendarInterval.java
##########
@@ -160,7 +160,25 @@ public static CalendarInterval fromYearMonthString(String
s) throws IllegalArgum
* adapted from HiveIntervalDayTime.valueOf
*/
public static CalendarInterval fromDayTimeString(String s) throws
IllegalArgumentException {
- CalendarInterval result = null;
+ return fromDayTimeString(s, "day", "second");
+ }
+
+ /**
+ * Parse dayTime string in form: [-]d HH:mm:ss.nnnnnnnnn and
[-]HH:mm:ss.nnnnnnnnn
+ *
+ * adapted from HiveIntervalDayTime.valueOf.
+ * Below interval conversion patterns are supported:
+ * - DAY TO HOUR
+ * - DAY TO MINUTE
+ * - DAY TO SECOND
+ * - HOUR to MINUTE
+ * - HOUR to SECOND
+ * - MINUTE to SECOND
+ */
+ public static CalendarInterval fromDayTimeString(String s, String from,
String to)
+ throws IllegalArgumentException {
+
+ CalendarInterval result;
Review comment:
Let's use initialized form to be safe in the future.
```java
CalendarInterval result = null;
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]