Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions arrow/compute/exprs/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ func TestExecuteFieldRef(t *testing.T) {
}
}

func TestGetRefFieldEmptySchema(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor coverage gap: this pins the top-level empty case, but nothing pins the nested one. A future refactor that hoists the len(fields) == 0 check above the loop would silently drop the : <type> detail from nested references and this test would still pass.

A second case — a reference into a field whose type has no children, asserting the error still names the type — would guard the behaviour the fix went out of its way to preserve.

_, err := exprs.GetRefField(expr.NewStructFieldRef(0), nil)
assert.ErrorIs(t, err, compute.ErrNoChildren)
}

func TestExecuteScalarFuncCall(t *testing.T) {
mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
fromJSON := func(ty arrow.DataType, json string) arrow.Array {
Expand Down
3 changes: 3 additions & 0 deletions arrow/compute/exprs/field_refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func GetRefField(ref expr.ReferenceSegment, fields []arrow.Field) (*arrow.Field,

for ref != nil {
if len(fields) == 0 {
if out == nil {
return nil, compute.ErrNoChildren
}
return nil, fmt.Errorf("%w: %s", compute.ErrNoChildren, out.Type)
}

Expand Down
Loading