kevingurney commented on code in PR #37015:
URL: https://github.com/apache/arrow/pull/37015#discussion_r1284702298
##########
matlab/src/cpp/arrow/matlab/tabular/proxy/record_batch.cc:
##########
@@ -18,17 +18,42 @@
#include "libmexclass/proxy/ProxyManager.h"
#include "arrow/matlab/array/proxy/array.h"
+#include "arrow/matlab/array/proxy/wrap.h"
+
#include "arrow/matlab/error/error.h"
#include "arrow/matlab/tabular/proxy/record_batch.h"
#include "arrow/type.h"
#include "arrow/util/utf8.h"
+#include "libmexclass/proxy/ProxyManager.h"
+#include "libmexclass/error/Error.h"
+
+#include <sstream>
+
namespace arrow::matlab::tabular::proxy {
+ namespace {
+ libmexclass::error::Error make_empty_record_batch_error() {
Review Comment:
FYI - I used lowerCamelCase here:
https://github.com/apache/arrow/pull/37013/files#diff-edaf8f57d4e37cd6648979e4cb029e5a1fdb107861fd3dd1f7faa6fc52efb1caR33.
Maybe we should do the same here for consistency.
##########
matlab/src/cpp/arrow/matlab/tabular/proxy/record_batch.cc:
##########
@@ -18,17 +18,42 @@
#include "libmexclass/proxy/ProxyManager.h"
#include "arrow/matlab/array/proxy/array.h"
+#include "arrow/matlab/array/proxy/wrap.h"
+
#include "arrow/matlab/error/error.h"
#include "arrow/matlab/tabular/proxy/record_batch.h"
#include "arrow/type.h"
#include "arrow/util/utf8.h"
+#include "libmexclass/proxy/ProxyManager.h"
+#include "libmexclass/error/Error.h"
+
+#include <sstream>
+
namespace arrow::matlab::tabular::proxy {
+ namespace {
+ libmexclass::error::Error make_empty_record_batch_error() {
+ const std::string error_msg = "Numeric indexing using the column
method is not supported for record batches with no columns.";
+ return
libmexclass::error::Error{error::RECORD_BATCH_NUMERIC_INDEX_WITH_EMPTY_RECORD_BATCH,
error_msg};
+ }
+
+ libmexclass::error::Error make_invalid_numeric_index_error(const
int32_t matlab_index, const int32_t num_columns) {
+ std::stringstream error_message_stream;
+ error_message_stream << "Invalid column index: ";
+ error_message_stream << matlab_index;
+ error_message_stream << ". Column index must be between 1 and the
number of fields (";
Review Comment:
"number of fields" -> "number of columns"
##########
matlab/src/matlab/+arrow/+tabular/RecordBatch.m:
##########
@@ -42,23 +38,35 @@
end
function arrowArray = column(obj, idx)
- arrowArray = obj.ArrowArrays{idx};
+ if ~isempty(idx) && isscalar(idx) && isnumeric(idx) && idx >= 1
+ args = struct(Index=int32(idx));
+ [proxyID, typeID] = obj.Proxy.getColumnByIndex(args);
+ traits = arrow.type.traits.traits(arrow.type.ID(typeID));
+ proxy =
libmexclass.proxy.Proxy(Name=traits.ArrayProxyClassName, ID=proxyID);
+ arrowArray = traits.ArrayConstructor(proxy);
+ else
+ errid =
"arrow:tabular:recordbatch:UnsupportedColumndIndexType";
Review Comment:
UnsupportedColumn**d**IndexType -> UnsupportedColumnIndexType
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]