mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-17 16:38:54 +00:00
parent
56add7d1f0
commit
ed0ae66ac2
5 changed files with 32 additions and 6 deletions
|
|
@ -646,12 +646,14 @@ func getRecordBatchImplicitPprintHeader(
|
|||
}
|
||||
if nh < nd {
|
||||
// if header shorter than data: use 1-up itoa keys
|
||||
key := strconv.FormatInt(i+1, 10)
|
||||
value := mlrval.FromDeferredType(fields[i])
|
||||
_, err := record.PutReferenceMaybeDedupe(key, value, dedupeFieldNames)
|
||||
if err != nil {
|
||||
errorChannel <- err
|
||||
return
|
||||
for i = nh; i < nd; i++ {
|
||||
key := strconv.FormatInt(i+1, 10)
|
||||
value := mlrval.FromDeferredType(fields[i])
|
||||
_, err := record.PutReferenceMaybeDedupe(key, value, dedupeFieldNames)
|
||||
if err != nil {
|
||||
errorChannel <- err
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if nh > nd {
|
||||
|
|
|
|||
1
test/cases/io-barred-pprint/ragged-implicit/cmd
Normal file
1
test/cases/io-barred-pprint/ragged-implicit/cmd
Normal file
|
|
@ -0,0 +1 @@
|
|||
mlr --ipprint --barred-input -N --ragged --ojson cat ${CASEDIR}/input
|
||||
0
test/cases/io-barred-pprint/ragged-implicit/experr
Normal file
0
test/cases/io-barred-pprint/ragged-implicit/experr
Normal file
19
test/cases/io-barred-pprint/ragged-implicit/expout
Normal file
19
test/cases/io-barred-pprint/ragged-implicit/expout
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[
|
||||
{
|
||||
"1": "a",
|
||||
"2": "b",
|
||||
"3": "c"
|
||||
},
|
||||
{
|
||||
"1": "a",
|
||||
"2": "b",
|
||||
"3": ""
|
||||
},
|
||||
{
|
||||
"1": "a",
|
||||
"2": "b",
|
||||
"3": "c",
|
||||
"4": "d",
|
||||
"5": "e"
|
||||
}
|
||||
]
|
||||
4
test/cases/io-barred-pprint/ragged-implicit/input
Normal file
4
test/cases/io-barred-pprint/ragged-implicit/input
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
| a | b | c |
|
||||
| a | b |
|
||||
| a | b | c | d | e |
|
||||
+---+---+---+---+---+
|
||||
Loading…
Add table
Add a link
Reference in a new issue