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


##########
arrow/array/list.go:
##########
@@ -436,19 +455,29 @@ func (b *baseListBuilder) AppendNull() {
 }
 
 func (b *baseListBuilder) AppendNulls(n int) {

Review Comment:
   `MapBuilder` wraps a `ListBuilder`, but its `AppendNulls` and 
`AppendEmptyValues` methods still call the scalar path in a loop.
   
   After one `adjustStructBuilderLen()` call, they should be able to delegate 
directly to these new bulk methods:
   
   ```go
   b.adjustStructBuilderLen()
   b.listBuilder.AppendNulls(n)
   ```
   
   and similarly for empty values. That would extend this optimization to map 
arrays without duplicating the dimension logic.



##########
arrow/array/list_builder_bulk_test.go:
##########
@@ -0,0 +1,149 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package array_test
+
+import (
+       "fmt"
+       "testing"
+
+       "github.com/apache/arrow-go/v18/arrow"
+       "github.com/apache/arrow-go/v18/arrow/array"
+       "github.com/apache/arrow-go/v18/arrow/memory"
+       "github.com/stretchr/testify/assert"
+       "github.com/stretchr/testify/require"
+)
+
+type listBuilderFactory func(memory.Allocator) array.VarLenListLikeBuilder
+
+var listBuilderFactories = []struct {
+       name string
+       view bool
+       new  listBuilderFactory
+}{
+       {"list", false, func(mem memory.Allocator) array.VarLenListLikeBuilder {
+               return array.NewListBuilder(mem, arrow.PrimitiveTypes.Int32)
+       }},
+       {"large_list", false, func(mem memory.Allocator) 
array.VarLenListLikeBuilder {
+               return array.NewLargeListBuilder(mem, 
arrow.PrimitiveTypes.Int32)
+       }},
+       {"list_view", true, func(mem memory.Allocator) 
array.VarLenListLikeBuilder {
+               return array.NewListViewBuilder(mem, arrow.PrimitiveTypes.Int32)
+       }},
+       {"large_list_view", true, func(mem memory.Allocator) 
array.VarLenListLikeBuilder {
+               return array.NewLargeListViewBuilder(mem, 
arrow.PrimitiveTypes.Int32)
+       }},
+}
+
+func TestListBuilderBulkAppendNullsAndEmptyValues(t *testing.T) {

Review Comment:
   Because the optimized path writes numeric builder storage and validity bits 
directly, a small bulk-versus-scalar parity matrix would provide stronger 
regression protection than one fixed sequence.
   
   Please vary the starting parent length across bitmap boundaries, the batch 
size, and reuse after `NewArray()` to cover stale bits, non-byte-aligned 
writes, and dimension-builder length synchronization.



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