Skip to content

Commit

Permalink
Move Types.proto in a subfolder
Browse files Browse the repository at this point in the history
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.

Move Types.proto into gandiva/types.proto (also matching convention of
using lowercase filename) so that it become less likely to cause a
conflict.
  • Loading branch information
laurentgo committed Sep 26, 2023
1 parent 2895af4 commit 225f799
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions java/gandiva/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}/types.pb.cc"
"${GANDIVA_PROTO_OUTPUT_DIR}/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
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})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion java/gandiva/src/main/cpp/expression_registry_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <gandiva/arrow.h>
#include <gandiva/expression_registry.h>

#include "Types.pb.h"
#include "types.pb.h"
#include "org_apache_arrow_gandiva_evaluator_ExpressionRegistryJniHelper.h"

using gandiva::DataTypePtr;
Expand Down
2 changes: 1 addition & 1 deletion java/gandiva/src/main/cpp/jni_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <gandiva/selection_vector.h>
#include <gandiva/tree_expr_builder.h>

#include "Types.pb.h"
#include "types.pb.h"
#include "config_holder.h"
#include "env_helper.h"
#include "id_to_module_map.h"
Expand Down

0 comments on commit 225f799

Please sign in to comment.