Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/8034#discussion_r36546157
--- Diff:
unsafe/src/main/java/org/apache/spark/unsafe/types/CalendarInterval.java ---
@@ -79,6 +87,152 @@ public static CalendarInterval fromString(String s) {
}
}
+ public static long toLongWithRange(String fieldName,
+ String s, long minValue, long maxValue) throws
IllegalArgumentException {
+ long result = 0;
+ if (s != null) {
+ result = Long.valueOf(s);
+ if (result < minValue || result > maxValue) {
+ throw new IllegalArgumentException(String.format("%s %d outside
range [%d, %d]",
+ fieldName, result, minValue, maxValue));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Parse YearMonth string in form: [-]YYYY-MM
+ *
+ * adapted from HiveIntervalYearMonth.valueOf
+ */
+ public static CalendarInterval fromYearMonthString(String s) {
--- End diff --
can you declare the possible exceptions here?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]