lidavidm commented on code in PR #34227:
URL: https://github.com/apache/arrow/pull/34227#discussion_r1154684280
##########
java/dataset/src/main/cpp/jni_wrapper.cc:
##########
@@ -261,6 +264,26 @@ void JNI_OnUnload(JavaVM* vm, void* reserved) {
default_memory_pool_id = -1L;
}
+/// Iterate over an object array of Tables Name on position `i` and theirs
+/// Memory Address representation on `i+1` position linearly.
+/// Return a mapping of the Table Name to Query as a Key and a
RecordBatchReader
+/// as a Value.
+std::unordered_map<std::string, std::shared_ptr<arrow::Table>>
ToMapTableToArrowReader(JNIEnv* env, jobjectArray& str_array) {
+ std::unordered_map<std::string, std::shared_ptr<arrow::Table>>
map_table_to_record_batch_reader;
+ int length = env->GetArrayLength(str_array);
+ std::shared_ptr<arrow::Table> output_table;
+ for (int pos = 0; pos < length; pos++) {
Review Comment:
The JNI method is still accessible and I don't see why we can't have the
proper checks here.
##########
java/dataset/src/main/cpp/jni_wrapper.cc:
##########
@@ -261,6 +264,26 @@ void JNI_OnUnload(JavaVM* vm, void* reserved) {
default_memory_pool_id = -1L;
}
+/// Iterate over an object array of Tables Name on position `i` and theirs
+/// Memory Address representation on `i+1` position linearly.
+/// Return a mapping of the Table Name to Query as a Key and a
RecordBatchReader
+/// as a Value.
+std::unordered_map<std::string, std::shared_ptr<arrow::Table>>
ToMapTableToArrowReader(JNIEnv* env, jobjectArray& str_array) {
+ std::unordered_map<std::string, std::shared_ptr<arrow::Table>>
map_table_to_record_batch_reader;
+ int length = env->GetArrayLength(str_array);
+ std::shared_ptr<arrow::Table> output_table;
+ for (int pos = 0; pos < length; pos++) {
+ auto j_string_key =
reinterpret_cast<jstring>(env->GetObjectArrayElement(str_array, pos));
+ pos++;
+ auto j_string_value =
reinterpret_cast<jstring>(env->GetObjectArrayElement(str_array, pos));
+ auto* arrow_stream_in =
reinterpret_cast<ArrowArrayStream*>(std::stol(JStringToCString(env,
j_string_value)));
Review Comment:
We should catch possible errors.
--
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]