harshmotw-db commented on code in PR #47473:
URL: https://github.com/apache/spark/pull/47473#discussion_r1690384029
##########
common/variant/src/main/java/org/apache/spark/types/variant/Variant.java:
##########
@@ -316,6 +334,22 @@ static void toJsonImpl(byte[] value, byte[] metadata, int
pos, StringBuilder sb,
case BINARY:
appendQuoted(sb,
Base64.getEncoder().encodeToString(VariantUtil.getBinary(value, pos)));
break;
+ case YEAR_MONTH_INTERVAL:
+ IntervalFields ymFields =
VariantUtil.getYearMonthIntervalFields(value, pos);
+ int ymValue = (int) VariantUtil.getLong(value, pos);
+ appendQuoted(sb, YearMonthIntervalUtils
+ .toYearMonthIntervalANSIString(ymValue, ymFields.startField,
ymFields.endField));
+ break;
+ case DAY_TIME_INTERVAL:
+ IntervalFields dtFields = VariantUtil.getDayTimeIntervalFields(value,
pos);
+ long dtValue = VariantUtil.getLong(value, pos);
+ try {
Review Comment:
`toDayTimeIntervalANSIString` can throw an exception while
`toYearMonthIntervalANSIString` cannot.
--
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]