From 431015e9689021b316ec9ec26fba5a1b4b9a3f83 Mon Sep 17 00:00:00 2001 From: Noah Treuhaft Date: Thu, 15 Oct 2026 13:37:03 -0400 Subject: [PATCH 1/2] sio/csvio: fix missing field output The CSV writer emits "none" for a missing field like the one in {a:none::(int64|none)}. Emit an empty string instead. --- sio/csvio/writer.go | 24 +++++++++++------------- sio/csvio/ztests/none.yaml | 9 +++++++++ 2 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 sio/csvio/ztests/none.yaml diff --git a/sio/csvio/writer.go b/sio/csvio/writer.go index e19e32f221..617d38f74d 100644 --- a/sio/csvio/writer.go +++ b/sio/csvio/writer.go @@ -93,19 +93,17 @@ func (w *Writer) Write(rec super.Value) error { for i, it := 0, rec.Bytes().Iter(); i < len(fields) && !it.Done(); i++ { var s string elem := it.Next() - if !super.IsNone(fields[i].Type, elem) { - val := super.NewValue(fields[i].Type, elem).Under() - switch id := val.Type().ID(); { - case id == super.IDBytes && len(val.Bytes()) == 0: - // We want "" instead of "0x" for a zero-length value. - case id == super.IDString: - s = string(val.Bytes()) - case id == super.IDNull: - default: - s = formatValue(val.Type(), val.Bytes()) - if super.IsFloat(id) && strings.HasSuffix(s, ".") { - s = strings.TrimSuffix(s, ".") - } + val := super.NewValue(fields[i].Type, elem).Under() + switch id := val.Type().ID(); { + case id == super.IDBytes && len(val.Bytes()) == 0: + // We want "" instead of "0x" for a zero-length value. + case id == super.IDString: + s = string(val.Bytes()) + case id == super.IDNull || id == super.IDNone: + default: + s = formatValue(val.Type(), val.Bytes()) + if super.IsFloat(id) && strings.HasSuffix(s, ".") { + s = strings.TrimSuffix(s, ".") } } w.strings = append(w.strings, s) diff --git a/sio/csvio/ztests/none.yaml b/sio/csvio/ztests/none.yaml new file mode 100644 index 0000000000..94a912c46d --- /dev/null +++ b/sio/csvio/ztests/none.yaml @@ -0,0 +1,9 @@ +spq: pass + +flags: -f csv + +input: | + {none:none::(int64|none)} + +output: "none\n\ + \n" From fe184523f7005903b8ffe7f67534265962a60970 Mon Sep 17 00:00:00 2001 From: Noah Treuhaft Date: Thu, 15 Oct 2026 13:53:17 -0400 Subject: [PATCH 2/2] update sio/csvio/ztests/none.yaml --- sio/csvio/ztests/none.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sio/csvio/ztests/none.yaml b/sio/csvio/ztests/none.yaml index 94a912c46d..f2569b60e6 100644 --- a/sio/csvio/ztests/none.yaml +++ b/sio/csvio/ztests/none.yaml @@ -3,7 +3,7 @@ spq: pass flags: -f csv input: | - {none:none::(int64|none)} + {a:none::(int64|none)} -output: "none\n\ +output: "a\n\ \n"