You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/06/10 03:20:26 UTC

[GitHub] [arrow] alexandreyc commented on a diff in pull request #13310: ARROW-16749: [Go] Fix pqarrow writer for null array

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-unsubscribe@arrow.apache.org

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