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

[PR] GH-44922: [MATLAB] Add IPC `RecordBatchStreamFileWriter` MATLAB class [arrow]

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

   <!--
   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
   
   <!--
    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.
   -->
   
   ### Are these changes tested?
   
   <!--
   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?
   
   <!--
   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-44922: [MATLAB] Add IPC `RecordBatchStreamFileWriter` MATLAB class [arrow]

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


##########
matlab/src/matlab/+arrow/+io/+ipc/RecordBatchWriter.m:
##########
@@ -0,0 +1,75 @@
+%RECORDBATCHWRITER Class for serializing record batches to the Arrow
+% IPC format.
+
+% 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.
+
+

Review Comment:
   Extra newline here.



-- 
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-44922: [MATLAB] Add IPC `RecordBatchStreamFileWriter` MATLAB class [arrow]

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

   After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 2b5a80245d336e17ff149eca33e666fae71c04bf.
   
   There were 132 benchmark results with an error:
   
   - Commit Run on `arm64-t4g-2xlarge-linux` at [2024-12-04 17:36:18Z](https://conbench.ursa.dev/compare/runs/8095de3a997b45b69ff8164ee4b304aa...2783a4eae1944cfca60141c768fcf41b/)
     - [`tpch` (R) with engine=arrow, format=parquet, language=R, memory_map=False, query_id=TPCH-07, scale_factor=1](https://conbench.ursa.dev/benchmark-results/06750a173e6f79bd80008d1d5b2901f3)
     - [`tpch` (R) with engine=arrow, format=native, language=R, memory_map=False, query_id=TPCH-09, scale_factor=1](https://conbench.ursa.dev/benchmark-results/06750a19ba29726f800014c5277268a5)
   - and 130 more (see the report linked below)
   
   There were 2 benchmark results indicating a performance regression:
   
   - Commit Run on `amd64-m5-4xlarge-linux` at [2024-12-04 18:31:06Z](https://conbench.ursa.dev/compare/runs/229dc6d118ae42aea188a2000a3ed474...38d57a347ae741f89405b7a164a4d122/)
     - [`dataset-read` (Python) with async=True, dataset=nyctaxi_multi_parquet_s3, pre_buffer=true](https://conbench.ursa.dev/compare/benchmarks/067506e48fed7bb7800086e974e74cd9...06750a320bcd71da8000c033443b94ba)
     - [`dataset-read` (Python) with async=True, dataset=nyctaxi_multi_ipc_s3](https://conbench.ursa.dev/compare/benchmarks/067506ea66ca7533800041d8d2d35900...06750a37ff377db880009812d5156d33)
   
   The [full Conbench report](https://github.com/apache/arrow/runs/33940829043) has more details. It also includes information about 29 possible false positives for unstable benchmarks that are known to sometimes produce them.


-- 
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-44922: [MATLAB] Add IPC `RecordBatchStreamFileWriter` MATLAB class [arrow]

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


##########
matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_writer.h:
##########
@@ -0,0 +1,44 @@
+// 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.
+
+#pragma once
+
+#include "arrow/ipc/writer.h"
+#include "libmexclass/proxy/Proxy.h"
+
+namespace arrow::matlab::io::ipc::proxy {
+
+class RecordBatchWriter : public libmexclass::proxy::Proxy {
+ public:
+  RecordBatchWriter(std::shared_ptr<arrow::ipc::RecordBatchWriter> writer);
+
+  virtual ~RecordBatchWriter() = default;
+
+  static libmexclass::proxy::MakeResult make(
+      const libmexclass::proxy::FunctionArguments& constructor_arguments);

Review Comment:
   Yes! I'll delete this.



-- 
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-44922: [MATLAB] Add IPC `RecordBatchStreamFileWriter` MATLAB class [arrow]

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


##########
matlab/src/matlab/+arrow/+io/+ipc/RecordBatchWriter.m:
##########
@@ -0,0 +1,75 @@
+%RECORDBATCHWRITER Class for serializing record batches to the Arrow
+% IPC format.
+
+% 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.
+
+

Review Comment:
   Extra newline.



-- 
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-44922: [MATLAB] Add IPC `RecordBatchStreamFileWriter` MATLAB class [arrow]

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


##########
matlab/src/matlab/+arrow/+io/+ipc/RecordBatchWriter.m:
##########
@@ -0,0 +1,75 @@
+%RECORDBATCHWRITER Class for serializing record batches to the Arrow
+% IPC format.
+
+% 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.
+
+

Review Comment:
   ```suggestion
   ```



-- 
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-44922: [MATLAB] Add IPC `RecordBatchStreamFileWriter` MATLAB class [arrow]

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


##########
matlab/src/matlab/+arrow/+io/+ipc/RecordBatchFileWriter.m:
##########
@@ -1,5 +1,5 @@
-%RECORDBATCHFILEWRITER Class for serializing record batches to a file using
-% the IPC format.
+%RECORDBATCHFILEWRITER Class for serializing record batches the IPC File

Review Comment:
   ```suggestion
   %RECORDBATCHFILEWRITER Class for serializing record batches to the Arrow IPC File
   ```



##########
matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_writer.h:
##########
@@ -0,0 +1,44 @@
+// 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.
+
+#pragma once
+
+#include "arrow/ipc/writer.h"
+#include "libmexclass/proxy/Proxy.h"
+
+namespace arrow::matlab::io::ipc::proxy {
+
+class RecordBatchWriter : public libmexclass::proxy::Proxy {
+ public:
+  RecordBatchWriter(std::shared_ptr<arrow::ipc::RecordBatchWriter> writer);
+
+  virtual ~RecordBatchWriter() = default;
+
+  static libmexclass::proxy::MakeResult make(
+      const libmexclass::proxy::FunctionArguments& constructor_arguments);

Review Comment:
   Can we remove this?
   
   I think that `RecordBatchWriter` is an abstract class.



-- 
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-44922: [MATLAB] Add IPC `RecordBatchStreamFileWriter` MATLAB class [arrow]

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


##########
matlab/src/matlab/+arrow/+io/+ipc/RecordBatchWriter.m:
##########
@@ -0,0 +1,75 @@
+%RECORDBATCHWRITER Class for serializing record batches to the Arrow
+% IPC format.
+
+% 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.
+
+
+classdef (Abstract) RecordBatchWriter < matlab.mixin.Scalar
+
+    properties(SetAccess=private, GetAccess=public, Hidden)
+        Proxy
+    end
+
+    methods
+        function obj = RecordBatchWriter(proxy)
+            arguments
+                proxy(1, 1) libmexclass.proxy.Proxy
+            end
+            obj.Proxy = proxy;
+        end
+
+        function writeRecordBatch(obj, recordBatch)
+            arguments
+                obj(1, 1) arrow.io.ipc.RecordBatchWriter
+                recordBatch(1, 1) arrow.tabular.RecordBatch
+            end
+
+            args = struct(RecordBatchProxyID=recordBatch.Proxy.ID);
+            obj.Proxy.writeRecordBatch(args);
+        end
+
+        function writeTable(obj, arrowTable)
+            arguments
+                obj(1, 1) arrow.io.ipc.RecordBatchWriter
+                arrowTable(1, 1) arrow.tabular.Table
+            end
+
+            args = struct(TableProxyID=arrowTable.Proxy.ID);
+            obj.Proxy.writeTable(args);
+        end
+
+        function write(obj, tabularObj)
+            arguments
+                obj(1, 1) arrow.io.ipc.RecordBatchWriter
+                tabularObj(1, 1)
+            end
+            if isa(tabularObj, "arrow.tabular.RecordBatch")
+                obj.writeRecordBatch(tabularObj);
+            elseif isa(tabularObj, "arrow.tabular.Table")
+                obj.writeTable(tabularObj);
+            else
+                id = "arrow:matlab:ipc:write:InvalidType";
+                msg = "tabularObj input argument must be an instance of " + ...

Review Comment:
   ```suggestion
                   msg = "Input must be an instance of " + ...
   ```



##########
matlab/src/matlab/+arrow/+io/+ipc/RecordBatchWriter.m:
##########
@@ -0,0 +1,75 @@
+%RECORDBATCHWRITER Class for serializing record batches to the Arrow
+% IPC format.
+
+% 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.
+
+
+classdef (Abstract) RecordBatchWriter < matlab.mixin.Scalar
+
+    properties(SetAccess=private, GetAccess=public, Hidden)
+        Proxy
+    end
+
+    methods
+        function obj = RecordBatchWriter(proxy)
+            arguments
+                proxy(1, 1) libmexclass.proxy.Proxy
+            end
+            obj.Proxy = proxy;
+        end
+
+        function writeRecordBatch(obj, recordBatch)
+            arguments
+                obj(1, 1) arrow.io.ipc.RecordBatchWriter
+                recordBatch(1, 1) arrow.tabular.RecordBatch
+            end
+
+            args = struct(RecordBatchProxyID=recordBatch.Proxy.ID);
+            obj.Proxy.writeRecordBatch(args);
+        end
+
+        function writeTable(obj, arrowTable)
+            arguments
+                obj(1, 1) arrow.io.ipc.RecordBatchWriter
+                arrowTable(1, 1) arrow.tabular.Table
+            end
+
+            args = struct(TableProxyID=arrowTable.Proxy.ID);
+            obj.Proxy.writeTable(args);
+        end
+
+        function write(obj, tabularObj)
+            arguments
+                obj(1, 1) arrow.io.ipc.RecordBatchWriter
+                tabularObj(1, 1)
+            end
+            if isa(tabularObj, "arrow.tabular.RecordBatch")
+                obj.writeRecordBatch(tabularObj);
+            elseif isa(tabularObj, "arrow.tabular.Table")
+                obj.writeTable(tabularObj);
+            else
+                id = "arrow:matlab:ipc:write:InvalidType";

Review Comment:
   ```suggestion
                   id = "arrow:matlab:io:ipc:write:InvalidType";
   ```



-- 
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-44922: [MATLAB] Add IPC `RecordBatchStreamFileWriter` MATLAB class [arrow]

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


##########
matlab/src/matlab/+arrow/+io/+ipc/RecordBatchWriter.m:
##########
@@ -0,0 +1,75 @@
+%RECORDBATCHWRITER Class for serializing record batches to the Arrow
+% IPC format.
+
+% 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.
+
+

Review Comment:
   Extra newline here.



-- 
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-44922: [MATLAB] Add IPC `RecordBatchStreamFileWriter` MATLAB class [arrow]

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


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