You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by mg...@apache.org on 2024/10/21 06:26:21 UTC

(spark-connect-go) branch master updated: fix: Row FieldNames() memory allocation

This is an automated email from the ASF dual-hosted git repository.

mgrund pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark-connect-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 7e10ae5  fix: Row FieldNames() memory allocation
7e10ae5 is described below

commit 7e10ae5c04af244049a1b0331d657e002edf96ff
Author: Paul Hegenberg <pa...@gmail.com>
AuthorDate: Mon Oct 21 08:26:11 2024 +0200

    fix: Row FieldNames() memory allocation
    
    ### 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 <pa...@gmail.com>
    Signed-off-by: Martin Grund <ma...@databricks.com>
---
 spark/sql/types/row.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spark/sql/types/row.go b/spark/sql/types/row.go
index b73ef57..5255964 100644
--- a/spark/sql/types/row.go
+++ b/spark/sql/types/row.go
@@ -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)
 	}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org