Skip to content

Commit bba9d51

Browse files
dfa1claude
andcommitted
docs(csv): document type inference algorithm in inferColumnType
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d0016ef commit bba9d51

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

csv/src/main/java/io/github/dfa1/vortex/csv/CsvImporter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ private static DType.Struct inferSchema(String[] headers, List<String[]> rows, i
100100
return new DType.Struct(names, types, false);
101101
}
102102

103+
/// Infers the narrowest type for a column using a single pass.
104+
///
105+
/// Priority: long → double → bool → utf8. Each flag starts true and can only
106+
/// transition to false. Empty cells are skipped (compatible with any type).
107+
/// An all-empty column is inferred as long (all flags remain true).
103108
private static DType inferColumnType(List<String[]> rows, int colIdx) {
104109
boolean canBeLong = true;
105110
boolean canBeDouble = true;

0 commit comments

Comments
 (0)