@@ -131,6 +131,9 @@ private Object writeReplace() {
131131 case DATE :
132132 builder .set (fieldName ).to ((Date ) value );
133133 break ;
134+ case INTERVAL :
135+ builder .set (fieldName ).to ((Interval ) value );
136+ break ;
134137 case ARRAY :
135138 final Type elementType = fieldType .getArrayElementType ();
136139 switch (elementType .getCode ()) {
@@ -184,6 +187,9 @@ private Object writeReplace() {
184187 case DATE :
185188 builder .set (fieldName ).toDateArray ((Iterable <Date >) value );
186189 break ;
190+ case INTERVAL :
191+ builder .set (fieldName ).toIntervalArray ((Iterable <Interval >) value );
192+ break ;
187193 case STRUCT :
188194 builder .set (fieldName ).toStructArray (elementType , (Iterable <Struct >) value );
189195 break ;
@@ -298,6 +304,9 @@ private static Object decodeValue(Type fieldType, com.google.protobuf.Value prot
298304 case DATE :
299305 checkType (fieldType , proto , KindCase .STRING_VALUE );
300306 return Date .parseDate (proto .getStringValue ());
307+ case INTERVAL :
308+ checkType (fieldType , proto , KindCase .STRING_VALUE );
309+ return Interval .parseFromString (proto .getStringValue ());
301310 case ARRAY :
302311 checkType (fieldType , proto , KindCase .LIST_VALUE );
303312 ListValue listValue = proto .getListValue ();
@@ -347,6 +356,7 @@ static Object decodeArrayValue(Type elementType, ListValue listValue) {
347356 case BYTES :
348357 case TIMESTAMP :
349358 case DATE :
359+ case INTERVAL :
350360 case STRUCT :
351361 case PROTO :
352362 return Lists .transform (listValue .getValuesList (), input -> decodeValue (elementType , input ));
@@ -503,6 +513,12 @@ protected Date getDateInternal(int columnIndex) {
503513 return (Date ) rowData .get (columnIndex );
504514 }
505515
516+ @ Override
517+ protected Interval getIntervalInternal (int columnIndex ) {
518+ ensureDecoded (columnIndex );
519+ return (Interval ) rowData .get (columnIndex );
520+ }
521+
506522 private boolean isUnrecognizedType (int columnIndex ) {
507523 return type .getStructFields ().get (columnIndex ).getType ().getCode () == Code .UNRECOGNIZED ;
508524 }
@@ -624,6 +640,8 @@ protected Value getValueInternal(int columnIndex) {
624640 return Value .timestamp (isNull ? null : getTimestampInternal (columnIndex ));
625641 case DATE :
626642 return Value .date (isNull ? null : getDateInternal (columnIndex ));
643+ case INTERVAL :
644+ return Value .interval (isNull ? null : getIntervalInternal (columnIndex ));
627645 case STRUCT :
628646 return Value .struct (isNull ? null : getStructInternal (columnIndex ));
629647 case UNRECOGNIZED :
@@ -664,6 +682,8 @@ protected Value getValueInternal(int columnIndex) {
664682 return Value .timestampArray (isNull ? null : getTimestampListInternal (columnIndex ));
665683 case DATE :
666684 return Value .dateArray (isNull ? null : getDateListInternal (columnIndex ));
685+ case INTERVAL :
686+ return Value .intervalArray (isNull ? null : getIntervalListInternal (columnIndex ));
667687 case STRUCT :
668688 return Value .structArray (
669689 elementType , isNull ? null : getStructListInternal (columnIndex ));
@@ -847,6 +867,13 @@ protected List<Date> getDateListInternal(int columnIndex) {
847867 return Collections .unmodifiableList ((List <Date >) rowData .get (columnIndex ));
848868 }
849869
870+ @ Override
871+ @ SuppressWarnings ("unchecked" ) // We know ARRAY<Interval> produces a List<Interval>.
872+ protected List <Interval > getIntervalListInternal (int columnIndex ) {
873+ ensureDecoded (columnIndex );
874+ return Collections .unmodifiableList ((List <Interval >) rowData .get (columnIndex ));
875+ }
876+
850877 @ Override
851878 @ SuppressWarnings ("unchecked" ) // We know ARRAY<STRUCT<...>> produces a List<STRUCT>.
852879 protected List <Struct > getStructListInternal (int columnIndex ) {
0 commit comments