Conversation
…337 The Decimal.TryParse call in TextConversions.AsDecimal used NumberStyles.Currency, which does not include AllowExponent. As a result, values like '9.51E-05' would fail to parse as decimal and silently become missing values when a CSV column was inferred as decimal (because earlier sampled rows contained plain decimal values). Fix: add NumberStyles.AllowExponent to the flags so decimal parsing now accepts both plain and scientific-notation decimal literals. Also adds a regression test verifying that a CSV with scientific-notation values in a decimal-inferred column parses correctly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Repo Assist — automated bug fix (Task 3: Issue Investigation and Fix)
Summary
Fixes a bug reported in #337: CSV columns inferred as
decimalsilently dropped values written in scientific notation (e.g.9.51E-05).Root Cause
TextConversions.AsDecimalcalledDecimal.TryParsewithNumberStyles.Currency, which does not includeAllowExponent. So:"7.058365954"→ parsed as decimal ✅"9.51E-05"→ decimal fails (no exponent support) → becomes missing value ❌When the CSV type-inference engine samples the first N rows and they all contain plain decimal values, the column is typed as
decimal. Subsequent rows with scientific-notation values then silently produceOptionalValue.Missing.Fix
Add
NumberStyles.AllowExponentto theNumberStylesflags inAsDecimal:This is the minimal, targeted fix requested by
@dsymein the issue.Trade-offs
NumberStyles.Currencystill handles currency symbols and group separators.AllowExponentonly enables theE/eexponent notation; it doesn't allow any previously-rejected inputs other than scientific notation.Test Status
Decimal columns accept scientific notation values (regression #337)inFrame.fs