This commit is contained in:
John Kerl 2026-03-02 23:49:31 -05:00 committed by GitHub
parent 56add7d1f0
commit ed0ae66ac2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 32 additions and 6 deletions

View file

@ -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 {

View file

@ -0,0 +1 @@
mlr --ipprint --barred-input -N --ragged --ojson cat ${CASEDIR}/input

View 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"
}
]

View file

@ -0,0 +1,4 @@
| a | b | c |
| a | b |
| a | b | c | d | e |
+---+---+---+---+---+