This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 019d06df56 GH-37893: [Java] Move Types.proto in a subfolder (#37894)
019d06df56 is described below

commit 019d06df56ba3215148465554948a4d93fd9c707
Author: Laurent Goujon <[email protected]>
AuthorDate: Thu Sep 28 07:50:51 2023 -0700

    GH-37893: [Java] Move Types.proto in a subfolder (#37894)
    
    
    
    ### Rationale for this change
    
    Types.proto is a Gandiva protobuf definition used by Gandiva to exchange 
data between Java and C++. This file is packaged automatically within 
arrow-gandiva jar but because of its generic name, it may cause conflicts in 
others' people project.
    
    ### What changes are included in this PR?
    
    Move `Types.proto` into `gandiva/types.proto` (also matching convention of 
using lowercase filename) so that it become less likely to cause a conflict.
    
    ### Are these changes tested?
    
    Change should have no impact on the feature itself. Manually check the 
resulting jar to confirm that `types.proto` is not located at the root of the 
archive.
    
    ### Are there any user-facing changes?
    
    No user-facing. Developers who were actually referencing Gandiva 
`Types.proto` in their project may have to change their `import` directive.
    
    **This PR includes breaking changes to public APIs.**
    
    * Closes: #37893
    
    Authored-by: Laurent Goujon <[email protected]>
    Signed-off-by: David Li <[email protected]>
---
 java/gandiva/CMakeLists.txt                        |  10 +-
 .../proto/{Types.proto => gandiva/types.proto}     |   4 +-
 .../src/main/cpp/expression_registry_helper.cc     |  87 ++++++------
 java/gandiva/src/main/cpp/jni_common.cc            | 152 ++++++++++-----------
 4 files changed, 126 insertions(+), 127 deletions(-)

diff --git a/java/gandiva/CMakeLists.txt b/java/gandiva/CMakeLists.txt
index 629ab2fb34..2aa8d92959 100644
--- a/java/gandiva/CMakeLists.txt
+++ b/java/gandiva/CMakeLists.txt
@@ -29,21 +29,21 @@ add_jar(arrow_java_jni_gandiva_jar
         arrow_java_jni_gandiva_headers)
 
 set(GANDIVA_PROTO_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
-set(GANDIVA_PROTO_OUTPUT_FILES "${GANDIVA_PROTO_OUTPUT_DIR}/Types.pb.cc"
-                               "${GANDIVA_PROTO_OUTPUT_DIR}/Types.pb.h")
+set(GANDIVA_PROTO_OUTPUT_FILES 
"${GANDIVA_PROTO_OUTPUT_DIR}/gandiva/types.pb.cc"
+                               
"${GANDIVA_PROTO_OUTPUT_DIR}/gandiva/types.pb.h")
 
 set_source_files_properties(${GANDIVA_PROTO_OUTPUT_FILES} PROPERTIES GENERATED 
TRUE)
 
 set(GANDIVA_PROTO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/proto)
-get_filename_component(GANDIVA_PROTO_FILE_ABSOLUTE 
${GANDIVA_PROTO_DIR}/Types.proto
-                       ABSOLUTE)
+get_filename_component(GANDIVA_PROTO_FILE_ABSOLUTE
+                       ${GANDIVA_PROTO_DIR}/gandiva/types.proto ABSOLUTE)
 
 find_package(Protobuf REQUIRED)
 add_custom_command(OUTPUT ${GANDIVA_PROTO_OUTPUT_FILES}
                    COMMAND protobuf::protoc --proto_path ${GANDIVA_PROTO_DIR} 
--cpp_out
                            ${GANDIVA_PROTO_OUTPUT_DIR} 
${GANDIVA_PROTO_FILE_ABSOLUTE}
                    DEPENDS ${GANDIVA_PROTO_FILE_ABSOLUTE}
-                   COMMENT "Running Protobuf compiler on Types.proto"
+                   COMMENT "Running Protobuf compiler on gandiva/types.proto"
                    VERBATIM)
 
 add_custom_target(garrow_java_jni_gandiva_proto ALL DEPENDS 
${GANDIVA_PROTO_OUTPUT_FILES})
diff --git a/java/gandiva/proto/Types.proto 
b/java/gandiva/proto/gandiva/types.proto
similarity index 99%
rename from java/gandiva/proto/Types.proto
rename to java/gandiva/proto/gandiva/types.proto
index eb0d996b92..4ce342681d 100644
--- a/java/gandiva/proto/Types.proto
+++ b/java/gandiva/proto/gandiva/types.proto
@@ -15,8 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
-syntax = "proto2";
-package types;
+syntax = "proto3";
+package gandiva.types;
 
 option java_package = "org.apache.arrow.gandiva.ipc";
 option java_outer_classname = "GandivaTypes";
diff --git a/java/gandiva/src/main/cpp/expression_registry_helper.cc 
b/java/gandiva/src/main/cpp/expression_registry_helper.cc
index 6765df3b97..66b97c8b9e 100644
--- a/java/gandiva/src/main/cpp/expression_registry_helper.cc
+++ b/java/gandiva/src/main/cpp/expression_registry_helper.cc
@@ -20,121 +20,120 @@
 #include <arrow/util/logging.h>
 #include <gandiva/arrow.h>
 #include <gandiva/expression_registry.h>
-
-#include "Types.pb.h"
-#include "org_apache_arrow_gandiva_evaluator_ExpressionRegistryJniHelper.h"
+#include <gandiva/types.pb.h>
+#include <org_apache_arrow_gandiva_evaluator_ExpressionRegistryJniHelper.h>
 
 using gandiva::DataTypePtr;
 using gandiva::ExpressionRegistry;
 
-types::TimeUnit MapTimeUnit(arrow::TimeUnit::type& unit) {
+gandiva::types::TimeUnit MapTimeUnit(arrow::TimeUnit::type& unit) {
   switch (unit) {
     case arrow::TimeUnit::MILLI:
-      return types::TimeUnit::MILLISEC;
+      return gandiva::types::TimeUnit::MILLISEC;
     case arrow::TimeUnit::SECOND:
-      return types::TimeUnit::SEC;
+      return gandiva::types::TimeUnit::SEC;
     case arrow::TimeUnit::MICRO:
-      return types::TimeUnit::MICROSEC;
+      return gandiva::types::TimeUnit::MICROSEC;
     case arrow::TimeUnit::NANO:
-      return types::TimeUnit::NANOSEC;
+      return gandiva::types::TimeUnit::NANOSEC;
   }
   // satisfy gcc. should be unreachable.
-  return types::TimeUnit::SEC;
+  return gandiva::types::TimeUnit::SEC;
 }
 
-void ArrowToProtobuf(DataTypePtr type, types::ExtGandivaType* 
gandiva_data_type) {
+void ArrowToProtobuf(DataTypePtr type, gandiva::types::ExtGandivaType* 
gandiva_data_type) {
   switch (type->id()) {
     case arrow::Type::BOOL:
-      gandiva_data_type->set_type(types::GandivaType::BOOL);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::BOOL);
       break;
     case arrow::Type::UINT8:
-      gandiva_data_type->set_type(types::GandivaType::UINT8);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::UINT8);
       break;
     case arrow::Type::INT8:
-      gandiva_data_type->set_type(types::GandivaType::INT8);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::INT8);
       break;
     case arrow::Type::UINT16:
-      gandiva_data_type->set_type(types::GandivaType::UINT16);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::UINT16);
       break;
     case arrow::Type::INT16:
-      gandiva_data_type->set_type(types::GandivaType::INT16);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::INT16);
       break;
     case arrow::Type::UINT32:
-      gandiva_data_type->set_type(types::GandivaType::UINT32);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::UINT32);
       break;
     case arrow::Type::INT32:
-      gandiva_data_type->set_type(types::GandivaType::INT32);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::INT32);
       break;
     case arrow::Type::UINT64:
-      gandiva_data_type->set_type(types::GandivaType::UINT64);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::UINT64);
       break;
     case arrow::Type::INT64:
-      gandiva_data_type->set_type(types::GandivaType::INT64);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::INT64);
       break;
     case arrow::Type::HALF_FLOAT:
-      gandiva_data_type->set_type(types::GandivaType::HALF_FLOAT);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::HALF_FLOAT);
       break;
     case arrow::Type::FLOAT:
-      gandiva_data_type->set_type(types::GandivaType::FLOAT);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::FLOAT);
       break;
     case arrow::Type::DOUBLE:
-      gandiva_data_type->set_type(types::GandivaType::DOUBLE);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::DOUBLE);
       break;
     case arrow::Type::STRING:
-      gandiva_data_type->set_type(types::GandivaType::UTF8);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::UTF8);
       break;
     case arrow::Type::BINARY:
-      gandiva_data_type->set_type(types::GandivaType::BINARY);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::BINARY);
       break;
     case arrow::Type::DATE32:
-      gandiva_data_type->set_type(types::GandivaType::DATE32);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::DATE32);
       break;
     case arrow::Type::DATE64:
-      gandiva_data_type->set_type(types::GandivaType::DATE64);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::DATE64);
       break;
     case arrow::Type::TIMESTAMP: {
-      gandiva_data_type->set_type(types::GandivaType::TIMESTAMP);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::TIMESTAMP);
       std::shared_ptr<arrow::TimestampType> cast_time_stamp_type =
           std::dynamic_pointer_cast<arrow::TimestampType>(type);
       arrow::TimeUnit::type unit = cast_time_stamp_type->unit();
-      types::TimeUnit time_unit = MapTimeUnit(unit);
+      gandiva::types::TimeUnit time_unit = MapTimeUnit(unit);
       gandiva_data_type->set_timeunit(time_unit);
       break;
     }
     case arrow::Type::TIME32: {
-      gandiva_data_type->set_type(types::GandivaType::TIME32);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::TIME32);
       std::shared_ptr<arrow::Time32Type> cast_time_32_type =
           std::dynamic_pointer_cast<arrow::Time32Type>(type);
       arrow::TimeUnit::type unit = cast_time_32_type->unit();
-      types::TimeUnit time_unit = MapTimeUnit(unit);
+      gandiva::types::TimeUnit time_unit = MapTimeUnit(unit);
       gandiva_data_type->set_timeunit(time_unit);
       break;
     }
     case arrow::Type::TIME64: {
-      gandiva_data_type->set_type(types::GandivaType::TIME32);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::TIME32);
       std::shared_ptr<arrow::Time64Type> cast_time_64_type =
           std::dynamic_pointer_cast<arrow::Time64Type>(type);
       arrow::TimeUnit::type unit = cast_time_64_type->unit();
-      types::TimeUnit time_unit = MapTimeUnit(unit);
+      gandiva::types::TimeUnit time_unit = MapTimeUnit(unit);
       gandiva_data_type->set_timeunit(time_unit);
       break;
     }
     case arrow::Type::NA:
-      gandiva_data_type->set_type(types::GandivaType::NONE);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::NONE);
       break;
     case arrow::Type::DECIMAL: {
-      gandiva_data_type->set_type(types::GandivaType::DECIMAL);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::DECIMAL);
       gandiva_data_type->set_precision(0);
       gandiva_data_type->set_scale(0);
       break;
     }
     case arrow::Type::INTERVAL_MONTHS:
-      gandiva_data_type->set_type(types::GandivaType::INTERVAL);
-      gandiva_data_type->set_intervaltype(types::IntervalType::YEAR_MONTH);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::INTERVAL);
+      
gandiva_data_type->set_intervaltype(gandiva::types::IntervalType::YEAR_MONTH);
       break;
     case arrow::Type::INTERVAL_DAY_TIME:
-      gandiva_data_type->set_type(types::GandivaType::INTERVAL);
-      gandiva_data_type->set_intervaltype(types::IntervalType::DAY_TIME);
+      gandiva_data_type->set_type(gandiva::types::GandivaType::INTERVAL);
+      
gandiva_data_type->set_intervaltype(gandiva::types::IntervalType::DAY_TIME);
       break;
     default:
       // un-supported types. test ensures that
@@ -146,10 +145,10 @@ void ArrowToProtobuf(DataTypePtr type, 
types::ExtGandivaType* gandiva_data_type)
 JNIEXPORT jbyteArray JNICALL
 
Java_org_apache_arrow_gandiva_evaluator_ExpressionRegistryJniHelper_getGandivaSupportedDataTypes(
  // NOLINT
     JNIEnv* env, jobject types_helper) {
-  types::GandivaDataTypes gandiva_data_types;
+  gandiva::types::GandivaDataTypes gandiva_data_types;
   auto supported_types = ExpressionRegistry::supported_types();
   for (auto const& type : supported_types) {
-    types::ExtGandivaType* gandiva_data_type = 
gandiva_data_types.add_datatype();
+    gandiva::types::ExtGandivaType* gandiva_data_type = 
gandiva_data_types.add_datatype();
     ArrowToProtobuf(type, gandiva_data_type);
   }
   auto size = static_cast<int>(gandiva_data_types.ByteSizeLong());
@@ -169,15 +168,15 @@ JNIEXPORT jbyteArray JNICALL
 
Java_org_apache_arrow_gandiva_evaluator_ExpressionRegistryJniHelper_getGandivaSupportedFunctions(
  // NOLINT
     JNIEnv* env, jobject types_helper) {
   ExpressionRegistry expr_registry;
-  types::GandivaFunctions gandiva_functions;
+  gandiva::types::GandivaFunctions gandiva_functions;
   for (auto function = expr_registry.function_signature_begin();
        function != expr_registry.function_signature_end(); function++) {
-    types::FunctionSignature* function_signature = 
gandiva_functions.add_function();
+    gandiva::types::FunctionSignature* function_signature = 
gandiva_functions.add_function();
     function_signature->set_name((*function).base_name());
-    types::ExtGandivaType* return_type = 
function_signature->mutable_returntype();
+    gandiva::types::ExtGandivaType* return_type = 
function_signature->mutable_returntype();
     ArrowToProtobuf((*function).ret_type(), return_type);
     for (auto& param_type : (*function).param_types()) {
-      types::ExtGandivaType* proto_param_type = 
function_signature->add_paramtypes();
+      gandiva::types::ExtGandivaType* proto_param_type = 
function_signature->add_paramtypes();
       ArrowToProtobuf(param_type, proto_param_type);
     }
   }
diff --git a/java/gandiva/src/main/cpp/jni_common.cc 
b/java/gandiva/src/main/cpp/jni_common.cc
index 43db266ff5..a5dff9981c 100644
--- a/java/gandiva/src/main/cpp/jni_common.cc
+++ b/java/gandiva/src/main/cpp/jni_common.cc
@@ -35,13 +35,13 @@
 #include <gandiva/projector.h>
 #include <gandiva/selection_vector.h>
 #include <gandiva/tree_expr_builder.h>
+#include <gandiva/types.pb.h>
+#include <org_apache_arrow_gandiva_evaluator_JniWrapper.h>
 
-#include "Types.pb.h"
 #include "config_holder.h"
 #include "env_helper.h"
 #include "id_to_module_map.h"
 #include "module_holder.h"
-#include "org_apache_arrow_gandiva_evaluator_JniWrapper.h"
 
 using gandiva::ConditionPtr;
 using gandiva::DataTypePtr;
@@ -65,7 +65,7 @@ using gandiva::FilterHolder;
 using gandiva::ProjectorHolder;
 
 // forward declarations
-NodePtr ProtoTypeToNode(const types::TreeNode& node);
+NodePtr ProtoTypeToNode(const gandiva::types::TreeNode& node);
 
 static jint JNI_VERSION = JNI_VERSION_1_6;
 
@@ -131,11 +131,11 @@ void JNI_OnUnload(JavaVM* vm, void* reserved) {
   env->DeleteGlobalRef(vector_expander_ret_class_);
 }
 
-DataTypePtr ProtoTypeToTime32(const types::ExtGandivaType& ext_type) {
+DataTypePtr ProtoTypeToTime32(const gandiva::types::ExtGandivaType& ext_type) {
   switch (ext_type.timeunit()) {
-    case types::SEC:
+    case gandiva::types::SEC:
       return arrow::time32(arrow::TimeUnit::SECOND);
-    case types::MILLISEC:
+    case gandiva::types::MILLISEC:
       return arrow::time32(arrow::TimeUnit::MILLI);
     default:
       std::cerr << "Unknown time unit: " << ext_type.timeunit() << " for 
time32\n";
@@ -143,11 +143,11 @@ DataTypePtr ProtoTypeToTime32(const 
types::ExtGandivaType& ext_type) {
   }
 }
 
-DataTypePtr ProtoTypeToTime64(const types::ExtGandivaType& ext_type) {
+DataTypePtr ProtoTypeToTime64(const gandiva::types::ExtGandivaType& ext_type) {
   switch (ext_type.timeunit()) {
-    case types::MICROSEC:
+    case gandiva::types::MICROSEC:
       return arrow::time64(arrow::TimeUnit::MICRO);
-    case types::NANOSEC:
+    case gandiva::types::NANOSEC:
       return arrow::time64(arrow::TimeUnit::NANO);
     default:
       std::cerr << "Unknown time unit: " << ext_type.timeunit() << " for 
time64\n";
@@ -155,15 +155,15 @@ DataTypePtr ProtoTypeToTime64(const 
types::ExtGandivaType& ext_type) {
   }
 }
 
-DataTypePtr ProtoTypeToTimestamp(const types::ExtGandivaType& ext_type) {
+DataTypePtr ProtoTypeToTimestamp(const gandiva::types::ExtGandivaType& 
ext_type) {
   switch (ext_type.timeunit()) {
-    case types::SEC:
+    case gandiva::types::SEC:
       return arrow::timestamp(arrow::TimeUnit::SECOND);
-    case types::MILLISEC:
+    case gandiva::types::MILLISEC:
       return arrow::timestamp(arrow::TimeUnit::MILLI);
-    case types::MICROSEC:
+    case gandiva::types::MICROSEC:
       return arrow::timestamp(arrow::TimeUnit::MICRO);
-    case types::NANOSEC:
+    case gandiva::types::NANOSEC:
       return arrow::timestamp(arrow::TimeUnit::NANO);
     default:
       std::cerr << "Unknown time unit: " << ext_type.timeunit() << " for 
timestamp\n";
@@ -171,11 +171,11 @@ DataTypePtr ProtoTypeToTimestamp(const 
types::ExtGandivaType& ext_type) {
   }
 }
 
-DataTypePtr ProtoTypeToInterval(const types::ExtGandivaType& ext_type) {
+DataTypePtr ProtoTypeToInterval(const gandiva::types::ExtGandivaType& 
ext_type) {
   switch (ext_type.intervaltype()) {
-    case types::YEAR_MONTH:
+    case gandiva::types::YEAR_MONTH:
       return arrow::month_interval();
-    case types::DAY_TIME:
+    case gandiva::types::DAY_TIME:
       return arrow::day_time_interval();
     default:
       std::cerr << "Unknown interval type: " << ext_type.intervaltype() << 
"\n";
@@ -183,59 +183,59 @@ DataTypePtr ProtoTypeToInterval(const 
types::ExtGandivaType& ext_type) {
   }
 }
 
-DataTypePtr ProtoTypeToDataType(const types::ExtGandivaType& ext_type) {
+DataTypePtr ProtoTypeToDataType(const gandiva::types::ExtGandivaType& 
ext_type) {
   switch (ext_type.type()) {
-    case types::NONE:
+    case gandiva::types::NONE:
       return arrow::null();
-    case types::BOOL:
+    case gandiva::types::BOOL:
       return arrow::boolean();
-    case types::UINT8:
+    case gandiva::types::UINT8:
       return arrow::uint8();
-    case types::INT8:
+    case gandiva::types::INT8:
       return arrow::int8();
-    case types::UINT16:
+    case gandiva::types::UINT16:
       return arrow::uint16();
-    case types::INT16:
+    case gandiva::types::INT16:
       return arrow::int16();
-    case types::UINT32:
+    case gandiva::types::UINT32:
       return arrow::uint32();
-    case types::INT32:
+    case gandiva::types::INT32:
       return arrow::int32();
-    case types::UINT64:
+    case gandiva::types::UINT64:
       return arrow::uint64();
-    case types::INT64:
+    case gandiva::types::INT64:
       return arrow::int64();
-    case types::HALF_FLOAT:
+    case gandiva::types::HALF_FLOAT:
       return arrow::float16();
-    case types::FLOAT:
+    case gandiva::types::FLOAT:
       return arrow::float32();
-    case types::DOUBLE:
+    case gandiva::types::DOUBLE:
       return arrow::float64();
-    case types::UTF8:
+    case gandiva::types::UTF8:
       return arrow::utf8();
-    case types::BINARY:
+    case gandiva::types::BINARY:
       return arrow::binary();
-    case types::DATE32:
+    case gandiva::types::DATE32:
       return arrow::date32();
-    case types::DATE64:
+    case gandiva::types::DATE64:
       return arrow::date64();
-    case types::DECIMAL:
+    case gandiva::types::DECIMAL:
       // TODO: error handling
       return arrow::decimal(ext_type.precision(), ext_type.scale());
-    case types::TIME32:
+    case gandiva::types::TIME32:
       return ProtoTypeToTime32(ext_type);
-    case types::TIME64:
+    case gandiva::types::TIME64:
       return ProtoTypeToTime64(ext_type);
-    case types::TIMESTAMP:
+    case gandiva::types::TIMESTAMP:
       return ProtoTypeToTimestamp(ext_type);
-    case types::INTERVAL:
+    case gandiva::types::INTERVAL:
       return ProtoTypeToInterval(ext_type);
-    case types::FIXED_SIZE_BINARY:
-    case types::LIST:
-    case types::STRUCT:
-    case types::UNION:
-    case types::DICTIONARY:
-    case types::MAP:
+    case gandiva::types::FIXED_SIZE_BINARY:
+    case gandiva::types::LIST:
+    case gandiva::types::STRUCT:
+    case gandiva::types::UNION:
+    case gandiva::types::DICTIONARY:
+    case gandiva::types::MAP:
       std::cerr << "Unhandled data type: " << ext_type.type() << "\n";
       return nullptr;
 
@@ -245,7 +245,7 @@ DataTypePtr ProtoTypeToDataType(const 
types::ExtGandivaType& ext_type) {
   }
 }
 
-FieldPtr ProtoTypeToField(const types::Field& f) {
+FieldPtr ProtoTypeToField(const gandiva::types::Field& f) {
   const std::string& name = f.name();
   DataTypePtr type = ProtoTypeToDataType(f.type());
   bool nullable = true;
@@ -256,7 +256,7 @@ FieldPtr ProtoTypeToField(const types::Field& f) {
   return field(name, type, nullable);
 }
 
-NodePtr ProtoTypeToFieldNode(const types::FieldNode& node) {
+NodePtr ProtoTypeToFieldNode(const gandiva::types::FieldNode& node) {
   FieldPtr field_ptr = ProtoTypeToField(node.field());
   if (field_ptr == nullptr) {
     std::cerr << "Unable to create field node from protobuf\n";
@@ -266,12 +266,12 @@ NodePtr ProtoTypeToFieldNode(const types::FieldNode& 
node) {
   return TreeExprBuilder::MakeField(field_ptr);
 }
 
-NodePtr ProtoTypeToFnNode(const types::FunctionNode& node) {
+NodePtr ProtoTypeToFnNode(const gandiva::types::FunctionNode& node) {
   const std::string& name = node.functionname();
   NodeVector children;
 
   for (int i = 0; i < node.inargs_size(); i++) {
-    const types::TreeNode& arg = node.inargs(i);
+    const gandiva::types::TreeNode& arg = node.inargs(i);
 
     NodePtr n = ProtoTypeToNode(arg);
     if (n == nullptr) {
@@ -291,7 +291,7 @@ NodePtr ProtoTypeToFnNode(const types::FunctionNode& node) {
   return TreeExprBuilder::MakeFunction(name, children, return_type);
 }
 
-NodePtr ProtoTypeToIfNode(const types::IfNode& node) {
+NodePtr ProtoTypeToIfNode(const gandiva::types::IfNode& node) {
   NodePtr cond = ProtoTypeToNode(node.cond());
   if (cond == nullptr) {
     std::cerr << "Unable to create cond node for if node\n";
@@ -319,11 +319,11 @@ NodePtr ProtoTypeToIfNode(const types::IfNode& node) {
   return TreeExprBuilder::MakeIf(cond, then_node, else_node, return_type);
 }
 
-NodePtr ProtoTypeToAndNode(const types::AndNode& node) {
+NodePtr ProtoTypeToAndNode(const gandiva::types::AndNode& node) {
   NodeVector children;
 
   for (int i = 0; i < node.args_size(); i++) {
-    const types::TreeNode& arg = node.args(i);
+    const gandiva::types::TreeNode& arg = node.args(i);
 
     NodePtr n = ProtoTypeToNode(arg);
     if (n == nullptr) {
@@ -335,11 +335,11 @@ NodePtr ProtoTypeToAndNode(const types::AndNode& node) {
   return TreeExprBuilder::MakeAnd(children);
 }
 
-NodePtr ProtoTypeToOrNode(const types::OrNode& node) {
+NodePtr ProtoTypeToOrNode(const gandiva::types::OrNode& node) {
   NodeVector children;
 
   for (int i = 0; i < node.args_size(); i++) {
-    const types::TreeNode& arg = node.args(i);
+    const gandiva::types::TreeNode& arg = node.args(i);
 
     NodePtr n = ProtoTypeToNode(arg);
     if (n == nullptr) {
@@ -351,7 +351,7 @@ NodePtr ProtoTypeToOrNode(const types::OrNode& node) {
   return TreeExprBuilder::MakeOr(children);
 }
 
-NodePtr ProtoTypeToInNode(const types::InNode& node) {
+NodePtr ProtoTypeToInNode(const gandiva::types::InNode& node) {
   NodePtr field = ProtoTypeToNode(node.node());
 
   if (node.has_intvalues()) {
@@ -417,7 +417,7 @@ NodePtr ProtoTypeToInNode(const types::InNode& node) {
   return nullptr;
 }
 
-NodePtr ProtoTypeToNullNode(const types::NullNode& node) {
+NodePtr ProtoTypeToNullNode(const gandiva::types::NullNode& node) {
   DataTypePtr data_type = ProtoTypeToDataType(node.type());
   if (data_type == nullptr) {
     std::cerr << "Unknown type " << data_type->ToString() << " for null 
node\n";
@@ -427,7 +427,7 @@ NodePtr ProtoTypeToNullNode(const types::NullNode& node) {
   return TreeExprBuilder::MakeNull(data_type);
 }
 
-NodePtr ProtoTypeToNode(const types::TreeNode& node) {
+NodePtr ProtoTypeToNode(const gandiva::types::TreeNode& node) {
   if (node.has_fieldnode()) {
     return ProtoTypeToFieldNode(node.fieldnode());
   }
@@ -494,7 +494,7 @@ NodePtr ProtoTypeToNode(const types::TreeNode& node) {
   return nullptr;
 }
 
-ExpressionPtr ProtoTypeToExpression(const types::ExpressionRoot& root) {
+ExpressionPtr ProtoTypeToExpression(const gandiva::types::ExpressionRoot& 
root) {
   NodePtr root_node = ProtoTypeToNode(root.root());
   if (root_node == nullptr) {
     std::cerr << "Unable to create expression node from expression protobuf\n";
@@ -510,7 +510,7 @@ ExpressionPtr ProtoTypeToExpression(const 
types::ExpressionRoot& root) {
   return TreeExprBuilder::MakeExpression(root_node, field);
 }
 
-ConditionPtr ProtoTypeToCondition(const types::Condition& condition) {
+ConditionPtr ProtoTypeToCondition(const gandiva::types::Condition& condition) {
   NodePtr root_node = ProtoTypeToNode(condition.root());
   if (root_node == nullptr) {
     return nullptr;
@@ -519,7 +519,7 @@ ConditionPtr ProtoTypeToCondition(const types::Condition& 
condition) {
   return TreeExprBuilder::MakeCondition(root_node);
 }
 
-SchemaPtr ProtoTypeToSchema(const types::Schema& schema) {
+SchemaPtr ProtoTypeToSchema(const gandiva::types::Schema& schema) {
   std::vector<FieldPtr> fields;
 
   for (int i = 0; i < schema.columns_size(); i++) {
@@ -608,11 +608,11 @@ JNIEXPORT jlong JNICALL 
Java_org_apache_arrow_gandiva_evaluator_JniWrapper_build
   std::shared_ptr<Projector> projector;
   std::shared_ptr<ProjectorHolder> holder;
 
-  types::Schema schema;
+  gandiva::types::Schema schema;
   jsize schema_len = env->GetArrayLength(schema_arr);
   jbyte* schema_bytes = env->GetByteArrayElements(schema_arr, 0);
 
-  types::ExpressionList exprs;
+  gandiva::types::ExpressionList exprs;
   jsize exprs_len = env->GetArrayLength(exprs_arr);
   jbyte* exprs_bytes = env->GetByteArrayElements(exprs_arr, 0);
 
@@ -643,7 +643,7 @@ JNIEXPORT jlong JNICALL 
Java_org_apache_arrow_gandiva_evaluator_JniWrapper_build
     goto err_out;
   }
 
-  // convert types::Schema to arrow::Schema
+  // convert gandiva::types::Schema to arrow::Schema
   schema_ptr = ProtoTypeToSchema(schema);
   if (schema_ptr == nullptr) {
     ss << "Unable to construct arrow schema object from schema protobuf\n";
@@ -666,13 +666,13 @@ JNIEXPORT jlong JNICALL 
Java_org_apache_arrow_gandiva_evaluator_JniWrapper_build
   }
 
   switch (selection_vector_type) {
-    case types::SV_NONE:
+    case gandiva::types::SV_NONE:
       mode = gandiva::SelectionVector::MODE_NONE;
       break;
-    case types::SV_INT16:
+    case gandiva::types::SV_INT16:
       mode = gandiva::SelectionVector::MODE_UINT16;
       break;
-    case types::SV_INT32:
+    case gandiva::types::SV_INT32:
       mode = gandiva::SelectionVector::MODE_UINT32;
       break;
   }
@@ -809,17 +809,17 @@ 
Java_org_apache_arrow_gandiva_evaluator_JniWrapper_evaluateProjector(
         reinterpret_cast<uint8_t*>(sel_vec_addr), sel_vec_size);
     int output_row_count = 0;
     switch (sel_vec_type) {
-      case types::SV_NONE: {
+      case gandiva::types::SV_NONE: {
         output_row_count = num_rows;
         break;
       }
-      case types::SV_INT16: {
+      case gandiva::types::SV_INT16: {
         status = gandiva::SelectionVector::MakeImmutableInt16(
             sel_vec_rows, selection_buffer, &selection_vector);
         output_row_count = sel_vec_rows;
         break;
       }
-      case types::SV_INT32: {
+      case gandiva::types::SV_INT32: {
         status = gandiva::SelectionVector::MakeImmutableInt32(
             sel_vec_rows, selection_buffer, &selection_vector);
         output_row_count = sel_vec_rows;
@@ -909,11 +909,11 @@ JNIEXPORT jlong JNICALL 
Java_org_apache_arrow_gandiva_evaluator_JniWrapper_build
   std::shared_ptr<Filter> filter;
   std::shared_ptr<FilterHolder> holder;
 
-  types::Schema schema;
+  gandiva::types::Schema schema;
   jsize schema_len = env->GetArrayLength(schema_arr);
   jbyte* schema_bytes = env->GetByteArrayElements(schema_arr, 0);
 
-  types::Condition condition;
+  gandiva::types::Condition condition;
   jsize condition_len = env->GetArrayLength(condition_arr);
   jbyte* condition_bytes = env->GetByteArrayElements(condition_arr, 0);
 
@@ -943,7 +943,7 @@ JNIEXPORT jlong JNICALL 
Java_org_apache_arrow_gandiva_evaluator_JniWrapper_build
     goto err_out;
   }
 
-  // convert types::Schema to arrow::Schema
+  // convert gandiva::types::Schema to arrow::Schema
   schema_ptr = ProtoTypeToSchema(schema);
   if (schema_ptr == nullptr) {
     ss << "Unable to construct arrow schema object from schema protobuf\n";
@@ -1008,15 +1008,15 @@ JNIEXPORT jint JNICALL 
Java_org_apache_arrow_gandiva_evaluator_JniWrapper_evalua
     }
 
     auto selection_vector_type =
-        static_cast<types::SelectionVectorType>(jselection_vector_type);
+        
static_cast<gandiva::types::SelectionVectorType>(jselection_vector_type);
     auto out_buffer = std::make_shared<arrow::MutableBuffer>(
         reinterpret_cast<uint8_t*>(out_buf_addr), out_buf_size);
     switch (selection_vector_type) {
-      case types::SV_INT16:
+      case gandiva::types::SV_INT16:
         status =
             gandiva::SelectionVector::MakeInt16(num_rows, out_buffer, 
&selection_vector);
         break;
-      case types::SV_INT32:
+      case gandiva::types::SV_INT32:
         status =
             gandiva::SelectionVector::MakeInt32(num_rows, out_buffer, 
&selection_vector);
         break;

Reply via email to