-
-
Notifications
You must be signed in to change notification settings - Fork 392
Parser: Type inference is locale-dependent and mishandles edge cases (inf, nan, leading spaces) #45
Copy link
Copy link
Closed
Labels
area:cpp-coreC++ Frame, Column, pybind11, memory, and core engine internalsC++ Frame, Column, pybind11, memory, and core engine internalsarea:csv-parserCSV reading, scanning, parsing, delimiters, encodings, row handlingCSV reading, scanning, parsing, delimiters, encodings, row handlingarea:pandas-interopto_pandas, from_pandas, dtype compatibility, pandas workflowsto_pandas, from_pandas, dtype compatibility, pandas workflowsbackendBackend, Python API, C++ core, parser, data engine, or library runtime workBackend, Python API, C++ core, parser, data engine, or library runtime workbugSomething isn't workingSomething isn't workingdifficulty:intermediateRequires understanding one or two modules and testsRequires understanding one or two modules and testsgssocPart of the GSSoC 2026 contributor programPart of the GSSoC 2026 contributor programgssoc:level-2GSSoC intermediate-level taskGSSoC intermediate-level tasklevel:intermediateGSSoC-compatible intermediate-level contribution labelGSSoC-compatible intermediate-level contribution labelpandas-compatPandas compatibility and interopPandas compatibility and interopparserCSV parser correctness and edge casesCSV parser correctness and edge casespriority:highImportant and should be handled soonImportant and should be handled soonsize:sSmall focused changeSmall focused changetype:bugGSSoC-compatible bug label for confirmed defectsGSSoC-compatible bug label for confirmed defects
Description
Metadata
Metadata
Assignees
Labels
area:cpp-coreC++ Frame, Column, pybind11, memory, and core engine internalsC++ Frame, Column, pybind11, memory, and core engine internalsarea:csv-parserCSV reading, scanning, parsing, delimiters, encodings, row handlingCSV reading, scanning, parsing, delimiters, encodings, row handlingarea:pandas-interopto_pandas, from_pandas, dtype compatibility, pandas workflowsto_pandas, from_pandas, dtype compatibility, pandas workflowsbackendBackend, Python API, C++ core, parser, data engine, or library runtime workBackend, Python API, C++ core, parser, data engine, or library runtime workbugSomething isn't workingSomething isn't workingdifficulty:intermediateRequires understanding one or two modules and testsRequires understanding one or two modules and testsgssocPart of the GSSoC 2026 contributor programPart of the GSSoC 2026 contributor programgssoc:level-2GSSoC intermediate-level taskGSSoC intermediate-level tasklevel:intermediateGSSoC-compatible intermediate-level contribution labelGSSoC-compatible intermediate-level contribution labelpandas-compatPandas compatibility and interopPandas compatibility and interopparserCSV parser correctness and edge casesCSV parser correctness and edge casespriority:highImportant and should be handled soonImportant and should be handled soonsize:sSmall focused changeSmall focused changetype:bugGSSoC-compatible bug label for confirmed defectsGSSoC-compatible bug label for confirmed defects
Description
The
infer_typefunction usesstd::strtollandstd::strtodwhich are locale-dependent on some platforms. In European locales where,is the decimal separator,"3.14"may be inferred as STRING instead of FLOAT64.Additionally, the inference has edge cases:
"inf"and"nan"are parsed as valid floats bystrtodbut should arguably be STRING" 123"(leading space) is treated as STRING because the space isn't trimmed before inference"1e10"is correctly inferred as FLOAT64 but"1E10"behavior may vary by platformAcceptance Criteria
std::strtodwith"C"locale explicitly, or use a locale-independent parser"inf","-inf","nan"are treated as FLOAT64 (matching pandas)Difficulty: Intermediate
Files:
cpp/src/csv_reader.cpp,tests/test_csv.py