feat(ingestion/s3,ingestion/abs): add .zip archive support to data lake connectors#17006
Open
acrylJonny wants to merge 2 commits intomasterfrom
Open
feat(ingestion/s3,ingestion/abs): add .zip archive support to data lake connectors#17006acrylJonny wants to merge 2 commits intomasterfrom
acrylJonny wants to merge 2 commits intomasterfrom
Conversation
Contributor
|
Linear: ING-2266 |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Connector Tests ResultsAll connector tests passed for commit To skip connector tests, add the Autogenerated by the connector-tests CI pipeline. |
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.
Summary
Extends the S3 and Azure Blob Storage (ABS) data lake connectors to support
.ziparchives in addition to the existing.gzand.bz2compression formats.Unlike
.gz/.bz2(single-stream, transparently decompressed bysmart_open),.zipis a multi-file archive whose central directory lives at the end of the file. Efficient reading therefore requires random access rather than streaming. This PR implements that using HTTP range requests, avoiding the need to download the entire archive before inspecting it.Changes
Core — schema inference
SeekableS3FileandSeekableABSFile— file-like wrappers that satisfyzipfile.ZipFile's seekable interface by issuing byte-range requests (Range: bytes=X-Y) to S3 / Azure Blob Storage._open_zip_entry()to bothS3SourceandABSSource. Opens the first entry with a supported extension (.csv,.json,.parquet, etc.) and returns its bytes as anio.BytesIOalong with the inner extension, which is then used for schema inference exactly like any other file format."zip"toSUPPORTED_COMPRESSIONSinPathSpec. Validation accepts.csv.zip,.json.zip,.parquet.zip, etc. as validincludepatterns.Core — Spark profiling (
s3/profiling.py).csv.zip,.json.zip,.tsv.zip) are handled transparently by Hadoop's built-inZipCodec— the original S3 path is passed to Spark unchanged..parquet.zip,.avro.zip) bypass Hadoop's codec factory, so a new_extract_zip_to_tmp()helper downloads the archive, extracts the inner file to aNamedTemporaryFile, and passes the local path to Spark. The tempfile is deleted in a
finallyblock regardless of success or failure.