Renaming fields takes too much time #627
Replies: 2 comments
-
I guess it's because miller supports so much more than simple CSV files. For example you could have something like
in the same file. Renaming b would still work and produce the expected output. If you do unsparsify, you would end with only a single table. If you know for certain you have a simple csv file, you could do something like |
Beta Was this translation helpful? Give feedback.
-
Indeed -- Miller turns an input file into a stream of records which are -- individually -- ordered lists of key-value pairs, then processes those, then turns that into an output file. This is what makes it able to abstract most processing in a file-format-independent way -- CSV/TSV, JSON, DKVP/XTAB, someday (hopefully soon) a subset of YAML all can use the same logic for So even though the CSV file has keys only on line 1, in memory the keys are in every record:
becomes (in memory)
This is a very flexible and powerful design in general ... in the context of file format = CSV and transformation = rename, though, it does look absurd in terms of its performance ... :^/ |
Beta Was this translation helpful? Give feedback.
-
With
why would
rename
take
?
Why does renaming fields need to parse the whole file and not only the header?
Beta Was this translation helpful? Give feedback.
All reactions