You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2023/06/19 16:46:31 UTC

[arrow-adbc] 02/03: feat(format): remove unnecessary padding (#731)

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

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

commit b2f5395df059e11d24c02f1103280531a9e66b05
Author: David Li <li...@gmail.com>
AuthorDate: Tue Jun 6 14:28:48 2023 -0400

    feat(format): remove unnecessary padding (#731)
    
    - Clarify one of the docstrings
    - Remove the 'future growth' padding since we have a different
    compatibility strategy
---
 adbc.h                                       | 5 +----
 c/driver_manager/adbc_driver_manager.cc      | 3 ---
 c/driver_manager/adbc_driver_manager_test.cc | 2 --
 3 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/adbc.h b/adbc.h
index 756288da..5118f830 100644
--- a/adbc.h
+++ b/adbc.h
@@ -799,7 +799,7 @@ struct ADBC_EXPORT AdbcDriver {
   /// and attempt to have the driver initialize it with
   /// ADBC_VERSION_1_1_0.  This must return an error, after which the
   /// driver will try again with ADBC_VERSION_1_0_0.  The driver must
-  /// not access the new fields.
+  /// not access the new fields, which will carry undefined values.
   ///
   /// For a 1.1.0 driver being loaded by a 1.0.0 driver manager: the
   /// 1.0.0 manager will allocate the old AdbcDriver struct and
@@ -845,9 +845,6 @@ struct ADBC_EXPORT AdbcDriver {
   AdbcStatusCode (*StatementSetOptionDouble)(struct AdbcStatement*, const char*, double,
                                              struct AdbcError*);
 
-  /// Pad the struct to have 96 pointers.  Space reserved for future growth.
-  void* reserved[50];
-
   /// @}
 };
 
diff --git a/c/driver_manager/adbc_driver_manager.cc b/c/driver_manager/adbc_driver_manager.cc
index 888c48a6..4ad77f2e 100644
--- a/c/driver_manager/adbc_driver_manager.cc
+++ b/c/driver_manager/adbc_driver_manager.cc
@@ -870,9 +870,6 @@ AdbcStatusCode AdbcLoadDriverFromInitFunc(AdbcDriverInitFunc init_func, int vers
   if (version >= ADBC_VERSION_1_1_0) {
     auto* driver = reinterpret_cast<struct AdbcDriver*>(raw_driver);
     FILL_DEFAULT(driver, StatementExecuteSchema);
-
-    // Zero out the padding
-    std::memset(driver->reserved, 0, sizeof(driver->reserved));
   }
 
   return ADBC_STATUS_OK;
diff --git a/c/driver_manager/adbc_driver_manager_test.cc b/c/driver_manager/adbc_driver_manager_test.cc
index 26c8dc61..97743e70 100644
--- a/c/driver_manager/adbc_driver_manager_test.cc
+++ b/c/driver_manager/adbc_driver_manager_test.cc
@@ -34,8 +34,6 @@ namespace adbc {
 using adbc_validation::IsOkStatus;
 using adbc_validation::IsStatus;
 
-TEST(Adbc, AdbcDriverSize) { ASSERT_EQ(sizeof(AdbcDriver), 96 * sizeof(void*)); }
-
 class DriverManager : public ::testing::Test {
  public:
   void SetUp() override {