Compute the ordered union of object keys across the first sample_size
records. Order of first occurrence is preserved so the column layout is
stable. Non-object records are skipped.
Parse JSON content as either a JSON array of objects or JSONL
(newline-delimited JSON, one object per line). The format is detected by
peeking at the first non-whitespace byte: [ starts an array, anything
else is parsed line-by-line.