Greg Hansen created SPARK-58917:
-----------------------------------

             Summary: Respect inferSchema for variant ingestion in CSV parser
                 Key: SPARK-58917
                 URL: https://issues.apache.org/jira/browse/SPARK-58917
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 4.4.0
            Reporter: Greg Hansen


The CSV to Variant parser (used by the `singleVariantColumn` option and 
explicit `VariantType` columns) always infers scalar types (long, decimal, 
date, timestamp, boolean) regardless of the `inferSchema` option, so a value 
like "0001" is stored as the integer 1 rather than the string "0001".

A new CSV read option `variantRespectInferSchema` makes the parser honor 
`inferSchema`: when it is set to true and `inferSchema` is false, scalar CSV 
values are preserved as strings inside the Variant instead of being inferred.

The option defaults to false, preserving the existing always-infer behavior so 
existing results are unchanged; users opt in per read. A reader option allows 
users to set this on-read via `.option(...)`.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to