Skip to content

Commit d976f08

Browse files
committed
fix(arreflect): hasViewableType accepts LARGE_STRING/BINARY; add large+view empty-slice regression test
1 parent e573f55 commit d976f08

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

arrow/array/arreflect/reflect_infer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func applyViewOpts(dt arrow.DataType) arrow.DataType {
284284

285285
func hasViewableType(dt arrow.DataType) bool {
286286
switch dt.ID() {
287-
case arrow.STRING, arrow.BINARY, arrow.LIST:
287+
case arrow.STRING, arrow.BINARY, arrow.LARGE_STRING, arrow.LARGE_BINARY, arrow.LIST:
288288
return true
289289
case arrow.STRUCT:
290290
st := dt.(*arrow.StructType)

arrow/array/arreflect/reflect_infer_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,4 +845,10 @@ func TestHasViewableType(t *testing.T) {
845845
t.Run("map with string key is true", func(t *testing.T) {
846846
assert.True(t, hasViewableType(arrow.MapOf(arrow.BinaryTypes.String, arrow.PrimitiveTypes.Int64)))
847847
})
848+
t.Run("large_string is true", func(t *testing.T) {
849+
assert.True(t, hasViewableType(arrow.BinaryTypes.LargeString))
850+
})
851+
t.Run("large_binary is true", func(t *testing.T) {
852+
assert.True(t, hasViewableType(arrow.BinaryTypes.LargeBinary))
853+
})
848854
}

arrow/array/arreflect/reflect_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,14 @@ func TestBuildEmptyTyped(t *testing.T) {
308308
assert.Equal(t, arrow.STRING_VIEW, llv.Elem().ID())
309309
})
310310

311+
t.Run("large_view_string_empty", func(t *testing.T) {
312+
// large applied first: STRING→LARGE_STRING; then view: LARGE_STRING→STRING_VIEW
313+
arr, err := buildEmptyTyped(reflect.TypeOf(""), tagOpts{Large: true, View: true}, mem)
314+
require.NoError(t, err)
315+
defer arr.Release()
316+
assert.Equal(t, arrow.STRING_VIEW, arr.DataType().ID())
317+
})
318+
311319
t.Run("dict_with_unsupported_value_type_errors", func(t *testing.T) {
312320
_, err := buildEmptyTyped(reflect.TypeOf(time.Time{}), tagOpts{Dict: true}, mem)
313321
require.Error(t, err)

0 commit comments

Comments
 (0)