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

kou 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 cca41a32b3 GH-50000: [C++][FlightRPC] Use grpcpp/grpcpp.h not 
grpcpp/version_info.h for old gRPC (#50001)
cca41a32b3 is described below

commit cca41a32b3777f56e5a9e1cae0fef0bd078382c2
Author: Rok Mihevc <[email protected]>
AuthorDate: Wed May 20 22:56:07 2026 +0200

    GH-50000: [C++][FlightRPC] Use grpcpp/grpcpp.h not grpcpp/version_info.h 
for old gRPC (#50001)
    
    ### Rationale for this change
    
    `gRPC 1.51.0` introduced `grpcpp/version_info.h`. Since we also use older 
versions we should guard against import in case of older version.
    
    ### What changes are included in this PR?
    
    Use `grpcpp/grpcpp.h` not `grpcpp/version_info.h`. `grpcpp/grpcpp.h` is 
provided by old gRPC.
    
    ### Are these changes tested?
    
    By CI.
    
    ### Are there any user-facing changes?
    
    No.
    * GitHub Issue: #50000
    
    Authored-by: Rok Mihevc <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 cpp/src/arrow/flight/transport/grpc/util_internal.h | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/cpp/src/arrow/flight/transport/grpc/util_internal.h 
b/cpp/src/arrow/flight/transport/grpc/util_internal.h
index 6ff3dadb53..7e306d574a 100644
--- a/cpp/src/arrow/flight/transport/grpc/util_internal.h
+++ b/cpp/src/arrow/flight/transport/grpc/util_internal.h
@@ -17,18 +17,23 @@
 
 #pragma once
 
-#include <grpcpp/version_info.h>
+#include <grpcpp/grpcpp.h>
 
 #include "arrow/flight/transport/grpc/protocol_grpc_internal.h"
 #include "arrow/flight/types.h"
 #include "arrow/flight/visibility.h"
 #include "arrow/util/macros.h"
 
-#define GRPC_CPP_VERSION_CHECK(major, minor, patch)                            
 \
-  ((GRPC_CPP_VERSION_MAJOR > (major) ||                                        
 \
-    (GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR > (minor)) || 
 \
-    ((GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR == (minor) 
&& \
-      GRPC_CPP_VERSION_PATCH >= (patch)))))
+// gRPC 1.51.0 or later defines GRPC_CPP_VERSION_MAJOR and so on.
+#ifdef GRPC_CPP_VERSION_MAJOR
+#  define GRPC_CPP_VERSION_CHECK(major, minor, patch)                          
   \
+    ((GRPC_CPP_VERSION_MAJOR > (major) ||                                      
   \
+      (GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR > (minor)) 
||  \
+      ((GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR == (minor) 
&& \
+        GRPC_CPP_VERSION_PATCH >= (patch)))))
+#else
+#  define GRPC_CPP_VERSION_CHECK(major, minor, patch) 0
+#endif
 
 #if GRPC_CPP_VERSION_CHECK(1, 80, 0)
 #  include <absl/status/status.h>

Reply via email to