Skip to content

Add generalized support for Apache Compress formats - #7497

Merged
tfmorris merged 8 commits into
OpenRefine:masterfrom
tfmorris:2741-apache-compress
Oct 21, 2025
Merged

tfmorris merged 8 commits into
OpenRefine:masterfrom
tfmorris:2741-apache-compress

Conversation

@tfmorris

Copy link
Copy Markdown
Member

Fixes #2741

Changes proposed in this pull request:

  • Add test for Unix compress .Z files (supported by base Apache Compress)
  • add optional dependency XZ to enable support for XZ, LZMA, & 7zip
  • SevenZip decompressor requires special handling since it uses
    a SeekableByteChannel rather than a Stream
  • Add xz to the list of compressors that support concatenated streams
  • Add ZStandard optional dependency for Apache Compress and zstd tests

…#2741

- Add test for Unix compress .Z files (supported by base Apache Compress)
- add optional dependency XZ to enable support for XZ, LZMA, & 7zip
- SevenZip decompressor requires special handling since it uses
  a SeekableByteChannel rather than a Stream
- Add xz to the list of compressors that support concatenated streams
@github-actions github-actions Bot added Type: Feature Request Identifies requests for new features or enhancements. These involve proposing new improvements. Priority: Low Indicates less critical issues that can be dealt with at a later stage import About importers in general - add a label for the data format if available new data format Requests for creation of new importers/exporters labels Oct 16, 2025
@tfmorris
tfmorris requested a review from Copilot October 16, 2025 03:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive support for additional Apache Compress formats including XZ, LZMA, 7zip, ZStandard, and Unix compress (.Z files). The changes enable OpenRefine to handle these compression formats during import operations with proper streaming support where available and special handling for SevenZip's seekable channel requirements.

Key Changes:

  • Added XZ and ZStandard dependencies to enable new compression format support
  • Implemented special handling for 7zip archives using SeekableByteChannel
  • Extended test coverage for all newly supported compression formats (.Z, .lzma, .xz, .zst, .7z)

Reviewed Changes

Copilot reviewed 5 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
modules/core/pom.xml Added xz and zstd-jni dependencies to support new compression formats
modules/core/src/main/java/com/google/refine/importing/ImportingUtilities.java Added SevenZFile handling, StreamingNotSupportedException catch, and refactored stream management
modules/core/src/main/java/com/google/refine/importing/DefaultImportingController.java Added TODO comments for optimizing preview data processing
main/tests/server/src/com/google/refine/importing/ImportingUtilitiesTests.java Extended tests to cover new formats and refactored archive import tests to be format-agnostic
main/tests/data/persons.csv.Z Added test file for Unix compress format

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tfmorris
tfmorris requested a review from Copilot October 16, 2025 04:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 9 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tfmorris
tfmorris requested a review from SoryRawyer October 16, 2025 04:30

@SoryRawyer SoryRawyer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just have the one question about the buffer size variable but otherwise this looks good to me.

- remove unused constant
- remove redundant/ignored keywords
- remove redundant semicolons
- Now correctly handles .tar.gz / .tgz files
- Add a test case to cover this so it doesn't break again

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 6 out of 11 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

modules/core/src/main/java/com/google/refine/importing/ImportingUtilities.java:1

  • Corrected 'it's' to 'its' - should use possessive form rather than contraction.
/*

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tfmorris

Copy link
Copy Markdown
Member Author

@SoryRawyer Sorry to ask you to review this twice. I removed the constant mentioned in your previous review, but also, more importantly, fixed the import of compressed archives (e.g. .tar.gz) and added a test to cover that case.

@SoryRawyer SoryRawyer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just have that one small question, but that shouldn't block anything. Looks good and I think it's easier to read now too.

}
if (!entry.isDirectory()) {
ObjectNode fileRecord2 = processArchiveEntry(rawDataDir, archiveFileRecord, progress, entry.getName(),
zf.getInputStream(entry));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in a try-with-resources block like the 7zip case below, or does that not make much of a difference here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. For some reason my IDE didn't flag either of these cases, which I don't really understand, but the second one is fixed now too.

@tfmorris
tfmorris merged commit 8b578e4 into OpenRefine:master Oct 21, 2025
17 checks passed
@tfmorris
tfmorris deleted the 2741-apache-compress branch October 21, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

import About importers in general - add a label for the data format if available new data format Requests for creation of new importers/exporters Priority: Low Indicates less critical issues that can be dealt with at a later stage Type: Feature Request Identifies requests for new features or enhancements. These involve proposing new improvements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support more compression & archive formats

3 participants