Skip to content

[test] Move gzip helper from core production code to hive test#8396

Open
cxzl25 wants to merge 3 commits into
apache:masterfrom
cxzl25:fix_gzip
Open

[test] Move gzip helper from core production code to hive test#8396
cxzl25 wants to merge 3 commits into
apache:masterfrom
cxzl25:fix_gzip

Conversation

@cxzl25

@cxzl25 cxzl25 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Purpose

CompressUtils.gzipCompressFile was only used by a single Hive IT test
(HiveCatalogFormatTableITCaseBase) but was placed in paimon-core main,
unnecessarily inflating the production jar.

  • Delete CompressUtils from paimon-core/src/main/java
  • Inline the logic as a private static helper in the test base class
  • Fix the resource leak in the process: the original implementation
    only closed streams on the happy path; rewrite using try-with-resources
    so streams are always closed even when an IOException is thrown

Tests

GHA

return result;
}

private static void gzipCompressFile(String src, String dest) throws IOException {

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.

Making this helper local to the Hive test leaves another caller broken. paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/FormatTableTestBase.scala still imports org.apache.paimon.utils.CompressUtils and calls CompressUtils.gzipCompressFile, so deleting the core class will make the Spark test module fail to compile. Please either move the helper to a shared test utility used by both modules, or update the Spark test to use its own/local helper as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants