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


##########
arrow/array/dictionary_test.go:
##########
@@ -1207,6 +1207,32 @@ func TestDictionaryFromArrays(t *testing.T) {
        }
 }
 
+func TestValidatedDictionaryAllowsSignedIndexAtTypeLimit(t *testing.T) {
+       mem := memory.NewCheckedAllocator(memory.DefaultAllocator)
+       defer mem.AssertSize(t, 0)
+
+       indicesBuilder := array.NewInt8Builder(mem)
+       indicesBuilder.Append(127)
+       indices := indicesBuilder.NewArray()
+       indicesBuilder.Release()
+       defer indices.Release()
+
+       dictBuilder := array.NewStringBuilder(mem)
+       for i := 0; i < 128; i++ {
+               dictBuilder.AppendString(fmt.Sprintf("value-%d", i))
+       }
+       dict := dictBuilder.NewArray()
+       dictBuilder.Release()
+       defer dict.Release()
+
+       dictType := &arrow.DictionaryType{IndexType: arrow.PrimitiveTypes.Int8, 
ValueType: arrow.BinaryTypes.String}
+       result, err := array.NewValidatedDictionaryArray(dictType, indices, 
dict)
+       assert.NoError(t, err)

Review Comment:
   Minor: this asserts the error is nil but never checks the result, so a 
`(nil, nil)` return would pass the test just as happily. `require.NotNil(t, 
result)` would close that gap — and then the `if result != nil` guard below 
becomes unnecessary.
   



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