Copilot commented on code in PR #55299:
URL: https://github.com/apache/arrow/pull/55299#discussion_r4585486509


##########
cpp/src/arrow/filesystem/azurefs.cc:
##########
@@ -3561,4 +3561,15 @@ Result<std::string> AzureFileSystem::PathFromUri(const 
std::string& uri_string)
   return path;
 }
 
+static Result<std::shared_ptr<FileSystem>> AzureFileSystemFactory(
+    const Uri& uri, const io::IOContext& io_context, std::string* out_path) {
+  ARROW_ASSIGN_OR_RAISE(auto options, AzureOptions::FromUri(uri, out_path));
+  return AzureFileSystem::Make(options, io_context);
+}
+
+FileSystemRegistrar kAzureFileSystemRegistrar[]{
+    ARROW_REGISTER_FILESYSTEM("abfs", AzureFileSystemFactory, {}),
+    ARROW_REGISTER_FILESYSTEM("abfss", AzureFileSystemFactory, {}),
+};
+

Review Comment:
   With the Azure URI handling removed from `filesystem.cc`, `abfs/abfss` now 
relies entirely on static registration in the `arrow_azure` library. In 
static-link scenarios, this registration TU may not be pulled from 
`libarrow_azure.a` unless some symbol in it is referenced, so 
`FileSystemFromUri(\"abfs://...\")` can silently fail even when linking 
`ArrowAzure::arrow_azure_static`. A robust fix is to add an explicitly callable 
exported registration function (or another always-referenced symbol) and 
document/ensure it is invoked for static builds; alternatively, enforce 
whole-archive semantics for the ArrowAzure static target (with the usual 
portability tradeoffs).



##########
dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in:
##########
@@ -392,6 +392,38 @@ Libraries and header files for Apache Arrow GCS filesystem.
 %{_libdir}/pkgconfig/arrow-gcs.pc
 %endif
 
+%package -n %{name}%{so_version}-azure-libs
+Summary:       C++ library for the Azure filesystem
+License:       Apache-2.0
+Requires:      %{name}%{so_version}-libs = %{version}-%{release}
+
+%description -n %{name}%{so_version}-azure-libs
+This package contains the libraries for Apache Arrow Azure filesystem.
+
+%files -n %{name}%{so_version}-azure-libs
+%defattr(-,root,root,-)
+%doc README.md
+%license LICENSE.txt NOTICE.txt
+%{_libdir}/libarrow_azure.so.*
+
+%package azure-devel
+Summary:       Libraries and header files for Apache Arrow Azure filesystem
+License:       Apache-2.0
+Requires:      %{name}%{so_version}-azure-libs = %{version}-%{release}
+Requires:      %{name}-devel = %{version}-%{release}
+
+%description azure-devel
+Libraries and header files for Apache Arrow Azure filesystem.
+
+%files azure-devel
+%defattr(-,root,root,-)
+%doc README.md
+%license LICENSE.txt NOTICE.txt
+%{_libdir}/cmake/ArrowAzure/
+%{_libdir}/libarrow_azure.a
+%{_libdir}/libarrow_azure.so
+%{_libdir}/pkgconfig/arrow-azure.pc

Review Comment:
   These RPM subpackages (and their `%files` lists) appear unconditional and 
hard-require both shared (`.so*`) and static (`.a`) artifacts. If the RPM build 
toggles Azure off, or builds only shared or only static, `rpmbuild` will fail 
due to missing packaged files. Align this with existing module packaging 
patterns (e.g., wrap in the same `%if ...` conditional used for other optional 
filesystem modules, and only list `.a`/`.so` artifacts when those build modes 
are enabled).



##########
r/configure:
##########
@@ -365,6 +365,10 @@ add_feature_flags () {
     fi
     if arrow_built_with ARROW_AZURE; then
       PKG_CFLAGS_FEATURES="$PKG_CFLAGS_FEATURES -DARROW_R_WITH_AZURE"
+      PKG_CONFIG_NAMES_FEATURES="$PKG_CONFIG_NAMES_FEATURES arrow-azure"
+      PKG_LIBS_FEATURES_WITHOUT_PC="-larrow_azure 
$PKG_LIBS_FEATURES_WITHOUT_PC"
+      # NOTE: arrow_azure is assumed to have the same -L flag as arrow
+      # so there is no need to add its location to PKG_DIRS

Review Comment:
   The non-pkg-config fallback (`PKG_LIBS_FEATURES_WITHOUT_PC`) adds 
`-larrow_azure` but doesn’t add Azure SDK transitive dependencies (which 
matters for static linking, where transitive deps aren’t carried the same way 
as shared). If the R build supports non-pkg-config + static linkage, this will 
cause link failures. Consider either requiring pkg-config when Azure is 
enabled, or augmenting the fallback to include the necessary dependency 
libs/flags for the chosen linkage mode.



##########
cpp/src/arrow/filesystem/azure_visibility.h:
##########
@@ -0,0 +1,49 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+#  if defined(_MSC_VER)
+#    pragma warning(push)
+#    pragma warning(disable : 4251)
+#  else
+#    pragma GCC diagnostic ignored "-Wattributes"
+#  endif
+
+#  ifdef ARROW_AZURE_STATIC
+#    define ARROW_AZURE_EXPORT
+#  elif defined(ARROW_AZURE_EXPORTING)
+#    define ARROW_AZURE_EXPORT __declspec(dllexport)
+#  else
+#    define ARROW_AZURE_EXPORT __declspec(dllimport)
+#  endif
+
+#  define ARROW_AZURE_NO_EXPORT
+
+#  if defined(_MSC_VER)
+#    pragma warning(pop)
+#  endif

Review Comment:
   On the non-MSVC Windows branch, `#pragma GCC diagnostic ignored 
\"-Wattributes\"` is not paired with a diagnostic push/pop. Because this header 
will be included broadly, it can unintentionally suppress attribute warnings 
for the remainder of any translation unit. Consider adding `#pragma GCC 
diagnostic push` / `pop` around the suppression (or limiting the suppression 
scope) to avoid masking unrelated warnings.



##########
python/CMakeLists.txt:
##########
@@ -730,6 +730,18 @@ if(PYARROW_BUILD_AZURE)
   if(NOT ARROW_AZURE)
     message(FATAL_ERROR "You must build Arrow C++ with ARROW_AZURE=ON")
   endif()
+  find_package(ArrowAzure REQUIRED)
+  if(ARROW_BUILD_SHARED)
+    if(PYARROW_BUNDLE_ARROW_CPP)
+      bundle_arrow_lib(${ARROW_AZURE_SHARED_LIB} SO_VERSION 
${ARROW_SO_VERSION})
+      if(MSVC)
+        bundle_arrow_import_lib(${ARROW_AZURE_IMPORT_LIB})
+      endif()
+    endif()
+    set(AZURE_LINK_LIBS ArrowAzure::arrow_azure_shared)
+  else()
+    set(AZURE_LINK_LIBS ArrowAzure::arrow_azure_static)
+  endif()

Review Comment:
   The bundling step depends on `ARROW_AZURE_SHARED_LIB` / 
`ARROW_AZURE_IMPORT_LIB` variables being defined by `find_package(ArrowAzure)`. 
In the new `ArrowAzureConfig.cmake.in` shown in this PR, only targets are 
guaranteed, so these variables may be unset and break wheel bundling. Prefer 
querying the imported targets for the actual library file(s) (e.g., via target 
file properties / generator expressions) so bundling works reliably across 
platforms and multi-config generators.



-- 
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]

Reply via email to