You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by pa...@apache.org on 2023/06/26 14:06:47 UTC

[arrow-adbc] branch main updated: chore(r/adbcpostgresql): Add R 3.6 check to CI grid (#849)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new a6702884 chore(r/adbcpostgresql): Add R 3.6 check to CI grid (#849)
a6702884 is described below

commit a670288409dfa27063d73f2549127ceded5ff3eb
Author: Dewey Dunnington <de...@voltrondata.com>
AuthorDate: Mon Jun 26 11:06:40 2023 -0300

    chore(r/adbcpostgresql): Add R 3.6 check to CI grid (#849)
    
    Closes #848.
---
 .github/workflows/native-unix.yml          | 12 ++++++---
 c/driver/common/utils.h                    | 40 ++++++++++++++----------------
 c/driver/postgresql/postgres_copy_reader.h |  5 ++++
 3 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/.github/workflows/native-unix.yml b/.github/workflows/native-unix.yml
index ad838522..32d24a07 100644
--- a/.github/workflows/native-unix.yml
+++ b/.github/workflows/native-unix.yml
@@ -581,7 +581,7 @@ jobs:
   # R
   # ------------------------------------------------------------
   r:
-    name: "R/${{ matrix.config.pkg }} (${{ matrix.config.os }})"
+    name: "R-${{ matrix.config.r }}/${{ matrix.config.pkg }} (${{ matrix.config.os }})"
     runs-on: ${{ matrix.config.os }}
     strategy:
       matrix:
@@ -594,6 +594,7 @@ jobs:
           - {os: ubuntu-latest,   r: 'release', pkg: 'adbcsqlite'}
           - {os: macOS-latest,   r: 'release', pkg: 'adbcpostgresql'}
           - {os: windows-latest,   r: 'release', pkg: 'adbcpostgresql'}
+          - {os: windows-latest,   r: '3.6', pkg: 'adbcpostgresql'}
           - {os: ubuntu-latest,   r: 'release', pkg: 'adbcpostgresql'}
           - {os: macOS-latest,   r: 'release', pkg: 'adbcsnowflake'}
           - {os: windows-latest,   r: 'release', pkg: 'adbcsnowflake'}
@@ -628,14 +629,14 @@ jobs:
       - name: Prepare sources (driver manager)
         if: matrix.config.pkg == 'adbcdrivermanager'
         run: |
-          R -e 'install.packages("nanoarrow", repos = "https://cloud.r-project.org")'
+          R -e "install.packages('nanoarrow', repos = 'https://cloud.r-project.org')"
           R CMD INSTALL r/${{ matrix.config.pkg }}
         shell: bash
 
       - name: Prepare sources
         if: matrix.config.pkg != 'adbcdrivermanager'
         run: |
-          R -e 'install.packages("nanoarrow", repos = "https://cloud.r-project.org")'
+          R -e "install.packages('nanoarrow', repos = 'https://cloud.r-project.org')"
           R CMD INSTALL r/adbcdrivermanager
           R CMD INSTALL r/${{ matrix.config.pkg }}
         shell: bash
@@ -669,6 +670,11 @@ jobs:
         with:
           upload-snapshots: true
           working-directory: r/${{ matrix.config.pkg }}
+          # Using --no-multiarch here means that in version of R that support
+          # 32-bit Windows builds, only the 64-bit version is tested. With some
+          # effort we could also test 32-bit builds; however, they are not commonly
+          # used.
+          args: 'c("--no-manual", "--as-cran", "--no-multiarch")'
 
       - name: Stop test database
         if: runner.os == 'Linux'
diff --git a/c/driver/common/utils.h b/c/driver/common/utils.h
index f0b5fa33..5735bb94 100644
--- a/c/driver/common/utils.h
+++ b/c/driver/common/utils.h
@@ -23,25 +23,21 @@
 #include <adbc.h>
 #include "nanoarrow/nanoarrow.h"
 
-#if defined(__GNUC__)
-#define SET_ERROR_ATTRIBUTE __attribute__((format(printf, 2, 3)))
-#else
-#define SET_ERROR_ATTRIBUTE
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/// Set error details using a format string.
-void SetError(struct AdbcError* error, const char* format, ...) SET_ERROR_ATTRIBUTE;
-
-#undef SET_ERROR_ATTRIBUTE
+// The printf checking attribute doesn't work properly on gcc 4.8
+// and results in spurious compiler warnings
+#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 5)
+#define ADBC_CHECK_PRINTF_ATTRIBUTE __attribute__((format(printf, 2, 3)))
+#else
+#define ADBC_CHECK_PRINTF_ATTRIBUTE
+#endif
 
-/// Wrap a single batch as a stream.
-AdbcStatusCode BatchToArrayStream(struct ArrowArray* values, struct ArrowSchema* schema,
-                                  struct ArrowArrayStream* stream,
-                                  struct AdbcError* error);
+/// Set error details using a format string.
+void SetError(struct AdbcError* error, const char* format,
+              ...) ADBC_CHECK_PRINTF_ATTRIBUTE;
 
 struct StringBuilder {
   char* buffer;
@@ -51,15 +47,17 @@ struct StringBuilder {
 };
 int StringBuilderInit(struct StringBuilder* builder, size_t initial_size);
 
-#if defined(__GNUC__)
-#define ADBC_STRING_BUILDER_FORMAT_CHECK __attribute__((format(printf, 2, 3)))
-#else
-#define ADBC_STRING_BUILDER_FORMAT_CHECK
-#endif
-int ADBC_STRING_BUILDER_FORMAT_CHECK StringBuilderAppend(struct StringBuilder* builder,
-                                                         const char* fmt, ...);
+int ADBC_CHECK_PRINTF_ATTRIBUTE StringBuilderAppend(struct StringBuilder* builder,
+                                                    const char* fmt, ...);
 void StringBuilderReset(struct StringBuilder* builder);
 
+#undef ADBC_CHECK_PRINTF_ATTRIBUTE
+
+/// Wrap a single batch as a stream.
+AdbcStatusCode BatchToArrayStream(struct ArrowArray* values, struct ArrowSchema* schema,
+                                  struct ArrowArrayStream* stream,
+                                  struct AdbcError* error);
+
 /// Check an NanoArrow status code.
 #define CHECK_NA(CODE, EXPR, ERROR)                                                 \
   do {                                                                              \
diff --git a/c/driver/postgresql/postgres_copy_reader.h b/c/driver/postgresql/postgres_copy_reader.h
index 78358a9c..813fd50a 100644
--- a/c/driver/postgresql/postgres_copy_reader.h
+++ b/c/driver/postgresql/postgres_copy_reader.h
@@ -29,6 +29,11 @@
 #include "postgres_type.h"
 #include "postgres_util.h"
 
+// R 3.6 / Windows builds on a very old toolchain that does not define ENODATA
+#if defined(_WIN32) && !defined(MSVC) && !defined(ENODATA)
+#define ENODATA 120
+#endif
+
 namespace adbcpq {
 
 // "PGCOPY\n\377\r\n\0"