zeroshade commented on code in PR #1543:
URL: https://github.com/apache/arrow-go/pull/1543#discussion_r4553743281


##########
parquet/file/column_writer.go:
##########
@@ -524,7 +529,12 @@ func (w *columnWriter) writeLevels(numValues int64, 
defLevels, repLevels []int16
 }
 
 func (w *columnWriter) writeLevelsSpaced(numLevels int64, defLevels, repLevels 
[]int16) {
-       if w.descr.MaxDefinitionLevel() > 0 {
+       if maxDefLevel := w.descr.MaxDefinitionLevel(); maxDefLevel > 0 {
+               for _, v := range defLevels[:numLevels] {

Review Comment:
   This adds a second pass over the definition levels on the spaced path, which 
nullable columns written from Arrow use. Writing 1M nullable int32 values with 
`WriteBatchSpaced` on an Apple M4 (statistics off, V1 pages) goes from about 
3.95 ms to 4.13 ms, roughly 4% slower. `WriteBatch` is unchanged.
   
   The loop also runs for V1 pages, which never use the count. Could it be 
skipped unless the writer produces V2 pages? That keeps V1 writes at their 
current speed. Optional, since the cost is small.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to