You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/05 02:42:44 UTC

[GitHub] [arrow-rs] tustvold opened a new pull request, #3022: Split out arrow-ipc

tustvold opened a new pull request, #3022:
URL: https://github.com/apache/arrow-rs/pull/3022

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Part of #2594
   
   # Rationale for this change
    
   <!--
   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?
   
   <!--
   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.
   -->
   
   Splits out the arrow-ipc crate
   
   # Are there any user-facing changes?
   
   No breaking changes, there is a slight change in that CompressionCodec now contains all variants even when no features are enabled.
   
   <!--
   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 add the `breaking change` label.
   -->
   


-- 
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


[GitHub] [arrow-rs] ursabot commented on pull request #3022: Split out arrow-ipc

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #3022:
URL: https://github.com/apache/arrow-rs/pull/3022#issuecomment-1304746678

   Benchmark runs are scheduled for baseline = 108e7d276a83bfd9c3144005e0a000e8331fdfaa and contender = deb64554f9d25afa044248293b31ab7c26f0e42f. deb64554f9d25afa044248293b31ab7c26f0e42f is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/85be5072883f4839a23b83ac026732fe...4190e465497e47a9bda8eaf472fe9db5/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/e9516bfcec06442e95054fcb2788b99b...e093dea9c69d47838dd9208859739831/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/b22ea179df5d4c28963d2975bb7df07b...64ce576f48ed417f83e66bfe113a133f/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/060427eff1c346c3a95a3e116b59b886...17f01be0d90e438fb995ceda2cb5424f/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3022: Split out arrow-ipc

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #3022:
URL: https://github.com/apache/arrow-rs/pull/3022#discussion_r1014551942


##########
arrow-ipc/src/compression.rs:
##########
@@ -115,50 +117,85 @@ impl CompressionCodec {
 
     /// Compress the data in input buffer and write to output buffer
     /// using the specified compression
-    fn compress(&self, input: &[u8], output: &mut Vec<u8>) -> Result<()> {
+    fn compress(&self, input: &[u8], output: &mut Vec<u8>) -> Result<(), ArrowError> {
         match self {
-            CompressionCodec::Lz4Frame => {
-                let mut encoder = lz4::EncoderBuilder::new().build(output)?;
-                encoder.write_all(input)?;
-                match encoder.finish().1 {
-                    Ok(_) => Ok(()),
-                    Err(e) => Err(e.into()),
-                }
-            }
-            CompressionCodec::Zstd => {
-                let mut encoder = zstd::Encoder::new(output, 0)?;
-                encoder.write_all(input)?;
-                match encoder.finish() {
-                    Ok(_) => Ok(()),
-                    Err(e) => Err(e.into()),
-                }
-            }
+            CompressionCodec::Lz4Frame => compress_lz4(input, output),
+            CompressionCodec::Zstd => compress_zstd(input, output),
         }
     }
 
     /// Decompress the data in input buffer and write to output buffer
     /// using the specified compression
-    fn decompress(&self, input: &[u8], output: &mut Vec<u8>) -> Result<usize> {
-        let result: Result<usize> = match self {
-            CompressionCodec::Lz4Frame => {
-                let mut decoder = lz4::Decoder::new(input)?;
-                match decoder.read_to_end(output) {
-                    Ok(size) => Ok(size),
-                    Err(e) => Err(e.into()),
-                }
-            }
-            CompressionCodec::Zstd => {
-                let mut decoder = zstd::Decoder::new(input)?;
-                match decoder.read_to_end(output) {
-                    Ok(size) => Ok(size),
-                    Err(e) => Err(e.into()),
-                }
-            }
-        };
-        result
+    fn decompress(
+        &self,
+        input: &[u8],
+        output: &mut Vec<u8>,
+    ) -> Result<usize, ArrowError> {
+        match self {
+            CompressionCodec::Lz4Frame => decompress_lz4(input, output),
+            CompressionCodec::Zstd => decompress_zstd(input, output),
+        }
     }
 }
 
+#[cfg(feature = "lz4")]

Review Comment:
   We now have separate features for the different compression codecs



-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3022: Split out arrow-ipc

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #3022:
URL: https://github.com/apache/arrow-rs/pull/3022#discussion_r1014552245


##########
arrow/tests/ipc_integration.rs:
##########
@@ -0,0 +1,44 @@
+use arrow_ipc::reader::StreamReader;
+use arrow_ipc::writer::StreamWriter;
+use std::fs::File;
+use std::io::Seek;
+
+#[test]
+fn read_union_017() {

Review Comment:
   This test needed to be moved as test_util is still part of the top-level crate, this makes more sense as an integration test anyway so I think this is fine



-- 
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


[GitHub] [arrow-rs] tustvold merged pull request #3022: Split out arrow-ipc

Posted by GitBox <gi...@apache.org>.
tustvold merged PR #3022:
URL: https://github.com/apache/arrow-rs/pull/3022


-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3022: Split out arrow-ipc

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #3022:
URL: https://github.com/apache/arrow-rs/pull/3022#discussion_r1014552445


##########
arrow-ipc/src/writer.rs:
##########
@@ -1626,45 +1610,6 @@ mod tests {
         assert!(dict_tracker.written.contains_key(&2));
     }
 
-    #[test]

Review Comment:
   Moved to an integration test



-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3022: Split out arrow-ipc

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #3022:
URL: https://github.com/apache/arrow-rs/pull/3022#discussion_r1014552144


##########
arrow-ipc/src/writer.rs:
##########
@@ -1503,18 +1501,18 @@ mod tests {
             ],
         )
         .unwrap();
-        let file_name = format!("target/debug/testdata/nulls_{}.arrow_file", suffix);
+        let mut file = tempfile::tempfile().unwrap();

Review Comment:
   This was failing about files not existing, I suspect some issue with moving to a different crate. Fortunately switching to use tempfile is cleaner and avoids this issue



-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3022: Split out arrow-ipc

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #3022:
URL: https://github.com/apache/arrow-rs/pull/3022#discussion_r1014552542


##########
arrow/src/ipc/compression/stub.rs:
##########
@@ -1,63 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-//! Stubs that implement the same interface as the ipc_compression
-//! codec module, but always errors.
-
-use crate::buffer::Buffer;
-use crate::error::{ArrowError, Result};
-use crate::ipc::CompressionType;
-
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub enum CompressionCodec {}

Review Comment:
   We no longer use a stub CompressionCodec, and instead generate runtime errors if the necessary features aren't enabled. This is consistent with how we handle this in parquet and how we handle other optional features such as timezone support



-- 
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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3022: Split out arrow-ipc

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #3022:
URL: https://github.com/apache/arrow-rs/pull/3022#discussion_r1014551892


##########
arrow-array/src/record_batch.rs:
##########
@@ -22,6 +22,24 @@ use crate::{new_empty_array, Array, ArrayRef, StructArray};
 use arrow_schema::{ArrowError, DataType, Field, Schema, SchemaRef};
 use std::sync::Arc;
 
+/// Trait for types that can read `RecordBatch`'s.
+pub trait RecordBatchReader: Iterator<Item = Result<RecordBatch, ArrowError>> {

Review Comment:
   This is moved from the arrow crate to allow using it in arrow-ipc and a future arrow-csv



-- 
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