From 3ee1b18e0d4eb35d8eeb5d6951b9d75fb45ad08b Mon Sep 17 00:00:00 2001 From: Nick Tobey Date: Thu, 25 Jul 2024 16:07:54 -0700 Subject: [PATCH] Improve how non-leaf blob nodes are displayed in `dolt show` --- go/store/prolly/message/blob.go | 2 +- go/store/types/serial_message.go | 17 ++--------------- integration-tests/bats/show.bats | 13 ++++++++++++- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/go/store/prolly/message/blob.go b/go/store/prolly/message/blob.go index f5496d806c6..604dd0e48b7 100644 --- a/go/store/prolly/message/blob.go +++ b/go/store/prolly/message/blob.go @@ -78,7 +78,7 @@ func getBlobValues(msg serial.Message) (values ItemAccess, err error) { } if b.TreeLevel() > 0 { values.bufStart = lookupVectorOffset(blobAddressArrayVOffset, b.Table()) - values.bufLen = uint16(b.AddressArrayLength() * uint16Size) + values.bufLen = uint16(b.AddressArrayLength()) values.itemWidth = hash.ByteLen } else { values.bufStart = lookupVectorOffset(blobPayloadBytesVOffset, b.Table()) diff --git a/go/store/types/serial_message.go b/go/store/types/serial_message.go index 3e6b7d49086..1715dbeb69d 100644 --- a/go/store/types/serial_message.go +++ b/go/store/types/serial_message.go @@ -314,7 +314,7 @@ func (sm SerialMessage) HumanReadableStringAtIndentationLevel(level int) string } func OutputBlobNodeBytes(w *strings.Builder, indentationLevel int, msg serial.Message) error { - keys, values, treeLevel, count, err := message.UnpackFields(msg) + _, values, treeLevel, count, err := message.UnpackFields(msg) if err != nil { return err } @@ -328,21 +328,8 @@ func OutputBlobNodeBytes(w *strings.Builder, indentationLevel int, msg serial.Me } for i := 0; i < int(count); i++ { - k := keys.GetItem(i, msg) - kt := val.Tuple(k) - - w.Write([]byte("\n { key: ")) - for j := 0; j < kt.Count(); j++ { - if j > 0 { - w.Write([]byte(", ")) - } - - w.Write([]byte(hex.EncodeToString(kt.GetField(j)))) - } - + w.Write([]byte("\n { ref: #")) ref := hash.New(values.GetItem(i, msg)) - - w.Write([]byte(" ref: #")) w.Write([]byte(ref.String())) w.Write([]byte(" }")) } diff --git a/integration-tests/bats/show.bats b/integration-tests/bats/show.bats index 0f67fb05de6..daf62ac0dd9 100644 --- a/integration-tests/bats/show.bats +++ b/integration-tests/bats/show.bats @@ -247,7 +247,7 @@ EOF [[ "$output" =~ "{ key: 01000000 value: #8scr7d6rtnafqovoa7d06em7jkpil9gg, #8arugs9qup4pvpmqbf64lpkm9f6cdv74 }" ]] || false } -@test "show: blob" { +@test "show: blob leaf" { dolt sql <