Skip to content

[Repo Assist] Fix Frame.ReadCsv schema ignored when inferTypes=false#615

Merged
dsyme merged 3 commits intomasterfrom
repo-assist/fix-issue-347-csv-schema-infertypes-852b16121e44f733
Mar 14, 2026
Merged

[Repo Assist] Fix Frame.ReadCsv schema ignored when inferTypes=false#615
dsyme merged 3 commits intomasterfrom
repo-assist/fix-issue-347-csv-schema-infertypes-852b16121e44f733

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Repo Assist — automated bug fix (Task 3: Issue Investigation and Fix).

Closes #347

Root Cause

In FrameUtils.readCsv, the inferTypes=false code path unconditionally set all columns to string, ignoring the schema parameter entirely:

| Some false ->
    // Schema was never consulted here
    headers |> Array.map (fun c -> PrimitiveInferedProperty.Create(c, typeof(string), true, None))

The schema argument was only passed to InferColumnTypes in the inferTypes=true/None branch.

Fix

When inferTypes=false and a non-empty schema is provided, we now call InferColumnTypes so that the schema overrides are respected. Columns explicitly specified in the schema use the declared type; columns not mentioned in the schema are still inferred from data (which is the most useful behaviour when the caller has declared overrides for a subset of columns).

| Some false when schema <> "" ->
    data.InferColumnTypes(inferRows, missingValues, cultureInfo, schema, safeMode, preferOptionals)
    |> Array.ofSeq
| Some false ->
    // no schema: fall back to all-string behaviour as before
    ...

The XML documentation comments on ReadCsv are also updated to clarify that schema overrides are respected even when inferTypes=false.

Usage example

// Schema types are now respected even with inferTypes=false
let df = Frame.ReadCsv(reader, inferTypes=false, schema="Value=int,Flag=bool")
// Previously: all columns were string
// Now: Value is int, Flag is bool

Test Status

  • New regression test Schema is respected when inferTypes=false (regression #347) added to Frame.fs
  • All 495 existing tests pass on Ubuntu (dotnet test tests/Deedle.Tests/Deedle.Tests.fsproj -c Release)

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@30f2254f2a7a944da1224df45d181a3f8faefd0d

)

When inferTypes=false and a schema is also provided, the schema was previously
ignored entirely and all columns were treated as strings. This change ensures
the schema overrides are applied when a schema is present, regardless of the
inferTypes setting.

Fixes #347

Co-authored-by: Copilot <[email protected]>
@dsyme dsyme marked this pull request as ready for review March 14, 2026 00:27
@dsyme dsyme merged commit 5d2be31 into master Mar 14, 2026
2 checks passed
@dsyme dsyme deleted the repo-assist/fix-issue-347-csv-schema-infertypes-852b16121e44f733 branch March 14, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Frame.ReadCsv infer types / schema interaction is wonky

1 participant