From 7bf358e497c40cdc757df88e6fc6915995c0aedc Mon Sep 17 00:00:00 2001 From: John Kerl Date: Thu, 29 Dec 2022 12:30:47 -0700 Subject: [PATCH] Fix #1102 (#1163) --- internal/pkg/input/record_reader_tsv.go | 6 ------ test/cases/io-spec-tsv/0004/cmd | 1 + test/cases/io-spec-tsv/0004/experr | 2 ++ test/cases/io-spec-tsv/0004/expout | 0 test/cases/io-spec-tsv/0004/should-fail | 0 test/cases/io-spec-tsv/0004/single-column-with-blank.json | 6 ++++++ 6 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 test/cases/io-spec-tsv/0004/cmd create mode 100644 test/cases/io-spec-tsv/0004/experr create mode 100644 test/cases/io-spec-tsv/0004/expout create mode 100644 test/cases/io-spec-tsv/0004/should-fail create mode 100644 test/cases/io-spec-tsv/0004/single-column-with-blank.json diff --git a/internal/pkg/input/record_reader_tsv.go b/internal/pkg/input/record_reader_tsv.go index c7a06d2de..7b496e725 100644 --- a/internal/pkg/input/record_reader_tsv.go +++ b/internal/pkg/input/record_reader_tsv.go @@ -178,12 +178,6 @@ func getRecordBatchExplicitTSVHeader( } } - if line == "" { - // Reset to new schema - reader.headerStrings = nil - continue - } - fields := reader.fieldSplitter.Split(line) if reader.headerStrings == nil { diff --git a/test/cases/io-spec-tsv/0004/cmd b/test/cases/io-spec-tsv/0004/cmd new file mode 100644 index 000000000..735d4f3df --- /dev/null +++ b/test/cases/io-spec-tsv/0004/cmd @@ -0,0 +1 @@ +mlr --itsv --ojson cat ${CASEDIR}/single-column-with-blank.json diff --git a/test/cases/io-spec-tsv/0004/experr b/test/cases/io-spec-tsv/0004/experr new file mode 100644 index 000000000..750e0a578 --- /dev/null +++ b/test/cases/io-spec-tsv/0004/experr @@ -0,0 +1,2 @@ +mlr: mlr: TSV header/data length mismatch 1 != 0 at filename test/cases/io-spec-tsv/0004/single-column-with-blank.json line 4. +. diff --git a/test/cases/io-spec-tsv/0004/expout b/test/cases/io-spec-tsv/0004/expout new file mode 100644 index 000000000..e69de29bb diff --git a/test/cases/io-spec-tsv/0004/should-fail b/test/cases/io-spec-tsv/0004/should-fail new file mode 100644 index 000000000..e69de29bb diff --git a/test/cases/io-spec-tsv/0004/single-column-with-blank.json b/test/cases/io-spec-tsv/0004/single-column-with-blank.json new file mode 100644 index 000000000..067f339fe --- /dev/null +++ b/test/cases/io-spec-tsv/0004/single-column-with-blank.json @@ -0,0 +1,6 @@ +a +1 +2 + +4 +5