From a4586145ca604cbf68b081e9134df9a8ca6e07fb Mon Sep 17 00:00:00 2001 From: John Kerl Date: Thu, 13 May 2021 00:11:51 -0400 Subject: [PATCH] Regression-test cases for null-type --- go/regtest/cases/io-json-io/0033/cmd | 1 + go/regtest/cases/io-json-io/0033/experr | 0 go/regtest/cases/io-json-io/0033/expout | 6 ++++ go/regtest/cases/io-json-io/0034/cmd | 1 + go/regtest/cases/io-json-io/0034/experr | 0 go/regtest/cases/io-json-io/0034/expout | 6 ++++ go/regtest/cases/io-json-io/0035/cmd | 1 + go/regtest/cases/io-json-io/0035/experr | 0 go/regtest/cases/io-json-io/0035/expout | 6 ++++ go/regtest/input/nulls.json | 5 ++++ go/todo.txt | 37 ++++++++----------------- 11 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 go/regtest/cases/io-json-io/0033/cmd create mode 100644 go/regtest/cases/io-json-io/0033/experr create mode 100644 go/regtest/cases/io-json-io/0033/expout create mode 100644 go/regtest/cases/io-json-io/0034/cmd create mode 100644 go/regtest/cases/io-json-io/0034/experr create mode 100644 go/regtest/cases/io-json-io/0034/expout create mode 100644 go/regtest/cases/io-json-io/0035/cmd create mode 100644 go/regtest/cases/io-json-io/0035/experr create mode 100644 go/regtest/cases/io-json-io/0035/expout create mode 100644 go/regtest/input/nulls.json diff --git a/go/regtest/cases/io-json-io/0033/cmd b/go/regtest/cases/io-json-io/0033/cmd new file mode 100644 index 000000000..ca79af05a --- /dev/null +++ b/go/regtest/cases/io-json-io/0033/cmd @@ -0,0 +1 @@ +mlr --json --from regtest/input/nulls.json put '$z=$x+$y' diff --git a/go/regtest/cases/io-json-io/0033/experr b/go/regtest/cases/io-json-io/0033/experr new file mode 100644 index 000000000..e69de29bb diff --git a/go/regtest/cases/io-json-io/0033/expout b/go/regtest/cases/io-json-io/0033/expout new file mode 100644 index 000000000..d4f155daf --- /dev/null +++ b/go/regtest/cases/io-json-io/0033/expout @@ -0,0 +1,6 @@ +{ + "x": 1, + "n": null, + "y": 3, + "z": 4 +} diff --git a/go/regtest/cases/io-json-io/0034/cmd b/go/regtest/cases/io-json-io/0034/cmd new file mode 100644 index 000000000..950be088a --- /dev/null +++ b/go/regtest/cases/io-json-io/0034/cmd @@ -0,0 +1 @@ +mlr --json --from regtest/input/nulls.json put '$z=$n+$y' diff --git a/go/regtest/cases/io-json-io/0034/experr b/go/regtest/cases/io-json-io/0034/experr new file mode 100644 index 000000000..e69de29bb diff --git a/go/regtest/cases/io-json-io/0034/expout b/go/regtest/cases/io-json-io/0034/expout new file mode 100644 index 000000000..2edda76f4 --- /dev/null +++ b/go/regtest/cases/io-json-io/0034/expout @@ -0,0 +1,6 @@ +{ + "x": 1, + "n": null, + "y": 3, + "z": 3 +} diff --git a/go/regtest/cases/io-json-io/0035/cmd b/go/regtest/cases/io-json-io/0035/cmd new file mode 100644 index 000000000..1083ff6e2 --- /dev/null +++ b/go/regtest/cases/io-json-io/0035/cmd @@ -0,0 +1 @@ +mlr --json --from regtest/input/nulls.json put '$z=$n+$n' diff --git a/go/regtest/cases/io-json-io/0035/experr b/go/regtest/cases/io-json-io/0035/experr new file mode 100644 index 000000000..e69de29bb diff --git a/go/regtest/cases/io-json-io/0035/expout b/go/regtest/cases/io-json-io/0035/expout new file mode 100644 index 000000000..6073b24f6 --- /dev/null +++ b/go/regtest/cases/io-json-io/0035/expout @@ -0,0 +1,6 @@ +{ + "x": 1, + "n": null, + "y": 3, + "z": null +} diff --git a/go/regtest/input/nulls.json b/go/regtest/input/nulls.json new file mode 100644 index 000000000..00aa2a6f6 --- /dev/null +++ b/go/regtest/input/nulls.json @@ -0,0 +1,5 @@ +{ + "x": 1, + "n": null, + "y": 3 +} diff --git a/go/todo.txt b/go/todo.txt index 6cbdd4f17..6cec1957b 100644 --- a/go/todo.txt +++ b/go/todo.txt @@ -1,34 +1,11 @@ ================================================================ TOP OF LIST: -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -JSON null: -* null literal in bnf -* scan-test for json input -* write-test for json output -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * tools/perf: o https://eng.uber.com/pprof-go-profiler/ o profile mlr --j2x cat mappings.json o golang static-analysis tool -- ? -* 2121 case: - o ../c/mlr --from s put '$z=1+""' - o ../go/mlr --from s put '$z=1+""' - o array auto-extend: - - fill with absent is not ok - > Miller internal coding error: absent-values should not have been assigned - > cmt mlrval_new.go - - fill with empty results in these situations :( - > https://miller.readthedocs.io/en/latest/reference.html#null-data-empty-and-absent - "Empty values are explicit in the data so they should explicitly affect - accumulations: mlr put '@sum += $x' should accumulate numeric x values - into the sum but an empty x, when encountered in the input data stream, - should make the sum non-numeric." - - fill with ... use JSON_NULL here? - o needs doc-ent for JSON_NULL -- only for JSON user data only only ... except for this - * blockers: o repifs, for nidx & pprint both o --d2n commawrong @@ -73,8 +50,6 @@ JSON null: * cases/dsl-min-max-types: cmp-matrices need to be fixed to follow the advertised rule for mixed types NUMERICS < BOOL < VOID < STRING -? blocker? json null - * blocker: smart fmtnum - poor-person's initial version: lld/llx -> d/x; lf/le/lg -> f/e/g ... - fmtnum @@ -629,3 +604,15 @@ i https://en.wikipedia.org/wiki/Delimiter#Delimiter_collision * doc for DSL hostname/os/version functions ? ENV as entire string-string map at RHS/LHS -- ? * mongo examples to doc :D +* doc for array auto-extend: + - fill with absent is not ok + > Miller internal coding error: absent-values should not have been assigned + > cmt mlrval_new.go + - fill with empty results in these situations :( + > https://miller.readthedocs.io/en/latest/reference.html#null-data-empty-and-absent + "Empty values are explicit in the data so they should explicitly affect + accumulations: mlr put '@sum += $x' should accumulate numeric x values + into the sum but an empty x, when encountered in the input data stream, + should make the sum non-numeric." + - use JSON null here + - needs doc-ent for JSON_NULL -- only for JSON user data only only ... except for this