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..f2569b60e6 --- /dev/null +++ b/sio/csvio/ztests/none.yaml @@ -0,0 +1,9 @@ +spq: pass + +flags: -f csv + +input: | + {a:none::(int64|none)} + +output: "a\n\ + \n"