dataframe-operations
Safe HaskellNone
LanguageHaskell2010

DataFrame.Operations.Inference

Description

Single-pass sampled inference lattice (Round-2 S2). One walk over the sampled cells maintains a candidate mask {Bool, Int, Double, Date} cleared by attempting the WS-B byte parsers; the assumption is the highest-priority surviving candidate. Shared by every reader (audit T1), together with the Int -> Double prefix promotion that replaces the full-column retry chain (audit T2).

Synopsis

Documentation

makeParsingAssumption :: DateFormat -> Vector (Maybe Text) -> ParsingAssumption Source #

Classify a sample of decoded Text cells (Nothing = null). Bool/Int/Double candidates are tested with the WS-B byte parsers on the UTF-8 bytes (strip-tolerant, overflow-rejecting); the Date candidate keeps parseTimeOpt so custom formats behave exactly as before. The walk exits early once every candidate is cleared.

byteStringDateParser :: DateFormat -> ByteString -> Maybe Day Source #

The default %Y-%m-%d format takes the WS-B byte-level fast path; custom formats keep the reference readByteStringDate parser.

promoteIntColumn :: (Int -> src -> Bool) -> (src -> Maybe Int) -> (src -> Maybe Double) -> Vector src -> Maybe Column Source #

Fused Int pass with in-place promotion (audit T2): on the first non-null cell that fails Int but parses as Double, the built Int prefix is converted by a vector map and the pass continues as Double over the retained raw cells. Nothing = some cell parses as neither (the caller demotes the column to Text). Null slots hold sentinels (0 / 0.0) guarded by the bitmap, exactly like the unpromoted passes.

promoteIntColumnIndexed :: Int -> (Int -> Bool) -> (Int -> Maybe Int) -> (Int -> Maybe Double) -> Maybe Column Source #

promoteIntColumn over row indices instead of a materialized cell vector (used by readers that keep cells as buffer offsets).

readIntStrict :: Text -> Maybe Int Source #

readInt that rejects overflow instead of wrapping. Fields of <= 18 chars cannot overflow and keep the Text-level parse; longer (rare) fields take the exact byte-level parser, so an overflowing cell demotes/promotes instead of silently wrapping.