[
https://issues.apache.org/jira/browse/SPARK-57321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenchen Fan resolved SPARK-57321.
---------------------------------
Fix Version/s: 4.3.0
Resolution: Fixed
Issue resolved by pull request 56254
[https://github.com/apache/spark/pull/56254]
> [SQL] Support schema inference of CSV files inside tar archives
> ---------------------------------------------------------------
>
> Key: SPARK-57321
> URL: https://issues.apache.org/jira/browse/SPARK-57321
> Project: Spark
> Issue Type: New Feature
> Components: SQL
> Affects Versions: 4.3.0
> Reporter: Akshat Shenoi
> Assignee: Akshat Shenoi
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.3.0
>
>
> SPARK-57135 added opt-in reading of CSV files packaged in tar archives (.tar,
> .tar.gz, .tgz), but only with an explicit schema — schema inference was out
> of scope, and inferring without a schema errors (UNABLE_TO_INFER_SCHEMA).
> This follow-up adds schema inference for tar archives, so
> spark.read.csv("data.tar") (with spark.sql.files.archive.reader.enabled=true)
> infers a schema instead of erroring, matching how a directory of the same CSV
> files is inferred:
> - CSVDataSource.inferSchema streams each archive's entries through the
> existing ArchiveReader (never unpacking to disk), tokenizes each entry like a
> standalone CSV file (dropping its header row when header=true), and feeds all
> entries' rows into a single CSVInferSchema pass keyed on the first entry's
> header — the same first-header, type-widening model used for a multi-file CSV
> read.
> - When archives and loose CSV files are read together, the two inferred
> schemas are merged positionally with CSV-aware type widening.
> - ignoreCorruptFiles / ignoreMissingFiles are honored at archive granularity,
> matching the loose-file path.
> - Reuses the spark.sql.files.archive.reader.enabled config from SPARK-57135;
> no new config.
> Scope: CSV over tar, building on SPARK-57135. Inference for other file
> formats (JSON, text, XML) follows their respective read support.
> Tests: directory parity, all archive formats agree, corrupt-archive skip
> among good ones, cross-entry type widening, and mixed archive + loose-file
> inference.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]