@@ -294,6 +294,7 @@ const char* exportArrowFormatStr(
294294 return " i" ; // int32
295295 case TypeKind::BIGINT:
296296 if (type->isTime ()) {
297+ VELOX_DCHECK (type->equivalent (*TIME ()));
297298 // TIME is stored as milliseconds since midnight in Velox.
298299 // Export as Arrow time32 with milliseconds unit.
299300 return " ttm" ;
@@ -728,12 +729,16 @@ bool isFlatScalarZeroCopy(const TypePtr& type, const ArrowOptions& options) {
728729 // - Velox's Timestamp representation (2x 64bit values) does not have an
729730 // equivalent in Arrow.
730731 // - Velox's TIME is in milliseconds, Arrow time64 is in microseconds.
732+ bool isTime = type->isTime ();
733+ if (isTime) {
734+ VELOX_DCHECK (type->equivalent (*TIME ()));
735+ }
731736 if (options.useDecimalTypeWidth ) {
732737 // Short decimal is zero-copy.
733- return !type->isTimestamp () && !type-> isTime () ;
738+ return !type->isTimestamp () && !isTime;
734739 }
735740 // Short decimal requires conversion.
736- return !type->isShortDecimal () && !type->isTimestamp () && !type-> isTime () ;
741+ return !type->isShortDecimal () && !type->isTimestamp () && !isTime;
737742}
738743
739744// Returns the size of a single element of a given `type` in the target arrow
@@ -744,6 +749,7 @@ size_t getArrowElementSize(const TypePtr& type, const ArrowOptions& options) {
744749 } else if (type->isTimestamp ()) {
745750 return sizeof (int64_t );
746751 } else if (type->isTime ()) {
752+ VELOX_DCHECK (type->equivalent (*TIME ()));
747753 // TIME is exported as Arrow time32 (int32_t).
748754 return sizeof (int32_t );
749755 }
@@ -778,6 +784,7 @@ void exportValues(
778784 if (type->kind () == TypeKind::TIMESTAMP) {
779785 gatherFromTimestampBuffer (vec, rows, options.timestampUnit , *values);
780786 } else if (type->kind () == TypeKind::BIGINT && type->isTime ()) {
787+ VELOX_DCHECK (type->equivalent (*TIME ()));
781788 gatherFromTimeBuffer (vec, rows, *values);
782789 } else {
783790 gatherFromBuffer (*type, *vec.values (), rows, options, *values);
@@ -2256,6 +2263,7 @@ VectorPtr importFromArrowImpl(
22562263 arrowArray.length ,
22572264 arrowArray.null_count );
22582265 } else if (type->isTime ()) {
2266+ VELOX_DCHECK (type->equivalent (*TIME ()));
22592267 auto timeUnit = getTimeUnit (arrowSchema);
22602268 bool isTime32 =
22612269 (timeUnit == TimeUnit::kSecond || timeUnit == TimeUnit::kMilli );
0 commit comments