From 6860ac2529981cdc73918463375c2a82d9d7b623 Mon Sep 17 00:00:00 2001 From: Sarah Gilmore Date: Thu, 13 Jun 2024 15:44:24 -0400 Subject: [PATCH] Add stub RecordBatchFileReader and RecordBatchFileWriter classes --- .../io/ipc/proxy/record_batch_file_reader.cc | 28 ++++++++++++++ .../io/ipc/proxy/record_batch_file_reader.h | 37 +++++++++++++++++++ .../io/ipc/proxy/record_batch_file_writer.cc | 28 ++++++++++++++ .../io/ipc/proxy/record_batch_file_writer.h | 35 ++++++++++++++++++ matlab/src/cpp/arrow/matlab/proxy/factory.cc | 4 ++ .../cmake/BuildMatlabArrowInterface.cmake | 4 +- 6 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_reader.cc create mode 100644 matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_reader.h create mode 100644 matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_writer.cc create mode 100644 matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_writer.h diff --git a/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_reader.cc b/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_reader.cc new file mode 100644 index 0000000000000..a7510d3691dee --- /dev/null +++ b/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_reader.cc @@ -0,0 +1,28 @@ +// 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. + +#include "arrow/matlab/io/ipc/proxy/record_batch_file_reader.h" + +namespace arrow::matlab::io::ipc::proxy { + +RecordBatchFileReader::RecordBatchFileReader(const std::shared_ptr reader) + : reader{std::move(reader)} {} + +libmexclass::proxy::MakeResult RecordBatchFileReader::make(const libmexclass::proxy::FunctionArguments& constructor_arguments) { + return libmexclass::error::Error{"arrow:matlab:NotImplemented", "Not Implemented"}; +} +} // namespace arrow::matlab::io::ipc::proxy \ No newline at end of file diff --git a/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_reader.h b/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_reader.h new file mode 100644 index 0000000000000..ffca47b103037 --- /dev/null +++ b/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_reader.h @@ -0,0 +1,37 @@ +// 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/reader.h" +#include "libmexclass/proxy/Proxy.h" + +namespace arrow::matlab::io::ipc::proxy { + +class RecordBatchFileReader : public libmexclass::proxy::Proxy { + public: + RecordBatchFileReader(std::shared_ptr reader); + + ~RecordBatchFileReader() = default; + + static libmexclass::proxy::MakeResult make(const libmexclass::proxy::FunctionArguments& constructor_arguments); + + protected: + std::shared_ptr reader; +}; + +} // namespace arrow::matlab::io::ipc::proxy \ No newline at end of file diff --git a/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_writer.cc b/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_writer.cc new file mode 100644 index 0000000000000..14d88bd6480a1 --- /dev/null +++ b/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_writer.cc @@ -0,0 +1,28 @@ +// 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. + +#include "arrow/matlab/io/ipc/proxy/record_batch_file_writer.h" + +namespace arrow::matlab::io::ipc::proxy { + +RecordBatchFileWriter::RecordBatchFileWriter(const std::shared_ptr writer) + : writer{std::move(writer)} {} + +libmexclass::proxy::MakeResult RecordBatchFileWriter::make(const libmexclass::proxy::FunctionArguments& constructor_arguments) { + return libmexclass::error::Error{"arrow:matlab:NotImplemented", "Not Implemented"}; +} +} // namespace arrow::matlab::io::ipc::proxy \ No newline at end of file diff --git a/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_writer.h b/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_writer.h new file mode 100644 index 0000000000000..91eb1908149c8 --- /dev/null +++ b/matlab/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_writer.h @@ -0,0 +1,35 @@ +// 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. + +#include "arrow/ipc/writer.h" +#include "libmexclass/proxy/Proxy.h" + +namespace arrow::matlab::io::ipc::proxy { + +class RecordBatchFileWriter : public libmexclass::proxy::Proxy { + public: + RecordBatchFileWriter(std::shared_ptr writer); + + ~RecordBatchFileWriter() = default; + + static libmexclass::proxy::MakeResult make(const libmexclass::proxy::FunctionArguments& constructor_arguments); + + protected: + std::shared_ptr writer; +}; + +} // namespace arrow::matlab::io::ipc::proxy \ No newline at end of file diff --git a/matlab/src/cpp/arrow/matlab/proxy/factory.cc b/matlab/src/cpp/arrow/matlab/proxy/factory.cc index 53a19da82e334..8326b4371917a 100644 --- a/matlab/src/cpp/arrow/matlab/proxy/factory.cc +++ b/matlab/src/cpp/arrow/matlab/proxy/factory.cc @@ -34,6 +34,8 @@ #include "arrow/matlab/io/csv/proxy/table_writer.h" #include "arrow/matlab/io/feather/proxy/reader.h" #include "arrow/matlab/io/feather/proxy/writer.h" +#include "arrow/matlab/io/ipc/proxy/record_batch_file_reader.h" +#include "arrow/matlab/io/ipc/proxy/record_batch_file_writer.h" #include "arrow/matlab/tabular/proxy/record_batch.h" #include "arrow/matlab/tabular/proxy/schema.h" #include "arrow/matlab/tabular/proxy/table.h" @@ -107,6 +109,8 @@ libmexclass::proxy::MakeResult Factory::make_proxy( REGISTER_PROXY(arrow.c.proxy.ArrayImporter , arrow::matlab::c::proxy::ArrayImporter); REGISTER_PROXY(arrow.c.proxy.Schema , arrow::matlab::c::proxy::Schema); REGISTER_PROXY(arrow.c.proxy.RecordBatchImporter , arrow::matlab::c::proxy::RecordBatchImporter); + REGISTER_PROXY(arrow.io.ipc.proxy.RecordBatchFileReader , arrow::matlab::io::ipc::proxy::RecordBatchFileReader); + REGISTER_PROXY(arrow.io.ipc.proxy.RecordBatchFileWriter , arrow::matlab::io::ipc::proxy::RecordBatchFileWriter); // clang-format on return libmexclass::error::Error{error::UNKNOWN_PROXY_ERROR_ID, diff --git a/matlab/tools/cmake/BuildMatlabArrowInterface.cmake b/matlab/tools/cmake/BuildMatlabArrowInterface.cmake index 0a747e648cd84..5ed68ec246ee5 100644 --- a/matlab/tools/cmake/BuildMatlabArrowInterface.cmake +++ b/matlab/tools/cmake/BuildMatlabArrowInterface.cmake @@ -79,7 +79,9 @@ set(MATLAB_ARROW_LIBMEXCLASS_CLIENT_PROXY_SOURCES "${CMAKE_SOURCE_DIR}/src/cpp/a "${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/c/proxy/array.cc" "${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/c/proxy/array_importer.cc" "${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/c/proxy/schema.cc" - "${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/c/proxy/record_batch_importer.cc") + "${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/c/proxy/record_batch_importer.cc" + "${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_reader.cc" + "${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/io/ipc/proxy/record_batch_file_writer.cc") set(MATLAB_ARROW_LIBMEXCLASS_CLIENT_PROXY_FACTORY_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/proxy")