You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "joellubi (via GitHub)" <gi...@apache.org> on 2024/08/26 21:52:10 UTC

[PR] GH-43790: [Go][Parquet] Add support for LZ4_RAW compression codec [arrow]

joellubi opened a new pull request, #43835:
URL: https://github.com/apache/arrow/pull/43835

   <!--
   Thanks for opening a pull request!
   If this is your first pull request you can find detailed information on how 
   to contribute here:
     * [New Contributor's Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
     * [Contributing Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
   
   
   If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
   
   Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
   
   Then could you also rename the pull request title in the following format?
   
       GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   In the case of PARQUET issues on JIRA the title also supports:
   
       PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   -->
   
   ### Rationale for this change
   
   Fixes: #43790
   
   The LZ4 compression codec for Parquet is no longer ambiguous, as it has been superceded by the [LZ4_RAW](https://github.com/apache/parquet-format/blob/master/Compression.md#lz4_raw) spec.
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   ### What changes are included in this PR?
   
   - Add `LZ4Raw` compression codec
   - Split out `StreamingCodec` methods from core `Codec` interface
   - Various conformance/roundtrip tests
   - Set of benchmarks for reading/writing an Arrow table to/from Parquet, using each compression codec
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ### Are these changes tested?
   
   Yes
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   ### Are there any user-facing changes?
   
   - New codec `LZ4Raw` is available
   - `Codec` interface no long provides the following methods, which are now part of `StreamingCodec`:
     - `NewReader`
     - `NewWriter`
     - `NewWriterLevel`
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please uncomment the line below and explain which changes are breaking.
   -->
   <!-- **This PR includes breaking changes to public APIs.** -->
   
   <!--
   Please uncomment the line below (and provide explanation) if the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld). We use this to highlight fixes to issues that may affect users without their knowledge. For this reason, fixing bugs that cause errors don't count, since those are usually obvious.
   -->
   <!-- **This PR contains a "Critical Fix".** -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43790: [Go][Parquet] Add support for LZ4_RAW compression codec [arrow]

Posted by "conbench-apache-arrow[bot] (via GitHub)" <gi...@apache.org>.
conbench-apache-arrow[bot] commented on PR #43835:
URL: https://github.com/apache/arrow/pull/43835#issuecomment-2313876079

   After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 6502f0e3ad046d361aba44385ab3379ed7af5b7f.
   
   There were no benchmark performance regressions. 🎉
   
   The [full Conbench report](https://github.com/apache/arrow/runs/29340341718) has more details.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43790: [Go][Parquet] Add support for LZ4_RAW compression codec [arrow]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #43835:
URL: https://github.com/apache/arrow/pull/43835#discussion_r1733200184


##########
go/parquet/compress/compress.go:
##########
@@ -49,8 +49,9 @@ var Codecs = struct {
 	Brotli Compression
 	// LZ4 unsupported in this library due to problematic issues between the Hadoop LZ4 spec vs regular lz4
 	// see: http://mail-archives.apache.org/mod_mbox/arrow-dev/202007.mbox/%3CCAAri41v24xuA8MGHLDvgSnE+7AAgOhiEukemW_oPNHMvfMmrWw@mail.gmail.com%3E
-	Lz4  Compression
-	Zstd Compression
+	Lz4    Compression

Review Comment:
   Both is ok for me, we can draft a separate pr for that?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43790: [Go][Parquet] Add support for LZ4_RAW compression codec [arrow]

Posted by "joellubi (via GitHub)" <gi...@apache.org>.
joellubi commented on code in PR #43835:
URL: https://github.com/apache/arrow/pull/43835#discussion_r1733217836


##########
go/parquet/compress/compress.go:
##########
@@ -49,8 +49,9 @@ var Codecs = struct {
 	Brotli Compression
 	// LZ4 unsupported in this library due to problematic issues between the Hadoop LZ4 spec vs regular lz4
 	// see: http://mail-archives.apache.org/mod_mbox/arrow-dev/202007.mbox/%3CCAAri41v24xuA8MGHLDvgSnE+7AAgOhiEukemW_oPNHMvfMmrWw@mail.gmail.com%3E
-	Lz4  Compression
-	Zstd Compression
+	Lz4    Compression

Review Comment:
   Ok sure. I just reverted that commit, will add it back in a follow-up PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43790: [Go][Parquet] Add support for LZ4_RAW compression codec [arrow]

Posted by "joellubi (via GitHub)" <gi...@apache.org>.
joellubi merged PR #43835:
URL: https://github.com/apache/arrow/pull/43835


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43790: [Go][Parquet] Add support for LZ4_RAW compression codec [arrow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #43835:
URL: https://github.com/apache/arrow/pull/43835#issuecomment-2311164939

   :warning: GitHub issue #43790 **has been automatically assigned in GitHub** to PR creator.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43790: [Go][Parquet] Add support for LZ4_RAW compression codec [arrow]

Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #43835:
URL: https://github.com/apache/arrow/pull/43835#discussion_r1733033762


##########
go/parquet/compress/compress.go:
##########
@@ -49,8 +49,9 @@ var Codecs = struct {
 	Brotli Compression
 	// LZ4 unsupported in this library due to problematic issues between the Hadoop LZ4 spec vs regular lz4
 	// see: http://mail-archives.apache.org/mod_mbox/arrow-dev/202007.mbox/%3CCAAri41v24xuA8MGHLDvgSnE+7AAgOhiEukemW_oPNHMvfMmrWw@mail.gmail.com%3E
-	Lz4  Compression
-	Zstd Compression
+	Lz4    Compression

Review Comment:
   Nit: maybe we can rename this to LZ4_HADOOP to prevent from misunderstanding



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43790: [Go][Parquet] Add support for LZ4_RAW compression codec [arrow]

Posted by "joellubi (via GitHub)" <gi...@apache.org>.
joellubi commented on PR #43835:
URL: https://github.com/apache/arrow/pull/43835#issuecomment-2312895450

   > LGTM
   > 
   > How do the benchmarks look?
   
   ```
   goos: darwin
   goarch: arm64
   pkg: github.com/apache/arrow/go/v18/parquet/pqarrow
   BenchmarkWriteTableCompressed/codec=UNCOMPRESSED-14                   13         101496837 ns/op         546.93 MB/s    222180261 B/op   1297249 allocs/op
   BenchmarkWriteTableCompressed/codec=SNAPPY-14                         10         105285342 ns/op         527.25 MB/s    190905955 B/op   1297284 allocs/op
   BenchmarkWriteTableCompressed/codec=GZIP-14                            7         163399286 ns/op         339.73 MB/s    196390286 B/op   1297654 allocs/op
   BenchmarkWriteTableCompressed/codec=BROTLI-14                          2         503086730 ns/op         110.34 MB/s    698402444 B/op   1298624 allocs/op
   BenchmarkWriteTableCompressed/codec=ZSTD-14                            8         139438708 ns/op         398.11 MB/s    1014671664 B/op  1298644 allocs/op
   BenchmarkWriteTableCompressed/codec=LZ4_RAW-14                         9         115800444 ns/op         479.38 MB/s    167152016 B/op   1297259 allocs/op
   BenchmarkReadTableCompressed/codec=UNCOMPRESSED-14                    42          34890312 ns/op         561.85 MB/s    235618446 B/op      2431 allocs/op
   BenchmarkReadTableCompressed/codec=SNAPPY-14                          38          33923055 ns/op         272.67 MB/s    210971180 B/op      2428 allocs/op
   BenchmarkReadTableCompressed/codec=GZIP-14                            22          55319667 ns/op          80.78 MB/s    202261534 B/op      2721 allocs/op
   BenchmarkReadTableCompressed/codec=BROTLI-14                          16          71177099 ns/op          28.35 MB/s    233693905 B/op      2779 allocs/op
   BenchmarkReadTableCompressed/codec=ZSTD-14                            21          56364889 ns/op          37.02 MB/s    196485768 B/op      2444 allocs/op
   BenchmarkReadTableCompressed/codec=LZ4_RAW-14                         36          33904137 ns/op         267.63 MB/s    210578330 B/op      2427 allocs/op
   PASS
   ok      github.com/apache/arrow/go/v18/parquet/pqarrow  20.220s
   ```
   
   LZ4_RAW seems to be competitive with SNAPPY in terms of throughput, lagging behind it by a relatively small margin. Some research suggests that LZ4 _should_ be faster than Snappy in the general case, but a number of benchmarks on columnar data specifically tend to still skew towards Snappy for speed. So I'd say these results are consistent with expectations.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43790: [Go][Parquet] Add support for LZ4_RAW compression codec [arrow]

Posted by "joellubi (via GitHub)" <gi...@apache.org>.
joellubi commented on code in PR #43835:
URL: https://github.com/apache/arrow/pull/43835#discussion_r1733195424


##########
go/parquet/compress/compress.go:
##########
@@ -49,8 +49,9 @@ var Codecs = struct {
 	Brotli Compression
 	// LZ4 unsupported in this library due to problematic issues between the Hadoop LZ4 spec vs regular lz4
 	// see: http://mail-archives.apache.org/mod_mbox/arrow-dev/202007.mbox/%3CCAAri41v24xuA8MGHLDvgSnE+7AAgOhiEukemW_oPNHMvfMmrWw@mail.gmail.com%3E
-	Lz4  Compression
-	Zstd Compression
+	Lz4    Compression

Review Comment:
   The names here match the parquet spec names exactly, but I agree it would be helpful to limit confusion about this. I just pushed a change that returns a descriptive error when one of the unsupported codecs is used. Let me know what you think.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org