Skip to content

Commit

Permalink
fix: Row FieldNames() memory allocation
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

The `rowImpl.FieldNames()` array allocation was wrong, resulting in empty strings at the start of the list.

### Why are the changes needed?
To fix the bug.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
In my head^^

Closes #75 from paulheg/master.

Authored-by: Paul Hegenberg <paul.hegenberg@gmail.com>
Signed-off-by: Martin Grund <martin.grund@databricks.com>
  • Loading branch information
paulheg authored and grundprinzip committed Oct 21, 2024
1 parent b6b0899 commit 7e10ae5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spark/sql/types/row.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (r *rowImpl) Len() int {
}

func (r *rowImpl) FieldNames() []string {
names := make([]string, len(r.offsets))
names := make([]string, 0, len(r.offsets))
for name := range r.offsets {
names = append(names, name)
}
Expand Down

0 comments on commit 7e10ae5

Please sign in to comment.