You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by as...@apache.org on 2023/04/05 17:55:38 UTC

[arrow] branch main updated: GH-34843: [R] Fix R build failed caused by Acero refactor (#34844)

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

assignuser 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 c21986302e GH-34843: [R] Fix R build failed caused by Acero refactor (#34844)
c21986302e is described below

commit c21986302e35f48feca5e1dbd92a7130337b20e3
Author: Li Jin <ic...@gmail.com>
AuthorDate: Wed Apr 5 13:55:30 2023 -0400

    GH-34843: [R] Fix R build failed caused by Acero refactor (#34844)
    
    
    
    ### Rationale for this change
    There was an issue with window R build introduced by this PR:
    https://github.com/apache/arrow/pull/34711
    
    ### What changes are included in this PR?
    Many changes to the build files
    
    ### Are these changes tested?
    crossbow builds
    
    ### Are there any user-facing changes?
    
    * Closes: #34843
    
    Lead-authored-by: Weston Pace <we...@gmail.com>
    Co-authored-by: Li Jin <ic...@gmail.com>
    Signed-off-by: Jacob Wujciak-Jens <ja...@wujciak.de>
---
 dev/tasks/homebrew-formulae/apache-arrow.rb        |   1 +
 .../autobrew/apache-arrow-static.rb                |   1 +
 .../homebrew-formulae/autobrew/apache-arrow.rb     |   1 +
 r/NAMESPACE                                        |   1 +
 r/R/arrow-info.R                                   |   8 ++
 r/R/type.R                                         |   2 +-
 r/configure                                        |  12 +-
 r/configure.win                                    |  11 +-
 r/data-raw/codegen.R                               |   2 +-
 r/inst/build_arrow_static.sh                       |   1 +
 r/man/arrow_info.Rd                                |   3 +
 r/man/data-type.Rd                                 |   2 +
 r/src/array.cpp                                    |   1 +
 r/src/arrowExports.cpp                             | 122 +++++++++++++++++++++
 r/src/arrow_types.h                                |  10 +-
 r/src/compute-exec.cpp                             |  38 ++++---
 r/tests/testthat/test-dplyr-arrange.R              |   2 +
 r/tests/testthat/test-dplyr-collapse.R             |   2 +
 r/tests/testthat/test-dplyr-count.R                |   2 +
 r/tests/testthat/test-dplyr-distinct.R             |   2 +
 r/tests/testthat/test-dplyr-filter.R               |   2 +
 r/tests/testthat/test-dplyr-funcs-conditional.R    |   1 +
 r/tests/testthat/test-dplyr-funcs-datetime.R       |   2 +
 r/tests/testthat/test-dplyr-funcs-math.R           |   1 +
 r/tests/testthat/test-dplyr-funcs-string.R         |   1 +
 r/tests/testthat/test-dplyr-funcs-type.R           |   1 +
 r/tests/testthat/test-dplyr-group-by.R             |   2 +
 r/tests/testthat/test-dplyr-join.R                 |   2 +
 r/tests/testthat/test-dplyr-mutate.R               |   2 +
 r/tests/testthat/test-dplyr-query.R                |   2 +
 r/tests/testthat/test-dplyr-select.R               |   2 +
 r/tests/testthat/test-dplyr-slice.R                |   2 +
 r/tests/testthat/test-dplyr-summarize.R            |   2 +
 r/tests/testthat/test-dplyr-union.R                |   2 +
 r/tests/testthat/test-io.R                         |   1 -
 r/tests/testthat/test-parquet.R                    |   2 +
 r/tests/testthat/test-query-engine.R               |   2 +
 r/tests/testthat/test-udf.R                        |   3 +-
 r/tools/autobrew                                   |   4 +-
 39 files changed, 225 insertions(+), 35 deletions(-)

diff --git a/dev/tasks/homebrew-formulae/apache-arrow.rb b/dev/tasks/homebrew-formulae/apache-arrow.rb
index fdd77cf21a..dfdeddb6aa 100644
--- a/dev/tasks/homebrew-formulae/apache-arrow.rb
+++ b/dev/tasks/homebrew-formulae/apache-arrow.rb
@@ -72,6 +72,7 @@ class ApacheArrow < Formula
     # link against system libc++ instead of llvm provided libc++
     ENV.remove "HOMEBREW_LIBRARY_PATHS", Formula["llvm"].opt_lib
     args = %W[
+      -DARROW_ACERO=ON
       -DARROW_COMPUTE=ON
       -DARROW_CSV=ON
       -DARROW_DATASET=ON
diff --git a/dev/tasks/homebrew-formulae/autobrew/apache-arrow-static.rb b/dev/tasks/homebrew-formulae/autobrew/apache-arrow-static.rb
index 84206978f3..c0df6a3217 100644
--- a/dev/tasks/homebrew-formulae/autobrew/apache-arrow-static.rb
+++ b/dev/tasks/homebrew-formulae/autobrew/apache-arrow-static.rb
@@ -53,6 +53,7 @@ class ApacheArrowStatic < Formula
     args = %W[
       -DARROW_BUILD_SHARED=OFF
       -DARROW_BUILD_UTILITIES=ON
+      -DARROW_ACERO=ON
       -DARROW_COMPUTE=ON
       -DARROW_CSV=ON
       -DARROW_DATASET=ON
diff --git a/dev/tasks/homebrew-formulae/autobrew/apache-arrow.rb b/dev/tasks/homebrew-formulae/autobrew/apache-arrow.rb
index 90be13add0..c8adfdbaf7 100644
--- a/dev/tasks/homebrew-formulae/autobrew/apache-arrow.rb
+++ b/dev/tasks/homebrew-formulae/autobrew/apache-arrow.rb
@@ -44,6 +44,7 @@ class ApacheArrow < Formula
     args = %W[
       -DARROW_BUILD_SHARED=OFF
       -DARROW_BUILD_UTILITIES=ON
+      -DARROW_ACERO=ON
       -DARROW_COMPUTE=ON
       -DARROW_CSV=ON
       -DARROW_CXXFLAGS="-D_LIBCPP_DISABLE_AVAILABILITY"
diff --git a/r/NAMESPACE b/r/NAMESPACE
index 70b8fc3fc8..7ab8d5c902 100644
--- a/r/NAMESPACE
+++ b/r/NAMESPACE
@@ -270,6 +270,7 @@ export(all_of)
 export(arrow_available)
 export(arrow_info)
 export(arrow_table)
+export(arrow_with_acero)
 export(arrow_with_dataset)
 export(arrow_with_gcs)
 export(arrow_with_json)
diff --git a/r/R/arrow-info.R b/r/R/arrow-info.R
index d864f3de9f..66581b49a4 100644
--- a/r/R/arrow-info.R
+++ b/r/R/arrow-info.R
@@ -79,6 +79,14 @@ arrow_available <- function() {
   TRUE
 }
 
+#' @rdname arrow_info
+#' @export
+arrow_with_acero <- function() {
+  tryCatch(.Call(`_acero_available`), error = function(e) {
+    return(FALSE)
+  })
+}
+
 #' @rdname arrow_info
 #' @export
 arrow_with_dataset <- function() {
diff --git a/r/R/type.R b/r/R/type.R
index bd69311b25..9c9c7fa870 100644
--- a/r/R/type.R
+++ b/r/R/type.R
@@ -381,7 +381,7 @@ NestedType <- R6Class("NestedType", inherit = DataType)
 #' @return An Arrow type object inheriting from [DataType].
 #' @export
 #' @seealso [dictionary()] for creating a dictionary (factor-like) type.
-#' @examples
+#' @examplesIf arrow_with_acero()
 #' bool()
 #' struct(a = int32(), b = double())
 #' timestamp("ms", timezone = "CEST")
diff --git a/r/configure b/r/configure
index 3099e84b53..65528bdc38 100755
--- a/r/configure
+++ b/r/configure
@@ -265,18 +265,18 @@ if [ $? -eq 0 ]; then
     # NOTE: parquet is assumed to have the same -L flag as arrow
     # so there is no need to add its location to PKG_DIRS
   fi
-  if arrow_built_with ARROW_ACERO; then
-    PKG_CFLAGS="$PKG_CFLAGS -DARROW_R_WITH_ACERO"
-    PKG_LIBS="-larrow_acero $PKG_LIBS"
-    # NOTE: arrow-acero is assumed to have the same -L flag as arrow
-    # so there is no need to add its location to PKG_DIRS
-  fi
   if arrow_built_with ARROW_DATASET; then
     PKG_CFLAGS="$PKG_CFLAGS -DARROW_R_WITH_DATASET"
     PKG_LIBS="-larrow_dataset $PKG_LIBS"
     # NOTE: arrow-dataset is assumed to have the same -L flag as arrow
     # so there is no need to add its location to PKG_DIRS
   fi
+  if arrow_built_with ARROW_ACERO; then
+    PKG_CFLAGS="$PKG_CFLAGS -DARROW_R_WITH_ACERO"
+    PKG_LIBS="-larrow_acero $PKG_LIBS"
+    # NOTE: arrow-acero is assumed to have the same -L flag as arrow
+    # so there is no need to add its location to PKG_DIRS
+  fi
   if arrow_built_with ARROW_SUBSTRAIT; then
     PKG_CFLAGS="$PKG_CFLAGS -DARROW_R_WITH_SUBSTRAIT"
     PKG_LIBS="-larrow_substrait $PKG_LIBS"
diff --git a/r/configure.win b/r/configure.win
index f416e75f3c..d9daffb5d9 100755
--- a/r/configure.win
+++ b/r/configure.win
@@ -59,11 +59,11 @@ function configure_release() {
   # NOTE: If you make changes to the libraries below, you should also change
   # ci/scripts/r_windows_build.sh and ci/scripts/PKGBUILD
   PKG_CFLAGS="-I${RWINLIB}/include -DARROW_STATIC -DPARQUET_STATIC -DARROW_DS_STATIC \
-              -DARROW_R_WITH_PARQUET -DARROW_R_WITH_DATASET \
-              -DARROW_R_WITH_JSON"
+              -DARROW_ACERO_STATIC -DARROW_R_WITH_PARQUET -DARROW_R_WITH_ACERO \
+              -DARROW_R_WITH_DATASET -DARROW_R_WITH_JSON"
   PKG_LIBS="-L${RWINLIB}/lib"'$(subst gcc,,$(COMPILED_BY))$(R_ARCH) '
   PKG_LIBS="$PKG_LIBS -L${RWINLIB}/lib"'$(R_ARCH)$(CRT) '
-  PKG_LIBS="$PKG_LIBS -larrow_dataset -lparquet -larrow -larrow_bundled_dependencies \
+  PKG_LIBS="$PKG_LIBS -larrow_dataset -larrow_acero -lparquet -larrow -larrow_bundled_dependencies \
             -lutf8proc -lthrift -lsnappy -lz -lzstd -llz4 -lbz2 ${BROTLI_LIBS} -lole32 \
             ${MIMALLOC_LIBS} ${OPENSSL_LIBS}"
 
@@ -98,6 +98,11 @@ function configure_dev() {
     PKG_CONFIG_PACKAGES="$PKG_CONFIG_PACKAGES parquet"
   fi
 
+  if [ $(cmake_option ARROW_ACERO) -eq 1 ]; then
+    PKG_CFLAGS="$PKG_CFLAGS -DARROW_R_WITH_ACERO"
+    PKG_CONFIG_PACKAGES="$PKG_CONFIG_PACKAGES arrow-acero"
+  fi
+
   if [ $(cmake_option ARROW_DATASET) -eq 1 ]; then
     PKG_CFLAGS="$PKG_CFLAGS -DARROW_R_WITH_DATASET"
     PKG_CONFIG_PACKAGES="$PKG_CONFIG_PACKAGES arrow-dataset"
diff --git a/r/data-raw/codegen.R b/r/data-raw/codegen.R
index 92a4267153..e8d53467d4 100644
--- a/r/data-raw/codegen.R
+++ b/r/data-raw/codegen.R
@@ -30,7 +30,7 @@
 # Ensure that all machines are sorting the same way
 invisible(Sys.setlocale("LC_COLLATE", "C"))
 
-features <- c("dataset", "substrait", "parquet", "s3", "gcs", "json")
+features <- c("acero", "dataset", "substrait", "parquet", "s3", "gcs", "json")
 
 suppressPackageStartupMessages({
   library(decor)
diff --git a/r/inst/build_arrow_static.sh b/r/inst/build_arrow_static.sh
index 800b9cde3f..e5a9f127ed 100755
--- a/r/inst/build_arrow_static.sh
+++ b/r/inst/build_arrow_static.sh
@@ -55,6 +55,7 @@ ${CMAKE} -DARROW_BOOST_USE_SHARED=OFF \
     -DARROW_BUILD_TESTS=OFF \
     -DARROW_BUILD_SHARED=OFF \
     -DARROW_BUILD_STATIC=ON \
+    -DARROW_ACERO=${ARROW_ACERO:-$ARROW_DEFAULT_PARAM} \
     -DARROW_COMPUTE=ON \
     -DARROW_CSV=ON \
     -DARROW_DATASET=${ARROW_DATASET:-ON} \
diff --git a/r/man/arrow_info.Rd b/r/man/arrow_info.Rd
index e0f16d792f..a839d3ba8f 100644
--- a/r/man/arrow_info.Rd
+++ b/r/man/arrow_info.Rd
@@ -3,6 +3,7 @@
 \name{arrow_info}
 \alias{arrow_info}
 \alias{arrow_available}
+\alias{arrow_with_acero}
 \alias{arrow_with_dataset}
 \alias{arrow_with_substrait}
 \alias{arrow_with_parquet}
@@ -15,6 +16,8 @@ arrow_info()
 
 arrow_available()
 
+arrow_with_acero()
+
 arrow_with_dataset()
 
 arrow_with_substrait()
diff --git a/r/man/data-type.Rd b/r/man/data-type.Rd
index 9a2ddf5132..79b09a4f32 100644
--- a/r/man/data-type.Rd
+++ b/r/man/data-type.Rd
@@ -201,6 +201,7 @@ Use \code{decimal128()} or \code{decimal256()} as the names are more informative
 \code{decimal()}.
 }
 \examples{
+\dontshow{if (arrow_with_acero()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
 bool()
 struct(a = int32(), b = double())
 timestamp("ms", timezone = "CEST")
@@ -227,6 +228,7 @@ if (requireNamespace("dplyr", quietly = TRUE)) {
     ) \%>\%
     compute()
 }
+\dontshow{\}) # examplesIf}
 }
 \seealso{
 \code{\link[=dictionary]{dictionary()}} for creating a dictionary (factor-like) type.
diff --git a/r/src/array.cpp b/r/src/array.cpp
index c6c98d75b5..ae76c01a94 100644
--- a/r/src/array.cpp
+++ b/r/src/array.cpp
@@ -19,6 +19,7 @@
 
 #include <arrow/array.h>
 #include <arrow/array/concatenate.h>
+#include <arrow/record_batch.h>
 #include <arrow/util/bitmap_reader.h>
 #include <arrow/util/byte_size.h>
 
diff --git a/r/src/arrowExports.cpp b/r/src/arrowExports.cpp
index db6d39dd7b..dc4d0e9c70 100644
--- a/r/src/arrowExports.cpp
+++ b/r/src/arrowExports.cpp
@@ -912,6 +912,7 @@ BEGIN_CPP11
 END_CPP11
 }
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<acero::ExecPlan> ExecPlan_create(bool use_threads);
 extern "C" SEXP _arrow_ExecPlan_create(SEXP use_threads_sexp){
 BEGIN_CPP11
@@ -919,7 +920,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecPlan_create(use_threads));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecPlan_create(SEXP use_threads_sexp){
+	Rf_error("Cannot call ExecPlan_create(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 cpp11::list ExecPlanReader__batches(const std::shared_ptr<arrow::RecordBatchReader>& reader);
 extern "C" SEXP _arrow_ExecPlanReader__batches(SEXP reader_sexp){
 BEGIN_CPP11
@@ -927,7 +935,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecPlanReader__batches(reader));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecPlanReader__batches(SEXP reader_sexp){
+	Rf_error("Cannot call ExecPlanReader__batches(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<arrow::Table> Table__from_ExecPlanReader(const std::shared_ptr<arrow::RecordBatchReader>& reader);
 extern "C" SEXP _arrow_Table__from_ExecPlanReader(SEXP reader_sexp){
 BEGIN_CPP11
@@ -935,7 +950,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(Table__from_ExecPlanReader(reader));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_Table__from_ExecPlanReader(SEXP reader_sexp){
+	Rf_error("Cannot call Table__from_ExecPlanReader(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<acero::ExecPlan> ExecPlanReader__Plan(const std::shared_ptr<ExecPlanReader>& reader);
 extern "C" SEXP _arrow_ExecPlanReader__Plan(SEXP reader_sexp){
 BEGIN_CPP11
@@ -943,7 +965,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecPlanReader__Plan(reader));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecPlanReader__Plan(SEXP reader_sexp){
+	Rf_error("Cannot call ExecPlanReader__Plan(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::string ExecPlanReader__PlanStatus(const std::shared_ptr<ExecPlanReader>& reader);
 extern "C" SEXP _arrow_ExecPlanReader__PlanStatus(SEXP reader_sexp){
 BEGIN_CPP11
@@ -951,7 +980,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecPlanReader__PlanStatus(reader));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecPlanReader__PlanStatus(SEXP reader_sexp){
+	Rf_error("Cannot call ExecPlanReader__PlanStatus(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<ExecPlanReader> ExecPlan_run(const std::shared_ptr<acero::ExecPlan>& plan, const std::shared_ptr<acero::ExecNode>& final_node, cpp11::list sort_options, cpp11::strings metadata, int64_t head);
 extern "C" SEXP _arrow_ExecPlan_run(SEXP plan_sexp, SEXP final_node_sexp, SEXP sort_options_sexp, SEXP metadata_sexp, SEXP head_sexp){
 BEGIN_CPP11
@@ -963,7 +999,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecPlan_run(plan, final_node, sort_options, metadata, head));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecPlan_run(SEXP plan_sexp, SEXP final_node_sexp, SEXP sort_options_sexp, SEXP metadata_sexp, SEXP head_sexp){
+	Rf_error("Cannot call ExecPlan_run(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::string ExecPlan_ToString(const std::shared_ptr<acero::ExecPlan>& plan);
 extern "C" SEXP _arrow_ExecPlan_ToString(SEXP plan_sexp){
 BEGIN_CPP11
@@ -971,7 +1014,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecPlan_ToString(plan));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecPlan_ToString(SEXP plan_sexp){
+	Rf_error("Cannot call ExecPlan_ToString(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 void ExecPlan_UnsafeDelete(const std::shared_ptr<acero::ExecPlan>& plan);
 extern "C" SEXP _arrow_ExecPlan_UnsafeDelete(SEXP plan_sexp){
 BEGIN_CPP11
@@ -980,7 +1030,14 @@ BEGIN_CPP11
 	return R_NilValue;
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecPlan_UnsafeDelete(SEXP plan_sexp){
+	Rf_error("Cannot call ExecPlan_UnsafeDelete(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<arrow::Schema> ExecNode_output_schema(const std::shared_ptr<acero::ExecNode>& node);
 extern "C" SEXP _arrow_ExecNode_output_schema(SEXP node_sexp){
 BEGIN_CPP11
@@ -988,6 +1045,12 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecNode_output_schema(node));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecNode_output_schema(SEXP node_sexp){
+	Rf_error("Cannot call ExecNode_output_schema(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
 #if defined(ARROW_R_WITH_DATASET)
 std::shared_ptr<acero::ExecNode> ExecNode_Scan(const std::shared_ptr<acero::ExecPlan>& plan, const std::shared_ptr<ds::Dataset>& dataset, const std::shared_ptr<compute::Expression>& filter, cpp11::list projection);
@@ -1036,6 +1099,7 @@ extern "C" SEXP _arrow_ExecPlan_Write(SEXP plan_sexp, SEXP final_node_sexp, SEXP
 #endif
 
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<acero::ExecNode> ExecNode_Filter(const std::shared_ptr<acero::ExecNode>& input, const std::shared_ptr<compute::Expression>& filter);
 extern "C" SEXP _arrow_ExecNode_Filter(SEXP input_sexp, SEXP filter_sexp){
 BEGIN_CPP11
@@ -1044,7 +1108,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecNode_Filter(input, filter));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecNode_Filter(SEXP input_sexp, SEXP filter_sexp){
+	Rf_error("Cannot call ExecNode_Filter(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<acero::ExecNode> ExecNode_Project(const std::shared_ptr<acero::ExecNode>& input, const std::vector<std::shared_ptr<compute::Expression>>& exprs, std::vector<std::string> names);
 extern "C" SEXP _arrow_ExecNode_Project(SEXP input_sexp, SEXP exprs_sexp, SEXP names_sexp){
 BEGIN_CPP11
@@ -1054,7 +1125,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecNode_Project(input, exprs, names));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecNode_Project(SEXP input_sexp, SEXP exprs_sexp, SEXP names_sexp){
+	Rf_error("Cannot call ExecNode_Project(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<acero::ExecNode> ExecNode_Aggregate(const std::shared_ptr<acero::ExecNode>& input, cpp11::list options, std::vector<std::string> key_names);
 extern "C" SEXP _arrow_ExecNode_Aggregate(SEXP input_sexp, SEXP options_sexp, SEXP key_names_sexp){
 BEGIN_CPP11
@@ -1064,7 +1142,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecNode_Aggregate(input, options, key_names));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecNode_Aggregate(SEXP input_sexp, SEXP options_sexp, SEXP key_names_sexp){
+	Rf_error("Cannot call ExecNode_Aggregate(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<acero::ExecNode> ExecNode_Join(const std::shared_ptr<acero::ExecNode>& input, acero::JoinType join_type, const std::shared_ptr<acero::ExecNode>& right_data, std::vector<std::string> left_keys, std::vector<std::string> right_keys, std::vector<std::string> left_output, std::vector<std::string> right_output, std::string output_suffix_for_left, std::string output_suffix_for_right);
 extern "C" SEXP _arrow_ExecNode_Join(SEXP input_sexp, SEXP join_type_sexp, SEXP right_data_sexp, SEXP left_keys_sexp, SEXP right_keys_sexp, SEXP left_output_sexp, SEXP right_output_sexp, SEXP output_suffix_for_left_sexp, SEXP output_suffix_for_right_sexp){
 BEGIN_CPP11
@@ -1080,7 +1165,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecNode_Join(input, join_type, right_data, left_keys, right_keys, left_output, right_output, output_suffix_for_left, output_suffix_for_right));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecNode_Join(SEXP input_sexp, SEXP join_type_sexp, SEXP right_data_sexp, SEXP left_keys_sexp, SEXP right_keys_sexp, SEXP left_output_sexp, SEXP right_output_sexp, SEXP output_suffix_for_left_sexp, SEXP output_suffix_for_right_sexp){
+	Rf_error("Cannot call ExecNode_Join(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<acero::ExecNode> ExecNode_Union(const std::shared_ptr<acero::ExecNode>& input, const std::shared_ptr<acero::ExecNode>& right_data);
 extern "C" SEXP _arrow_ExecNode_Union(SEXP input_sexp, SEXP right_data_sexp){
 BEGIN_CPP11
@@ -1089,7 +1181,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecNode_Union(input, right_data));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecNode_Union(SEXP input_sexp, SEXP right_data_sexp){
+	Rf_error("Cannot call ExecNode_Union(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<acero::ExecNode> ExecNode_SourceNode(const std::shared_ptr<acero::ExecPlan>& plan, const std::shared_ptr<arrow::RecordBatchReader>& reader);
 extern "C" SEXP _arrow_ExecNode_SourceNode(SEXP plan_sexp, SEXP reader_sexp){
 BEGIN_CPP11
@@ -1098,7 +1197,14 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecNode_SourceNode(plan, reader));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecNode_SourceNode(SEXP plan_sexp, SEXP reader_sexp){
+	Rf_error("Cannot call ExecNode_SourceNode(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
+#if defined(ARROW_R_WITH_ACERO)
 std::shared_ptr<acero::ExecNode> ExecNode_TableSourceNode(const std::shared_ptr<acero::ExecPlan>& plan, const std::shared_ptr<arrow::Table>& table);
 extern "C" SEXP _arrow_ExecNode_TableSourceNode(SEXP plan_sexp, SEXP table_sexp){
 BEGIN_CPP11
@@ -1107,6 +1213,12 @@ BEGIN_CPP11
 	return cpp11::as_sexp(ExecNode_TableSourceNode(plan, table));
 END_CPP11
 }
+#else
+extern "C" SEXP _arrow_ExecNode_TableSourceNode(SEXP plan_sexp, SEXP table_sexp){
+	Rf_error("Cannot call ExecNode_TableSourceNode(). See https://arrow.apache.org/docs/r/articles/install.html for help installing Arrow C++ libraries. ");
+}
+#endif
+
 // compute-exec.cpp
 #if defined(ARROW_R_WITH_SUBSTRAIT)
 std::string substrait__internal__SubstraitToJSON(const std::shared_ptr<arrow::Buffer>& serialized_plan);
@@ -5261,6 +5373,15 @@ BEGIN_CPP11
 	return cpp11::as_sexp(Array__infer_type(x));
 END_CPP11
 }
+extern "C" SEXP _acero_available() {
+return Rf_ScalarLogical(
+#if defined(ARROW_R_WITH_ACERO)
+  TRUE
+#else
+  FALSE
+#endif
+);
+}
 extern "C" SEXP _dataset_available() {
 return Rf_ScalarLogical(
 #if defined(ARROW_R_WITH_DATASET)
@@ -5316,6 +5437,7 @@ return Rf_ScalarLogical(
 );
 }
 static const R_CallMethodDef CallEntries[] = {
+		{ "_acero_available", (DL_FUNC)& _acero_available, 0 },
 		{ "_dataset_available", (DL_FUNC)& _dataset_available, 0 },
 		{ "_substrait_available", (DL_FUNC)& _substrait_available, 0 },
 		{ "_parquet_available", (DL_FUNC)& _parquet_available, 0 },
diff --git a/r/src/arrow_types.h b/r/src/arrow_types.h
index 819346e205..5f82275fe9 100644
--- a/r/src/arrow_types.h
+++ b/r/src/arrow_types.h
@@ -30,17 +30,20 @@
 #include <utility>
 
 // forward declaration-only headers
-#include <arrow/acero/type_fwd.h>
 #include <arrow/c/abi.h>
 #include <arrow/compute/type_fwd.h>
 #include <arrow/csv/type_fwd.h>
 
+#if defined(ARROW_R_WITH_ACERO)
+#include <arrow/acero/options.h>
+#include <arrow/acero/type_fwd.h>
+namespace acero = ::arrow::acero;
+#endif
+
 #if defined(ARROW_R_WITH_DATASET)
 #include <arrow/dataset/type_fwd.h>
 #endif
 
-#include <arrow/acero/options.h>
-
 #include <arrow/filesystem/type_fwd.h>
 #include <arrow/io/type_fwd.h>
 #include <arrow/ipc/type_fwd.h>
@@ -63,7 +66,6 @@ namespace ds = ::arrow::dataset;
 #endif
 
 namespace compute = ::arrow::compute;
-namespace acero = ::arrow::acero;
 namespace fs = ::arrow::fs;
 
 std::shared_ptr<arrow::RecordBatch> RecordBatch__from_arrays(SEXP, SEXP);
diff --git a/r/src/compute-exec.cpp b/r/src/compute-exec.cpp
index 7fb1b1394d..9c7de915fa 100644
--- a/r/src/compute-exec.cpp
+++ b/r/src/compute-exec.cpp
@@ -16,6 +16,9 @@
 // under the License.
 
 #include "./arrow_types.h"
+
+#if defined(ARROW_R_WITH_ACERO)
+
 #include "./safe-call-into-r.h"
 
 #include <arrow/acero/exec_plan.h>
@@ -30,6 +33,7 @@
 #include <iostream>
 #include <optional>
 
+namespace acero = ::arrow::acero;
 namespace compute = ::arrow::compute;
 
 std::shared_ptr<compute::FunctionOptions> make_compute_options(std::string func_name,
@@ -37,7 +41,7 @@ std::shared_ptr<compute::FunctionOptions> make_compute_options(std::string func_
 
 std::shared_ptr<arrow::KeyValueMetadata> strings_to_kvm(cpp11::strings metadata);
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<acero::ExecPlan> ExecPlan_create(bool use_threads) {
   static compute::ExecContext threaded_context{gc_memory_pool(),
                                                arrow::internal::GetCpuThreadPool()};
@@ -185,7 +189,7 @@ class ExecPlanReader : public arrow::RecordBatchReader {
   }
 };
 
-// [[arrow::export]]
+// [[acero::export]]
 cpp11::list ExecPlanReader__batches(
     const std::shared_ptr<arrow::RecordBatchReader>& reader) {
   auto result = RunWithCapturedRIfPossible<arrow::RecordBatchVector>(
@@ -193,7 +197,7 @@ cpp11::list ExecPlanReader__batches(
   return arrow::r::to_r_list(ValueOrStop(result));
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<arrow::Table> Table__from_ExecPlanReader(
     const std::shared_ptr<arrow::RecordBatchReader>& reader) {
   auto result = RunWithCapturedRIfPossible<std::shared_ptr<arrow::Table>>(
@@ -202,7 +206,7 @@ std::shared_ptr<arrow::Table> Table__from_ExecPlanReader(
   return ValueOrStop(result);
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<acero::ExecPlan> ExecPlanReader__Plan(
     const std::shared_ptr<ExecPlanReader>& reader) {
   if (reader->PlanStatus() == "PLAN_FINISHED") {
@@ -212,12 +216,12 @@ std::shared_ptr<acero::ExecPlan> ExecPlanReader__Plan(
   return reader->Plan();
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::string ExecPlanReader__PlanStatus(const std::shared_ptr<ExecPlanReader>& reader) {
   return reader->PlanStatus();
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<ExecPlanReader> ExecPlan_run(
     const std::shared_ptr<acero::ExecPlan>& plan,
     const std::shared_ptr<acero::ExecNode>& final_node, cpp11::list sort_options,
@@ -262,18 +266,18 @@ std::shared_ptr<ExecPlanReader> ExecPlan_run(
   return std::make_shared<ExecPlanReader>(plan, out_schema, sink_gen);
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::string ExecPlan_ToString(const std::shared_ptr<acero::ExecPlan>& plan) {
   return plan->ToString();
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 void ExecPlan_UnsafeDelete(const std::shared_ptr<acero::ExecPlan>& plan) {
   auto& plan_unsafe = const_cast<std::shared_ptr<acero::ExecPlan>&>(plan);
   plan_unsafe.reset();
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<arrow::Schema> ExecNode_output_schema(
     const std::shared_ptr<acero::ExecNode>& node) {
   return node->output_schema();
@@ -362,7 +366,7 @@ void ExecPlan_Write(
 
 #endif
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<acero::ExecNode> ExecNode_Filter(
     const std::shared_ptr<acero::ExecNode>& input,
     const std::shared_ptr<compute::Expression>& filter) {
@@ -370,7 +374,7 @@ std::shared_ptr<acero::ExecNode> ExecNode_Filter(
                             acero::FilterNodeOptions{*filter});
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<acero::ExecNode> ExecNode_Project(
     const std::shared_ptr<acero::ExecNode>& input,
     const std::vector<std::shared_ptr<compute::Expression>>& exprs,
@@ -385,7 +389,7 @@ std::shared_ptr<acero::ExecNode> ExecNode_Project(
       acero::ProjectNodeOptions{std::move(expressions), std::move(names)});
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<acero::ExecNode> ExecNode_Aggregate(
     const std::shared_ptr<acero::ExecNode>& input, cpp11::list options,
     std::vector<std::string> key_names) {
@@ -414,7 +418,7 @@ std::shared_ptr<acero::ExecNode> ExecNode_Aggregate(
       acero::AggregateNodeOptions{std::move(aggregates), std::move(keys)});
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<acero::ExecNode> ExecNode_Join(
     const std::shared_ptr<acero::ExecNode>& input, acero::JoinType join_type,
     const std::shared_ptr<acero::ExecNode>& right_data,
@@ -449,14 +453,14 @@ std::shared_ptr<acero::ExecNode> ExecNode_Join(
           std::move(output_suffix_for_left), std::move(output_suffix_for_right)});
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<acero::ExecNode> ExecNode_Union(
     const std::shared_ptr<acero::ExecNode>& input,
     const std::shared_ptr<acero::ExecNode>& right_data) {
   return MakeExecNodeOrStop("union", input->plan(), {input.get(), right_data.get()}, {});
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<acero::ExecNode> ExecNode_SourceNode(
     const std::shared_ptr<acero::ExecPlan>& plan,
     const std::shared_ptr<arrow::RecordBatchReader>& reader) {
@@ -464,7 +468,7 @@ std::shared_ptr<acero::ExecNode> ExecNode_SourceNode(
   return MakeExecNodeOrStop("record_batch_reader_source", plan.get(), {}, options);
 }
 
-// [[arrow::export]]
+// [[acero::export]]
 std::shared_ptr<acero::ExecNode> ExecNode_TableSourceNode(
     const std::shared_ptr<acero::ExecPlan>& plan,
     const std::shared_ptr<arrow::Table>& table) {
@@ -475,6 +479,8 @@ std::shared_ptr<acero::ExecNode> ExecNode_TableSourceNode(
   return MakeExecNodeOrStop("table_source", plan.get(), {}, options);
 }
 
+#endif
+
 #if defined(ARROW_R_WITH_SUBSTRAIT)
 
 #include <arrow/engine/substrait/api.h>
diff --git a/r/tests/testthat/test-dplyr-arrange.R b/r/tests/testthat/test-dplyr-arrange.R
index 3444e3ace5..85c71fb7c9 100644
--- a/r/tests/testthat/test-dplyr-arrange.R
+++ b/r/tests/testthat/test-dplyr-arrange.R
@@ -17,6 +17,8 @@
 
 library(dplyr, warn.conflicts = FALSE)
 
+skip_if_not_available("acero")
+
 # randomize order of rows in test data
 tbl <- slice_sample(example_data_for_sorting, prop = 1L)
 
diff --git a/r/tests/testthat/test-dplyr-collapse.R b/r/tests/testthat/test-dplyr-collapse.R
index cca8412178..198827e235 100644
--- a/r/tests/testthat/test-dplyr-collapse.R
+++ b/r/tests/testthat/test-dplyr-collapse.R
@@ -20,6 +20,8 @@ withr::local_options(list(arrow.summarise.sort = TRUE))
 library(dplyr, warn.conflicts = FALSE)
 library(stringr)
 
+skip_if_not_available("acero")
+
 tbl <- example_data
 # Add some better string data
 tbl$verses <- verses[[1]]
diff --git a/r/tests/testthat/test-dplyr-count.R b/r/tests/testthat/test-dplyr-count.R
index 333ac9ff33..6c45ded31d 100644
--- a/r/tests/testthat/test-dplyr-count.R
+++ b/r/tests/testthat/test-dplyr-count.R
@@ -17,6 +17,8 @@
 
 library(dplyr, warn.conflicts = FALSE)
 
+skip_if_not_available("acero")
+
 tbl <- example_data
 tbl$some_grouping <- rep(c(1, 2), 5)
 tbl$another_grouping <- rep(c(1, 2), 5)
diff --git a/r/tests/testthat/test-dplyr-distinct.R b/r/tests/testthat/test-dplyr-distinct.R
index 09a8d5f8f5..4c7f8894cd 100644
--- a/r/tests/testthat/test-dplyr-distinct.R
+++ b/r/tests/testthat/test-dplyr-distinct.R
@@ -17,6 +17,8 @@
 
 library(dplyr, warn.conflicts = FALSE)
 
+skip_if_not_available("acero")
+
 tbl <- example_data
 tbl$some_grouping <- rep(c(1, 2), 5)
 
diff --git a/r/tests/testthat/test-dplyr-filter.R b/r/tests/testthat/test-dplyr-filter.R
index 24754afcf8..8b144f4785 100644
--- a/r/tests/testthat/test-dplyr-filter.R
+++ b/r/tests/testthat/test-dplyr-filter.R
@@ -18,6 +18,8 @@
 library(dplyr, warn.conflicts = FALSE)
 library(stringr)
 
+skip_if_not_available("acero")
+
 tbl <- example_data
 # Add some better string data
 tbl$verses <- verses[[1]]
diff --git a/r/tests/testthat/test-dplyr-funcs-conditional.R b/r/tests/testthat/test-dplyr-funcs-conditional.R
index e1dcd7bb09..85d21b7322 100644
--- a/r/tests/testthat/test-dplyr-funcs-conditional.R
+++ b/r/tests/testthat/test-dplyr-funcs-conditional.R
@@ -18,6 +18,7 @@
 library(dplyr, warn.conflicts = FALSE)
 suppressPackageStartupMessages(library(bit64))
 
+skip_if_not_available("acero")
 
 tbl <- example_data
 tbl$verses <- verses[[1]]
diff --git a/r/tests/testthat/test-dplyr-funcs-datetime.R b/r/tests/testthat/test-dplyr-funcs-datetime.R
index 059764861e..d47f923211 100644
--- a/r/tests/testthat/test-dplyr-funcs-datetime.R
+++ b/r/tests/testthat/test-dplyr-funcs-datetime.R
@@ -21,6 +21,8 @@ skip_on_r_older_than("3.5")
 library(lubridate, warn.conflicts = FALSE)
 library(dplyr, warn.conflicts = FALSE)
 
+skip_if_not_available("acero")
+
 # base::strptime() defaults to local timezone
 # but arrow's strptime defaults to UTC.
 # So that tests are consistent, set the local timezone to UTC
diff --git a/r/tests/testthat/test-dplyr-funcs-math.R b/r/tests/testthat/test-dplyr-funcs-math.R
index 66b3a510f9..733a7c6ea0 100644
--- a/r/tests/testthat/test-dplyr-funcs-math.R
+++ b/r/tests/testthat/test-dplyr-funcs-math.R
@@ -17,6 +17,7 @@
 
 library(dplyr, warn.conflicts = FALSE)
 
+skip_if_not_available("acero")
 
 test_that("abs()", {
   df <- tibble(x = c(-127, -10, -1, -0, 0, 1, 10, 127, NA))
diff --git a/r/tests/testthat/test-dplyr-funcs-string.R b/r/tests/testthat/test-dplyr-funcs-string.R
index bb60a79daa..0dc834dbfe 100644
--- a/r/tests/testthat/test-dplyr-funcs-string.R
+++ b/r/tests/testthat/test-dplyr-funcs-string.R
@@ -16,6 +16,7 @@
 # under the License.
 
 skip_if_not_available("utf8proc")
+skip_if_not_available("acero")
 
 library(dplyr, warn.conflicts = FALSE)
 library(lubridate)
diff --git a/r/tests/testthat/test-dplyr-funcs-type.R b/r/tests/testthat/test-dplyr-funcs-type.R
index ccf16dd4db..435fa5fcb8 100644
--- a/r/tests/testthat/test-dplyr-funcs-type.R
+++ b/r/tests/testthat/test-dplyr-funcs-type.R
@@ -19,6 +19,7 @@ library(dplyr, warn.conflicts = FALSE)
 suppressPackageStartupMessages(library(bit64))
 suppressPackageStartupMessages(library(lubridate))
 
+skip_if_not_available("acero")
 
 tbl <- example_data
 
diff --git a/r/tests/testthat/test-dplyr-group-by.R b/r/tests/testthat/test-dplyr-group-by.R
index 3c5d174b0c..5847e11e0f 100644
--- a/r/tests/testthat/test-dplyr-group-by.R
+++ b/r/tests/testthat/test-dplyr-group-by.R
@@ -18,6 +18,8 @@
 library(dplyr, warn.conflicts = FALSE)
 library(stringr)
 
+skip_if_not_available("acero")
+
 tbl <- example_data
 
 test_that("group_by groupings are recorded", {
diff --git a/r/tests/testthat/test-dplyr-join.R b/r/tests/testthat/test-dplyr-join.R
index 2520d561cf..e3e1e98cfc 100644
--- a/r/tests/testthat/test-dplyr-join.R
+++ b/r/tests/testthat/test-dplyr-join.R
@@ -17,6 +17,8 @@
 
 library(dplyr, warn.conflicts = FALSE)
 
+skip_if_not_available("acero")
+
 left <- example_data
 left$some_grouping <- rep(c(1, 2), 5)
 
diff --git a/r/tests/testthat/test-dplyr-mutate.R b/r/tests/testthat/test-dplyr-mutate.R
index 5d431089ce..ab37747458 100644
--- a/r/tests/testthat/test-dplyr-mutate.R
+++ b/r/tests/testthat/test-dplyr-mutate.R
@@ -18,6 +18,8 @@
 library(dplyr, warn.conflicts = FALSE)
 library(stringr)
 
+skip_if_not_available("acero")
+
 tbl <- example_data
 # Add some better string data
 tbl$verses <- verses[[1]]
diff --git a/r/tests/testthat/test-dplyr-query.R b/r/tests/testthat/test-dplyr-query.R
index 0b2b23ec86..5dbdb0e522 100644
--- a/r/tests/testthat/test-dplyr-query.R
+++ b/r/tests/testthat/test-dplyr-query.R
@@ -18,6 +18,8 @@
 library(dplyr, warn.conflicts = FALSE)
 library(stringr)
 
+skip_if_not_available("acero")
+
 tbl <- example_data
 # Add some better string data
 tbl$verses <- verses[[1]]
diff --git a/r/tests/testthat/test-dplyr-select.R b/r/tests/testthat/test-dplyr-select.R
index f71c400044..dff73c063b 100644
--- a/r/tests/testthat/test-dplyr-select.R
+++ b/r/tests/testthat/test-dplyr-select.R
@@ -18,6 +18,8 @@
 library(dplyr, warn.conflicts = FALSE)
 library(stringr)
 
+skip_if_not_available("acero")
+
 tbl <- example_data
 
 test_that("Empty select returns no columns", {
diff --git a/r/tests/testthat/test-dplyr-slice.R b/r/tests/testthat/test-dplyr-slice.R
index 9cef51d4f7..6d0711589c 100644
--- a/r/tests/testthat/test-dplyr-slice.R
+++ b/r/tests/testthat/test-dplyr-slice.R
@@ -17,6 +17,8 @@
 
 library(dplyr, warn.conflicts = FALSE)
 
+skip_if_not_available("acero")
+
 tbl <- example_data
 
 test_that("slice_head/tail, ungrouped", {
diff --git a/r/tests/testthat/test-dplyr-summarize.R b/r/tests/testthat/test-dplyr-summarize.R
index 12ccec21ee..1b834df19f 100644
--- a/r/tests/testthat/test-dplyr-summarize.R
+++ b/r/tests/testthat/test-dplyr-summarize.R
@@ -26,6 +26,8 @@ withr::local_options(list(
 library(dplyr, warn.conflicts = FALSE)
 library(stringr)
 
+skip_if_not_available("acero")
+
 tbl <- example_data
 # Add some better string data
 tbl$verses <- verses[[1]]
diff --git a/r/tests/testthat/test-dplyr-union.R b/r/tests/testthat/test-dplyr-union.R
index 1bf8610c56..9774c6c0c0 100644
--- a/r/tests/testthat/test-dplyr-union.R
+++ b/r/tests/testthat/test-dplyr-union.R
@@ -16,6 +16,8 @@
 
 library(dplyr, warn.conflicts = FALSE)
 
+skip_if_not_available("acero")
+
 withr::local_options(list(arrow.summarise.sort = FALSE))
 
 test_that("union_all", {
diff --git a/r/tests/testthat/test-io.R b/r/tests/testthat/test-io.R
index 8698250d47..b4780af75d 100644
--- a/r/tests/testthat/test-io.R
+++ b/r/tests/testthat/test-io.R
@@ -244,4 +244,3 @@ test_that("reencoding input stream errors for invalid characters", {
 
   unlink(temp_utf8)
 })
-
diff --git a/r/tests/testthat/test-parquet.R b/r/tests/testthat/test-parquet.R
index 12711521cc..70e2b6b7c8 100644
--- a/r/tests/testthat/test-parquet.R
+++ b/r/tests/testthat/test-parquet.R
@@ -466,6 +466,8 @@ test_that("Can read parquet with nested lists and maps", {
   parquet_test_data <- file.path(base_path, "cpp", "submodules", "parquet-testing", "data")
   skip_if_not(dir.exists(parquet_test_data) | force_tests(), "Parquet test data missing")
 
+  skip_if_not_available("snappy")
+
   pq <- read_parquet(paste0(parquet_test_data, "/nested_lists.snappy.parquet"), as_data_frame = FALSE)
   expect_type_equal(pq$a, list_of(field("element", list_of(field("element", list_of(field("element", utf8())))))))
 
diff --git a/r/tests/testthat/test-query-engine.R b/r/tests/testthat/test-query-engine.R
index 1d8d876bf5..a33f004fc5 100644
--- a/r/tests/testthat/test-query-engine.R
+++ b/r/tests/testthat/test-query-engine.R
@@ -17,6 +17,8 @@
 
 library(dplyr, warn.conflicts = FALSE)
 
+skip_if_not_available("acero")
+
 test_that("ExecPlanReader does not start evaluating a query", {
   skip_if_not(CanRunWithCapturedR())
 
diff --git a/r/tests/testthat/test-udf.R b/r/tests/testthat/test-udf.R
index 7836255e86..0eb75b1dde 100644
--- a/r/tests/testthat/test-udf.R
+++ b/r/tests/testthat/test-udf.R
@@ -20,7 +20,6 @@ test_that("list_compute_functions() works", {
   expect_true(all(!grepl("^hash_", list_compute_functions())))
 })
 
-
 test_that("arrow_scalar_function() works", {
   # check in/out type as schema/data type
   fun <- arrow_scalar_function(
@@ -106,6 +105,8 @@ test_that("register_scalar_function() adds a compute function to the registry",
     Scalar$create(32L, float64())
   )
 
+  skip_if_not_available("acero")
+
   expect_identical(
     record_batch(a = 1L) %>%
       dplyr::mutate(b = times_32(a)) %>%
diff --git a/r/tools/autobrew b/r/tools/autobrew
index 73e6e11a16..f181309892 100644
--- a/r/tools/autobrew
+++ b/r/tools/autobrew
@@ -62,7 +62,7 @@ fi
 # Hardcode this for my custom autobrew build
 rm -f $BREWDIR/lib/*.dylib
 AWS_LIBS="-laws-cpp-sdk-config -laws-cpp-sdk-transfer -laws-cpp-sdk-identity-management -laws-cpp-sdk-cognito-identity -laws-cpp-sdk-sts -laws-cpp-sdk-s3 -laws-cpp-sdk-core -laws-c-event-stream -laws-checksums -laws-c-common -laws-crt-cpp -laws-c-io -laws-c-s3 -laws-c-auth -laws-c-http -laws-c-cal -laws-c-compression -laws-c-mqtt -lpthread -lcurl"
-PKG_LIBS="-lparquet -larrow_dataset -larrow -larrow_bundled_dependencies -lthrift -lbrotlienc-static -lbrotlidec-static -lbrotlicommon-static -llz4 -lsnappy -lzstd $AWS_LIBS"
+PKG_LIBS="-lparquet -larrow_dataset -larrow_acero -larrow -larrow_bundled_dependencies -lthrift -lbrotlienc-static -lbrotlidec-static -lbrotlicommon-static -llz4 -lsnappy -lzstd $AWS_LIBS"
 PKG_DIRS="-L$BREWDIR/lib"
 
 # Prevent CRAN builder from linking against old libs in /usr/local/lib
@@ -74,7 +74,7 @@ for FILE in $BREWDIR/Cellar/*/*/lib/*.a; do
   PKG_LIBS=`echo $PKG_LIBS | sed "s/-l$LIBNAME/-lbrew$LIBNAME/g"`
 done
 
-PKG_CFLAGS="-I$BREWDIR/opt/$PKG_BREW_NAME/include -DARROW_R_WITH_PARQUET -DARROW_R_WITH_DATASET -DARROW_R_WITH_JSON -DARROW_R_WITH_S3 -DARROW_R_WITH_GCS -D_LIBCPP_DISABLE_AVAILABILITY"
+PKG_CFLAGS="-I$BREWDIR/opt/$PKG_BREW_NAME/include -DARROW_R_WITH_PARQUET -DARROW_R_WITH_ACERO -DARROW_R_WITH_DATASET -DARROW_R_WITH_JSON -DARROW_R_WITH_S3 -DARROW_R_WITH_GCS -D_LIBCPP_DISABLE_AVAILABILITY"
 
 unset HOMEBREW_NO_ANALYTICS
 unset HOMEBREW_NO_AUTO_UPDATE