From 33ccb82b4b1670405ec7a5026196da1b7f9dad50 Mon Sep 17 00:00:00 2001 From: erezrokah Date: Tue, 8 Jul 2025 19:34:14 +0100 Subject: [PATCH] fix: Dont use `ValueStr`, get raw bytes instead --- plugin/diff.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/plugin/diff.go b/plugin/diff.go index bcdad91078..8f85ebb3fc 100644 --- a/plugin/diff.go +++ b/plugin/diff.go @@ -1,6 +1,7 @@ package plugin import ( + "encoding/base64" "fmt" "strings" @@ -17,16 +18,20 @@ func getUnifiedDiff(edits array.Edits, wantCol, haveCol arrow.Array) string { defer func() { if r := recover(); r != nil { wantDataType := wantCol.DataType() - wantData := make([]string, wantCol.Len()) - for i := 0; i < wantCol.Len(); i++ { - wantData[i] = wantCol.ValueStr(i) + wantData := make([]byte, wantCol.Len()) + for _, buffer := range wantCol.Data().Buffers() { + wantData = append(wantData, buffer.Bytes()...) } haveDataType := haveCol.DataType() - haveData := make([]string, haveCol.Len()) - for i := 0; i < haveCol.Len(); i++ { - haveData[i] = haveCol.ValueStr(i) + haveData := make([]byte, haveCol.Len()) + for _, buffer := range haveCol.Data().Buffers() { + haveData = append(haveData, buffer.Bytes()...) } - panic(fmt.Errorf("panic in getUnifiedDiff: %s, want: [%s], have: [%s], want type: %s, have type: %s", r, strings.Join(wantData, ", "), strings.Join(haveData, ", "), wantDataType, haveDataType)) + + wantBase64 := base64.StdEncoding.EncodeToString(wantData) + haveBase64 := base64.StdEncoding.EncodeToString(haveData) + + panic(fmt.Errorf("panic in getUnifiedDiff: %s, want: (%s), have: (%s), want type: %s, have type: %s", r, wantBase64, haveBase64, wantDataType, haveDataType)) } }() return edits.UnifiedDiff(wantCol, haveCol)