alexandreyc commented on code in PR #13310:
URL: https://github.com/apache/arrow/pull/13310#discussion_r894120603


##########
go/parquet/file/column_writer_types.gen.go.tmpl:
##########
@@ -137,13 +137,13 @@ func (w *{{.Name}}ColumnChunkWriter) 
WriteBatchSpaced(values []{{.name}}, defLev
 
     w.writeLevelsSpaced(batch, levelSliceOrNil(defLevels, offset, batch), 
levelSliceOrNil(repLevels, offset, batch))
     if values != nil {
-      vals = values[valueOffset:]
+      vals = values[valueOffset:][:info.numSpaced()]
     }
 
     if w.bitsBuffer != nil {
-      w.writeValuesSpaced(vals[:info.numSpaced()], info.batchNum, 
w.bitsBuffer.Bytes(), 0)
+      w.writeValuesSpaced(vals, info.batchNum, w.bitsBuffer.Bytes(), 0)
     } else {
-      w.writeValuesSpaced(vals[:info.numSpaced()], info.batchNum, validBits, 
validBitsOffset+valueOffset)
+      w.writeValuesSpaced(vals, info.batchNum, validBits, 
validBitsOffset+valueOffset)

Review Comment:
   Yes that's the reason. I'm not sure it will change anything to replace the 
nil slice by an empty one because we are slicing out of bounds anyway.  
`vals[:info.numSpaced()]` will panic in both cases (nil and empty) because in 
that case `info.numSpaced() > 0` (because null count > 0). 
   
   (Or maybe I misunderstood your message)



-- 
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