datbth commented on code in PR #43625:
URL: https://github.com/apache/arrow/pull/43625#discussion_r1713543122


##########
go/parquet/pqarrow/encode_arrow.go:
##########
@@ -607,6 +607,30 @@ func writeDenseArrow(ctx *arrowWriteContext, cw 
file.ColumnChunkWriter, leafArr
                                }
                                wr.WriteBatchSpaced(data, defLevels, repLevels, 
arr.NullBitmapBytes(), int64(arr.Data().Offset()))
                        }
+               case *arrow.MonthDayNanoIntervalType:
+                       arr := leafArr.(*array.MonthDayNanoInterval)
+                       data := make([]parquet.FixedLenByteArray, arr.Len())
+
+                       // NOTE: parquet Interval only supports 32-bit 
milliseconds so we are truncating Nanoseconds to milliseconds
+                       if arr.NullN() == 0 {
+                               for idx := range data {
+                                       data[idx] = 
make(parquet.FixedLenByteArray, 12)
+                                       
binary.LittleEndian.PutUint32(data[idx][:4], uint32(arr.Value(idx).Months))

Review Comment:
   You are right. I somehow kept assuming that intervals cannot be negative.  
   In this case, I think it is not possible to convert arrow 
MonthDayNanoInterval into parquet Interval.  
   I'll close this then.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to