From ed8252a6e776476c522f99affa90cde59c0bb3c9 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Thu, 8 Jan 2026 13:00:18 -0500 Subject: [PATCH 01/12] feat: Spec multi-result-set API --- c/include/arrow-adbc/adbc.h | 121 ++++++++++++++++++++++++++++++++---- 1 file changed, 110 insertions(+), 11 deletions(-) diff --git a/c/include/arrow-adbc/adbc.h b/c/include/arrow-adbc/adbc.h index a55f645ed7..935b790554 100644 --- a/c/include/arrow-adbc/adbc.h +++ b/c/include/arrow-adbc/adbc.h @@ -423,6 +423,14 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream /// \since ADBC API revision 1.1.0 #define ADBC_VERSION_1_1_0 1001000 +/// \brief ADBC revision 1.2.0 +/// +/// When passed to an AdbcDriverInitFunc(), the driver parameter must +/// point to an AdbcDriver. +/// +/// \since ADBC API revision 1.2.0 +#define ADBC_VERSION_1_2_0 1002000 + /// \brief Canonical option value for enabling an option. /// /// For use as the value in SetOption calls. @@ -525,6 +533,7 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream /// \see AdbcConnectionGetInfo /// \see ADBC_VERSION_1_0_0 /// \see ADBC_VERSION_1_1_0 +/// \see ADBC_VERSION_1_2_0 #define ADBC_INFO_DRIVER_ADBC_VERSION 103 /// \brief Return metadata on catalogs, schemas, tables, and columns. @@ -1059,17 +1068,18 @@ struct ADBC_EXPORT AdbcDriver { /// the AdbcDriverInitFunc is greater than or equal to /// ADBC_VERSION_1_1_0. /// - /// For a 1.0.0 driver being loaded by a 1.1.0 driver manager: the - /// 1.1.0 manager will allocate the new, expanded AdbcDriver struct - /// 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, which will carry undefined values. + /// When a driver implementing an older spec is loaded by a newer + /// driver manager, the newer manager will allocate the new, expanded + /// AdbcDriver struct and attempt to have the driver initialize it with + /// the newer verison. This must return an error, after which the driver + /// will try again with successively older versions all the way back to + /// ADBC_VERSION_1_0_0. The driver must 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 - /// attempt to have the driver initialize it with - /// ADBC_VERSION_1_0_0. The driver must not access the new fields, + /// When a driver implementing a newer spec is loaded by an older + /// driver manager, the older manager will allocate the old AdbcDriver + /// struct and attempt to have the driver initialize it with the + /// older version. The driver must not access the new fields, /// and should initialize the old fields. /// /// @{ @@ -1135,6 +1145,36 @@ struct ADBC_EXPORT AdbcDriver { struct AdbcError*); /// @} + + /// \defgroup adbc-1.2.0 ADBC API Revision 1.2.0 + /// + /// Functions added in ADBC 1.2.0. For backwards compatibility, + /// these members must not be accessed unless the version passed to + /// the AdbcDriverInitFunc is greater than or equal to + /// ADBC_VERSION_1_2_0. + /// + /// When a driver implementing an older spec is loaded by a newer + /// driver manager, the newer manager will allocate the new, expanded + /// AdbcDriver struct and attempt to have the driver initialize it with + /// the newer verison. This must return an error, after which the driver + /// will try again with successively older versions all the way back to + /// ADBC_VERSION_1_0_0. The driver must not access the new fields, + /// which will carry undefined values. + /// + /// When a driver implementing a newer spec is loaded by an older + /// driver manager, the older manager will allocate the old AdbcDriver + /// struct and attempt to have the driver initialize it with the + /// older version. The driver must not access the new fields, + /// and should initialize the old fields. + /// + /// @{ + + AdbcStatusCode (*StatementNextResultSet)(struct AdbcStatement*, + struct ArrowArrayStream*, + struct AdbcPartitions*, int64_t*, + struct AdbcError*); + + /// @} }; /// \brief The size of the AdbcDriver structure in ADBC 1.0.0. @@ -1151,7 +1191,15 @@ struct ADBC_EXPORT AdbcDriver { /// ADBC_VERSION_1_1_0. /// /// \since ADBC API revision 1.1.0 -#define ADBC_DRIVER_1_1_0_SIZE (sizeof(struct AdbcDriver)) +#define ADBC_DRIVER_1_1_0_SIZE (offsetof(struct AdbcDriver, StatementNextResultSet)) + +/// \brief The size of the AdbcDriver structure in ADBC 1.2.0. +/// Drivers written for ADBC 1.2.0 and later should never touch more +/// than this portion of an AdbcDriver struct when given +/// ADBC_VERSION_1_2_0. +/// +/// \since ADBC API revision 1.2.0 +#define ADBC_DRIVER_1_2_0_SIZE (sizeof(struct AdbcDriver)) /// @} @@ -2013,6 +2061,57 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, struct ArrowArrayStream* out, int64_t* rows_affected, struct AdbcError* error); +/// \brief Retrieve the next result set from a multi-result-set execution. +/// +/// This AdbcStatement must outlive the returned ArrowArrayStream. +/// +/// \since ADBC API revision 1.2.0 +/// +/// For an execution that returns multiple result sets, this can be called after +/// iterating the first result set to get the next and subsequent result sets. A +/// driver MAY support calling AdbcStatementNextResultSet while the previous result is +/// still being consumed (i.e. before the previous ArrowArrayStream is released), +/// but this is not required. If the driver does not support this, it should return +/// ADBC_STATUS_INVALID_STATE if the previous result set is still active. Otherwise +/// a driver should return ADBC_STATUS_OK to indicate successful execution of this +/// function regardless of whether or not an additional result set is available. +/// +/// If the original execution was via AdbcStatementExecuteSchema, then the +/// ArrowArrayStream populated by this function should only contain the schema of the +/// result set and not any data. +/// +/// Either partitions or out must be NULL to indicate which style of output is desired +/// by the caller. Supplying non-NULL values to both must result in +/// ADBC_STATUS_INVALID_ARGUMENT. If the original execution was via +/// AdbcStatementExecuteQuery and the call to AdbcStatementNextResultSet has a non-NULL +/// partitions, or the original was via AdbcStatementExecutePartitions and this call has a +/// non-NULL out, then the driver may choose to return the data in a different style than +/// the original result set. If it does not (or cannot) then it should return +/// ADBC_STATUS_INVALID_ARGUMENT. +/// +/// The driver indicates that no additional result sets are available by setting the +/// release callback on out (or partitions, whichever was not-NULL) to NULL and returning +/// ADBC_STATUS_OK. +/// +/// \param[in] statement The statement to fetch a subsequent result for +/// \param[out] out The result stream to populate, or NULL if using partitions +/// \param[out] partitions The partitions to populate, or NULL if using out +/// \param[out] rows_affected The number of rows affected if known, else -1. Pass NULL if +/// the client does not want this information. +/// \param[out] error An optional location to return an error message if necessary. +/// +/// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver does not support multi-result set +/// execution, ADBC_STATUS_INVALID_STATE if called at an inappropriate time but the +/// driver does support multi-result set execution, ADBC_STATUS_INVALID_ARGUMENT if both +/// out and partitions are non-NULL, or if the output style is incompatible with the +/// original execution, and ADBC_STATUS_OK (or an appropriate error code) otherwise. +ADBC_EXPORT +AdbcStatusCode AdbcStatementNextResultSet(struct AdbcStatement* statement, + struct ArrowArrayStream* out, + struct AdbcPartitions* partitions, + int64_t* rows_affected, + struct AdbcError* error); + /// \brief Get the schema of the result set of a query without /// executing it. /// From 8ec1d95f5f82de01d0e096bb89befbe97ccec7c5 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Thu, 8 Jan 2026 13:09:17 -0500 Subject: [PATCH 02/12] linting --- c/include/arrow-adbc/adbc.h | 4 +- go/adbc/drivermgr/arrow-adbc/adbc.h | 121 +++++++++++++++++++++++++--- 2 files changed, 112 insertions(+), 13 deletions(-) diff --git a/c/include/arrow-adbc/adbc.h b/c/include/arrow-adbc/adbc.h index 935b790554..ce6119b18f 100644 --- a/c/include/arrow-adbc/adbc.h +++ b/c/include/arrow-adbc/adbc.h @@ -1071,7 +1071,7 @@ struct ADBC_EXPORT AdbcDriver { /// When a driver implementing an older spec is loaded by a newer /// driver manager, the newer manager will allocate the new, expanded /// AdbcDriver struct and attempt to have the driver initialize it with - /// the newer verison. This must return an error, after which the driver + /// the newer version. This must return an error, after which the driver /// will try again with successively older versions all the way back to /// ADBC_VERSION_1_0_0. The driver must not access the new fields, /// which will carry undefined values. @@ -1156,7 +1156,7 @@ struct ADBC_EXPORT AdbcDriver { /// When a driver implementing an older spec is loaded by a newer /// driver manager, the newer manager will allocate the new, expanded /// AdbcDriver struct and attempt to have the driver initialize it with - /// the newer verison. This must return an error, after which the driver + /// the newer version. This must return an error, after which the driver /// will try again with successively older versions all the way back to /// ADBC_VERSION_1_0_0. The driver must not access the new fields, /// which will carry undefined values. diff --git a/go/adbc/drivermgr/arrow-adbc/adbc.h b/go/adbc/drivermgr/arrow-adbc/adbc.h index a55f645ed7..ce6119b18f 100644 --- a/go/adbc/drivermgr/arrow-adbc/adbc.h +++ b/go/adbc/drivermgr/arrow-adbc/adbc.h @@ -423,6 +423,14 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream /// \since ADBC API revision 1.1.0 #define ADBC_VERSION_1_1_0 1001000 +/// \brief ADBC revision 1.2.0 +/// +/// When passed to an AdbcDriverInitFunc(), the driver parameter must +/// point to an AdbcDriver. +/// +/// \since ADBC API revision 1.2.0 +#define ADBC_VERSION_1_2_0 1002000 + /// \brief Canonical option value for enabling an option. /// /// For use as the value in SetOption calls. @@ -525,6 +533,7 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream /// \see AdbcConnectionGetInfo /// \see ADBC_VERSION_1_0_0 /// \see ADBC_VERSION_1_1_0 +/// \see ADBC_VERSION_1_2_0 #define ADBC_INFO_DRIVER_ADBC_VERSION 103 /// \brief Return metadata on catalogs, schemas, tables, and columns. @@ -1059,17 +1068,18 @@ struct ADBC_EXPORT AdbcDriver { /// the AdbcDriverInitFunc is greater than or equal to /// ADBC_VERSION_1_1_0. /// - /// For a 1.0.0 driver being loaded by a 1.1.0 driver manager: the - /// 1.1.0 manager will allocate the new, expanded AdbcDriver struct - /// 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, which will carry undefined values. + /// When a driver implementing an older spec is loaded by a newer + /// driver manager, the newer manager will allocate the new, expanded + /// AdbcDriver struct and attempt to have the driver initialize it with + /// the newer version. This must return an error, after which the driver + /// will try again with successively older versions all the way back to + /// ADBC_VERSION_1_0_0. The driver must 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 - /// attempt to have the driver initialize it with - /// ADBC_VERSION_1_0_0. The driver must not access the new fields, + /// When a driver implementing a newer spec is loaded by an older + /// driver manager, the older manager will allocate the old AdbcDriver + /// struct and attempt to have the driver initialize it with the + /// older version. The driver must not access the new fields, /// and should initialize the old fields. /// /// @{ @@ -1135,6 +1145,36 @@ struct ADBC_EXPORT AdbcDriver { struct AdbcError*); /// @} + + /// \defgroup adbc-1.2.0 ADBC API Revision 1.2.0 + /// + /// Functions added in ADBC 1.2.0. For backwards compatibility, + /// these members must not be accessed unless the version passed to + /// the AdbcDriverInitFunc is greater than or equal to + /// ADBC_VERSION_1_2_0. + /// + /// When a driver implementing an older spec is loaded by a newer + /// driver manager, the newer manager will allocate the new, expanded + /// AdbcDriver struct and attempt to have the driver initialize it with + /// the newer version. This must return an error, after which the driver + /// will try again with successively older versions all the way back to + /// ADBC_VERSION_1_0_0. The driver must not access the new fields, + /// which will carry undefined values. + /// + /// When a driver implementing a newer spec is loaded by an older + /// driver manager, the older manager will allocate the old AdbcDriver + /// struct and attempt to have the driver initialize it with the + /// older version. The driver must not access the new fields, + /// and should initialize the old fields. + /// + /// @{ + + AdbcStatusCode (*StatementNextResultSet)(struct AdbcStatement*, + struct ArrowArrayStream*, + struct AdbcPartitions*, int64_t*, + struct AdbcError*); + + /// @} }; /// \brief The size of the AdbcDriver structure in ADBC 1.0.0. @@ -1151,7 +1191,15 @@ struct ADBC_EXPORT AdbcDriver { /// ADBC_VERSION_1_1_0. /// /// \since ADBC API revision 1.1.0 -#define ADBC_DRIVER_1_1_0_SIZE (sizeof(struct AdbcDriver)) +#define ADBC_DRIVER_1_1_0_SIZE (offsetof(struct AdbcDriver, StatementNextResultSet)) + +/// \brief The size of the AdbcDriver structure in ADBC 1.2.0. +/// Drivers written for ADBC 1.2.0 and later should never touch more +/// than this portion of an AdbcDriver struct when given +/// ADBC_VERSION_1_2_0. +/// +/// \since ADBC API revision 1.2.0 +#define ADBC_DRIVER_1_2_0_SIZE (sizeof(struct AdbcDriver)) /// @} @@ -2013,6 +2061,57 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, struct ArrowArrayStream* out, int64_t* rows_affected, struct AdbcError* error); +/// \brief Retrieve the next result set from a multi-result-set execution. +/// +/// This AdbcStatement must outlive the returned ArrowArrayStream. +/// +/// \since ADBC API revision 1.2.0 +/// +/// For an execution that returns multiple result sets, this can be called after +/// iterating the first result set to get the next and subsequent result sets. A +/// driver MAY support calling AdbcStatementNextResultSet while the previous result is +/// still being consumed (i.e. before the previous ArrowArrayStream is released), +/// but this is not required. If the driver does not support this, it should return +/// ADBC_STATUS_INVALID_STATE if the previous result set is still active. Otherwise +/// a driver should return ADBC_STATUS_OK to indicate successful execution of this +/// function regardless of whether or not an additional result set is available. +/// +/// If the original execution was via AdbcStatementExecuteSchema, then the +/// ArrowArrayStream populated by this function should only contain the schema of the +/// result set and not any data. +/// +/// Either partitions or out must be NULL to indicate which style of output is desired +/// by the caller. Supplying non-NULL values to both must result in +/// ADBC_STATUS_INVALID_ARGUMENT. If the original execution was via +/// AdbcStatementExecuteQuery and the call to AdbcStatementNextResultSet has a non-NULL +/// partitions, or the original was via AdbcStatementExecutePartitions and this call has a +/// non-NULL out, then the driver may choose to return the data in a different style than +/// the original result set. If it does not (or cannot) then it should return +/// ADBC_STATUS_INVALID_ARGUMENT. +/// +/// The driver indicates that no additional result sets are available by setting the +/// release callback on out (or partitions, whichever was not-NULL) to NULL and returning +/// ADBC_STATUS_OK. +/// +/// \param[in] statement The statement to fetch a subsequent result for +/// \param[out] out The result stream to populate, or NULL if using partitions +/// \param[out] partitions The partitions to populate, or NULL if using out +/// \param[out] rows_affected The number of rows affected if known, else -1. Pass NULL if +/// the client does not want this information. +/// \param[out] error An optional location to return an error message if necessary. +/// +/// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver does not support multi-result set +/// execution, ADBC_STATUS_INVALID_STATE if called at an inappropriate time but the +/// driver does support multi-result set execution, ADBC_STATUS_INVALID_ARGUMENT if both +/// out and partitions are non-NULL, or if the output style is incompatible with the +/// original execution, and ADBC_STATUS_OK (or an appropriate error code) otherwise. +ADBC_EXPORT +AdbcStatusCode AdbcStatementNextResultSet(struct AdbcStatement* statement, + struct ArrowArrayStream* out, + struct AdbcPartitions* partitions, + int64_t* rows_affected, + struct AdbcError* error); + /// \brief Get the schema of the result set of a query without /// executing it. /// From 6abbf868778b8ecf4631fe285855437286708244 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Thu, 8 Jan 2026 14:52:49 -0500 Subject: [PATCH 03/12] fix tests --- c/driver_manager/adbc_version_100_compatibility_test.cc | 4 +++- c/include/arrow-adbc/adbc.h | 9 +++++++++ r/adbcdrivermanager/src/radbc.cc | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/c/driver_manager/adbc_version_100_compatibility_test.cc b/c/driver_manager/adbc_version_100_compatibility_test.cc index 43079ecb3e..9994195ba4 100644 --- a/c/driver_manager/adbc_version_100_compatibility_test.cc +++ b/c/driver_manager/adbc_version_100_compatibility_test.cc @@ -57,9 +57,11 @@ class AdbcVersion : public ::testing::Test { TEST_F(AdbcVersion, StructSize) { ASSERT_EQ(sizeof(AdbcErrorVersion100), ADBC_ERROR_1_0_0_SIZE); ASSERT_EQ(sizeof(AdbcError), ADBC_ERROR_1_1_0_SIZE); + ASSERT_EQ(sizeof(AdbcError), ADBC_ERROR_1_2_0_SIZE); ASSERT_EQ(sizeof(AdbcDriverVersion100), ADBC_DRIVER_1_0_0_SIZE); - ASSERT_EQ(sizeof(AdbcDriver), ADBC_DRIVER_1_1_0_SIZE); + ASSERT_EQ(offsetof(struct AdbcDriver, StatementNextResultSet), ADBC_DRIVER_1_1_0_SIZE); + ASSERT_EQ(sizeof(AdbcDriver), ADBC_DRIVER_1_2_0_SIZE); } // Initialize a version 1.0.0 driver with the version 1.1.0 driver struct. diff --git a/c/include/arrow-adbc/adbc.h b/c/include/arrow-adbc/adbc.h index ce6119b18f..8b78202c46 100644 --- a/c/include/arrow-adbc/adbc.h +++ b/c/include/arrow-adbc/adbc.h @@ -355,6 +355,15 @@ struct ADBC_EXPORT AdbcError { /// \since ADBC API revision 1.1.0 #define ADBC_ERROR_1_1_0_SIZE (sizeof(struct AdbcError)) +/// \brief The size of the AdbcError structure in ADBC 1.2.0. +/// +/// Drivers written for ADBC 1.2.0 and later should never touch more than this +/// portion of an AdbcDriver struct when vendor_code is +/// ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA. +/// +/// \since ADBC API revision 1.2.0 +#define ADBC_ERROR_1_2_0_SIZE (sizeof(struct AdbcError)) + /// \brief Extra key-value metadata for an error. /// /// The fields here are owned by the driver and should not be freed. The diff --git a/r/adbcdrivermanager/src/radbc.cc b/r/adbcdrivermanager/src/radbc.cc index 3010c59643..c5756aeae8 100644 --- a/r/adbcdrivermanager/src/radbc.cc +++ b/r/adbcdrivermanager/src/radbc.cc @@ -105,7 +105,8 @@ extern "C" SEXP RAdbcAllocateDriver(void) { R_RegisterCFinalizer(driver_xptr, &finalize_driver_xptr); // Make sure we error when the ADBC spec is updated - static_assert(sizeof(AdbcDriver) == ADBC_DRIVER_1_1_0_SIZE); + static_assert(offsetof(struct AdbcDriver, StatementNextResultSet) == + ADBC_DRIVER_1_1_0_SIZE); SEXP version_sexp = PROTECT(Rf_ScalarInteger(ADBC_VERSION_1_1_0)); const char* names[] = {"driver", "version", ""}; From 133e89568bf9ab89f691feb7d57a986063e0f74f Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Thu, 8 Jan 2026 14:59:36 -0500 Subject: [PATCH 04/12] pre-commit --- go/adbc/drivermgr/arrow-adbc/adbc.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/go/adbc/drivermgr/arrow-adbc/adbc.h b/go/adbc/drivermgr/arrow-adbc/adbc.h index ce6119b18f..8b78202c46 100644 --- a/go/adbc/drivermgr/arrow-adbc/adbc.h +++ b/go/adbc/drivermgr/arrow-adbc/adbc.h @@ -355,6 +355,15 @@ struct ADBC_EXPORT AdbcError { /// \since ADBC API revision 1.1.0 #define ADBC_ERROR_1_1_0_SIZE (sizeof(struct AdbcError)) +/// \brief The size of the AdbcError structure in ADBC 1.2.0. +/// +/// Drivers written for ADBC 1.2.0 and later should never touch more than this +/// portion of an AdbcDriver struct when vendor_code is +/// ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA. +/// +/// \since ADBC API revision 1.2.0 +#define ADBC_ERROR_1_2_0_SIZE (sizeof(struct AdbcError)) + /// \brief Extra key-value metadata for an error. /// /// The fields here are owned by the driver and should not be freed. The From 52e646ebde490aaff74c31837d51eed8c462d4ef Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Mon, 19 Jan 2026 16:51:29 -0500 Subject: [PATCH 05/12] Update based on comments --- .../adbc_version_100_compatibility_test.cc | 2 +- c/include/arrow-adbc/adbc.h | 172 +++++++++++++----- go/adbc/drivermgr/arrow-adbc/adbc.h | 172 +++++++++++++----- r/adbcdrivermanager/src/radbc.cc | 2 +- 4 files changed, 250 insertions(+), 98 deletions(-) diff --git a/c/driver_manager/adbc_version_100_compatibility_test.cc b/c/driver_manager/adbc_version_100_compatibility_test.cc index 9994195ba4..0b5f05c0d4 100644 --- a/c/driver_manager/adbc_version_100_compatibility_test.cc +++ b/c/driver_manager/adbc_version_100_compatibility_test.cc @@ -60,7 +60,7 @@ TEST_F(AdbcVersion, StructSize) { ASSERT_EQ(sizeof(AdbcError), ADBC_ERROR_1_2_0_SIZE); ASSERT_EQ(sizeof(AdbcDriverVersion100), ADBC_DRIVER_1_0_0_SIZE); - ASSERT_EQ(offsetof(struct AdbcDriver, StatementNextResultSet), ADBC_DRIVER_1_1_0_SIZE); + ASSERT_EQ(offsetof(struct AdbcDriver, StatementExecuteMulti), ADBC_DRIVER_1_1_0_SIZE); ASSERT_EQ(sizeof(AdbcDriver), ADBC_DRIVER_1_2_0_SIZE); } diff --git a/c/include/arrow-adbc/adbc.h b/c/include/arrow-adbc/adbc.h index 8b78202c46..211db4d568 100644 --- a/c/include/arrow-adbc/adbc.h +++ b/c/include/arrow-adbc/adbc.h @@ -991,6 +991,95 @@ struct AdbcPartitions { /// @} +/// \defgroup adbc-statement-multi Multiple Result Set Execution +/// Some databases support executing a statement that returns multiple +/// result sets. This section defines the API for working with such +/// statements and result sets. +/// @{ + +/// \brief A struct for handling a potentially multi-result set execution +/// +/// This struct is populated by AdbcStatementExecuteMulti and can be used to iterate +/// through the result sets of the execution. The caller can use the NextResultSet or +/// NextResultSetPartitions functions on the AdbcResultSet struct to iterate through the +/// result sets. The caller is responsible for calling the release function when finished +/// with the result set. +/// +/// \since ADBC API revision 1.2.0 +struct ADBC_EXPORT AdbcResultSet { + /// \brief opaque implementation-defined state + void* private_data; + + /// \brief Release the result set and any associated resources. + void (*release)(struct AdbcResultSet* result_set); + + /// \brief Get the next result set from a multi-result-set execution. + /// + /// The AdbcResultSet must outlive the returned ArrowArrayStream. + /// + /// The driver can decide whether to allow fetching the next result set + /// as a single stream or as a set of partitions. If the driver does not + /// support fetching the next result set as a stream (indicating it should + /// be fetched as partitions), it should return ADBC_STATUS_NOT_IMPLEMENTED. + /// + /// To indicate that no additional result sets are available, this should return + /// ADBC_STATUS_OK and set the release callback on out to NULL. The expected + /// pattern is that after calling `StatementExecuteMulti`, the caller would + /// then call `NextResultSet` repeatedly until it returns ADBC_STATUS_OK and + /// sets the release callback to NULL, indicating that there are no more result sets. + /// It is not an error to repeatedly call `NextResultSet` after the last result set + /// has been reached; it should simply continue to return ADBC_STATUS_OK with a + /// NULL release callback. + /// + /// \param[in] self The result set struct to fetch the next result from. + /// \param[out] out The result stream to populate + /// \param[out] rows_affected The number of rows affected if known, else - + /// \param[out] error An optional location to return an error message if necessary. + /// + /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results + /// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, + /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. + AdbcStatusCode (*NextResultSet)(struct AdbcResultSet* self, + struct ArrowArrayStream* out, int64_t* rows_affected, + struct AdbcError* error); + + /// \brief Get the next result set from a multi-result-set execution as partitions. + /// + /// The AdbcResultSet must outlive the returned partitions. + /// + /// The driver can decide whether to allow fetching the next result set + /// as a single stream or as a set of partitions. If the driver does not + /// support fetching the next result set as partitions (indicating it should + /// be fetched as a stream), it should return ADBC_STATUS_NOT_IMPLEMENTED. + /// + /// To indicate that no additional result sets are available, this should return + /// ADBC_STATUS_OK and set the release callback on partitions to NULL. The expected + /// pattern is that after calling `StatementExecuteMulti`, the caller would + /// then call `NextResultSetPartitions` repeatedly until it returns ADBC_STATUS_OK and + /// sets the release callback to NULL, indicating that there are no more result sets. + /// It is not an error to repeatedly call `NextResultSetPartitions` after the last + /// result set has been reached; it should simply continue to return ADBC_STATUS_OK with + /// a NULL release callback. + /// + /// \param[in] self The result set struct to fetch the next result from. + /// \param[out] schema The schema of the result set to populate + /// \param[out] partitions The partitions to populate + /// \param[out] rows_affected The number of rows affected if known, else -1. Pass NULL + /// if the client does not want this information. + /// \param[out] error An optional location to return an error message if necessary. + /// + /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results + /// as a stream, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, and + /// ADBC_STATUS_OK (or an appropriate error code) otherwise. + AdbcStatusCode (*NextResultSetPartitions)(struct AdbcResultSet* self, + struct ArrowSchema* schema, + struct AdbcPartitions* partitions, + int64_t* rows_affected, + struct AdbcError* error); +}; + +/// @} + /// \defgroup adbc-driver Driver Initialization /// /// These functions are intended to help support integration between a @@ -1178,10 +1267,8 @@ struct ADBC_EXPORT AdbcDriver { /// /// @{ - AdbcStatusCode (*StatementNextResultSet)(struct AdbcStatement*, - struct ArrowArrayStream*, - struct AdbcPartitions*, int64_t*, - struct AdbcError*); + AdbcStatusCode (*StatementExecuteMulti)(struct AdbcStatement*, struct AdbcResultSet*, + struct AdbcError*); /// @} }; @@ -1200,7 +1287,7 @@ struct ADBC_EXPORT AdbcDriver { /// ADBC_VERSION_1_1_0. /// /// \since ADBC API revision 1.1.0 -#define ADBC_DRIVER_1_1_0_SIZE (offsetof(struct AdbcDriver, StatementNextResultSet)) +#define ADBC_DRIVER_1_1_0_SIZE (offsetof(struct AdbcDriver, StatementExecuteMulti)) /// \brief The size of the AdbcDriver structure in ADBC 1.2.0. /// Drivers written for ADBC 1.2.0 and later should never touch more @@ -2070,56 +2157,45 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, struct ArrowArrayStream* out, int64_t* rows_affected, struct AdbcError* error); -/// \brief Retrieve the next result set from a multi-result-set execution. -/// -/// This AdbcStatement must outlive the returned ArrowArrayStream. +/// \defgroup adbc-statement-multi Multiple Result Set Execution +/// Some databases support executing a statement that returns multiple +/// result sets. This section defines the API for working with such +/// statements and result sets. +/// @{ + +/// \brief Execute a statement that potentially returns multiple result sets /// /// \since ADBC API revision 1.2.0 /// -/// For an execution that returns multiple result sets, this can be called after -/// iterating the first result set to get the next and subsequent result sets. A -/// driver MAY support calling AdbcStatementNextResultSet while the previous result is -/// still being consumed (i.e. before the previous ArrowArrayStream is released), -/// but this is not required. If the driver does not support this, it should return -/// ADBC_STATUS_INVALID_STATE if the previous result set is still active. Otherwise -/// a driver should return ADBC_STATUS_OK to indicate successful execution of this -/// function regardless of whether or not an additional result set is available. -/// -/// If the original execution was via AdbcStatementExecuteSchema, then the -/// ArrowArrayStream populated by this function should only contain the schema of the -/// result set and not any data. -/// -/// Either partitions or out must be NULL to indicate which style of output is desired -/// by the caller. Supplying non-NULL values to both must result in -/// ADBC_STATUS_INVALID_ARGUMENT. If the original execution was via -/// AdbcStatementExecuteQuery and the call to AdbcStatementNextResultSet has a non-NULL -/// partitions, or the original was via AdbcStatementExecutePartitions and this call has a -/// non-NULL out, then the driver may choose to return the data in a different style than -/// the original result set. If it does not (or cannot) then it should return -/// ADBC_STATUS_INVALID_ARGUMENT. -/// -/// The driver indicates that no additional result sets are available by setting the -/// release callback on out (or partitions, whichever was not-NULL) to NULL and returning -/// ADBC_STATUS_OK. -/// -/// \param[in] statement The statement to fetch a subsequent result for -/// \param[out] out The result stream to populate, or NULL if using partitions -/// \param[out] partitions The partitions to populate, or NULL if using out -/// \param[out] rows_affected The number of rows affected if known, else -1. Pass NULL if -/// the client does not want this information. +/// To execute a statement which might potentially return multiple result sets, +/// this can be called in place of AdbcStatementExecuteQuery if the driver supports it. +/// If supported, the driver will populate the AdbcResultSet structure with all +/// necessary information to iterate through the result sets. The caller can then +/// use the NextResultSet or NextResultSetPartitions functions on the AdbcResultSet +/// struct to iterate through the result sets. +/// +/// A driver MAY support executing this function while the previous result set is +/// still being consumed (i.e. before the previous ArrowArrayStream is released), but +/// this is not required. If the driver does not support this, it should return +/// ADBC_STATUS_INVALID_STATE if the previous result set is still active. +/// +/// A driver implementing this function must also implement the AdbcResultSet struct +/// and its associated functions. +/// +/// \param[in] statement The statement to execute. +/// \param[out] results The result set struct to populate with the results of the +/// execution. /// \param[out] error An optional location to return an error message if necessary. /// /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver does not support multi-result set -/// execution, ADBC_STATUS_INVALID_STATE if called at an inappropriate time but the -/// driver does support multi-result set execution, ADBC_STATUS_INVALID_ARGUMENT if both -/// out and partitions are non-NULL, or if the output style is incompatible with the -/// original execution, and ADBC_STATUS_OK (or an appropriate error code) otherwise. +/// execution, +/// and ADBC_STATUS_OK (or an appropriate error code) otherwise. ADBC_EXPORT -AdbcStatusCode AdbcStatementNextResultSet(struct AdbcStatement* statement, - struct ArrowArrayStream* out, - struct AdbcPartitions* partitions, - int64_t* rows_affected, - struct AdbcError* error); +AdbcStatusCode AdbcStatementExecuteMulti(struct AdbcStatement* statement, + struct AdbcResultSet* results, + struct AdbcError* error); + +/// @} /// \brief Get the schema of the result set of a query without /// executing it. diff --git a/go/adbc/drivermgr/arrow-adbc/adbc.h b/go/adbc/drivermgr/arrow-adbc/adbc.h index 8b78202c46..211db4d568 100644 --- a/go/adbc/drivermgr/arrow-adbc/adbc.h +++ b/go/adbc/drivermgr/arrow-adbc/adbc.h @@ -991,6 +991,95 @@ struct AdbcPartitions { /// @} +/// \defgroup adbc-statement-multi Multiple Result Set Execution +/// Some databases support executing a statement that returns multiple +/// result sets. This section defines the API for working with such +/// statements and result sets. +/// @{ + +/// \brief A struct for handling a potentially multi-result set execution +/// +/// This struct is populated by AdbcStatementExecuteMulti and can be used to iterate +/// through the result sets of the execution. The caller can use the NextResultSet or +/// NextResultSetPartitions functions on the AdbcResultSet struct to iterate through the +/// result sets. The caller is responsible for calling the release function when finished +/// with the result set. +/// +/// \since ADBC API revision 1.2.0 +struct ADBC_EXPORT AdbcResultSet { + /// \brief opaque implementation-defined state + void* private_data; + + /// \brief Release the result set and any associated resources. + void (*release)(struct AdbcResultSet* result_set); + + /// \brief Get the next result set from a multi-result-set execution. + /// + /// The AdbcResultSet must outlive the returned ArrowArrayStream. + /// + /// The driver can decide whether to allow fetching the next result set + /// as a single stream or as a set of partitions. If the driver does not + /// support fetching the next result set as a stream (indicating it should + /// be fetched as partitions), it should return ADBC_STATUS_NOT_IMPLEMENTED. + /// + /// To indicate that no additional result sets are available, this should return + /// ADBC_STATUS_OK and set the release callback on out to NULL. The expected + /// pattern is that after calling `StatementExecuteMulti`, the caller would + /// then call `NextResultSet` repeatedly until it returns ADBC_STATUS_OK and + /// sets the release callback to NULL, indicating that there are no more result sets. + /// It is not an error to repeatedly call `NextResultSet` after the last result set + /// has been reached; it should simply continue to return ADBC_STATUS_OK with a + /// NULL release callback. + /// + /// \param[in] self The result set struct to fetch the next result from. + /// \param[out] out The result stream to populate + /// \param[out] rows_affected The number of rows affected if known, else - + /// \param[out] error An optional location to return an error message if necessary. + /// + /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results + /// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, + /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. + AdbcStatusCode (*NextResultSet)(struct AdbcResultSet* self, + struct ArrowArrayStream* out, int64_t* rows_affected, + struct AdbcError* error); + + /// \brief Get the next result set from a multi-result-set execution as partitions. + /// + /// The AdbcResultSet must outlive the returned partitions. + /// + /// The driver can decide whether to allow fetching the next result set + /// as a single stream or as a set of partitions. If the driver does not + /// support fetching the next result set as partitions (indicating it should + /// be fetched as a stream), it should return ADBC_STATUS_NOT_IMPLEMENTED. + /// + /// To indicate that no additional result sets are available, this should return + /// ADBC_STATUS_OK and set the release callback on partitions to NULL. The expected + /// pattern is that after calling `StatementExecuteMulti`, the caller would + /// then call `NextResultSetPartitions` repeatedly until it returns ADBC_STATUS_OK and + /// sets the release callback to NULL, indicating that there are no more result sets. + /// It is not an error to repeatedly call `NextResultSetPartitions` after the last + /// result set has been reached; it should simply continue to return ADBC_STATUS_OK with + /// a NULL release callback. + /// + /// \param[in] self The result set struct to fetch the next result from. + /// \param[out] schema The schema of the result set to populate + /// \param[out] partitions The partitions to populate + /// \param[out] rows_affected The number of rows affected if known, else -1. Pass NULL + /// if the client does not want this information. + /// \param[out] error An optional location to return an error message if necessary. + /// + /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results + /// as a stream, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, and + /// ADBC_STATUS_OK (or an appropriate error code) otherwise. + AdbcStatusCode (*NextResultSetPartitions)(struct AdbcResultSet* self, + struct ArrowSchema* schema, + struct AdbcPartitions* partitions, + int64_t* rows_affected, + struct AdbcError* error); +}; + +/// @} + /// \defgroup adbc-driver Driver Initialization /// /// These functions are intended to help support integration between a @@ -1178,10 +1267,8 @@ struct ADBC_EXPORT AdbcDriver { /// /// @{ - AdbcStatusCode (*StatementNextResultSet)(struct AdbcStatement*, - struct ArrowArrayStream*, - struct AdbcPartitions*, int64_t*, - struct AdbcError*); + AdbcStatusCode (*StatementExecuteMulti)(struct AdbcStatement*, struct AdbcResultSet*, + struct AdbcError*); /// @} }; @@ -1200,7 +1287,7 @@ struct ADBC_EXPORT AdbcDriver { /// ADBC_VERSION_1_1_0. /// /// \since ADBC API revision 1.1.0 -#define ADBC_DRIVER_1_1_0_SIZE (offsetof(struct AdbcDriver, StatementNextResultSet)) +#define ADBC_DRIVER_1_1_0_SIZE (offsetof(struct AdbcDriver, StatementExecuteMulti)) /// \brief The size of the AdbcDriver structure in ADBC 1.2.0. /// Drivers written for ADBC 1.2.0 and later should never touch more @@ -2070,56 +2157,45 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, struct ArrowArrayStream* out, int64_t* rows_affected, struct AdbcError* error); -/// \brief Retrieve the next result set from a multi-result-set execution. -/// -/// This AdbcStatement must outlive the returned ArrowArrayStream. +/// \defgroup adbc-statement-multi Multiple Result Set Execution +/// Some databases support executing a statement that returns multiple +/// result sets. This section defines the API for working with such +/// statements and result sets. +/// @{ + +/// \brief Execute a statement that potentially returns multiple result sets /// /// \since ADBC API revision 1.2.0 /// -/// For an execution that returns multiple result sets, this can be called after -/// iterating the first result set to get the next and subsequent result sets. A -/// driver MAY support calling AdbcStatementNextResultSet while the previous result is -/// still being consumed (i.e. before the previous ArrowArrayStream is released), -/// but this is not required. If the driver does not support this, it should return -/// ADBC_STATUS_INVALID_STATE if the previous result set is still active. Otherwise -/// a driver should return ADBC_STATUS_OK to indicate successful execution of this -/// function regardless of whether or not an additional result set is available. -/// -/// If the original execution was via AdbcStatementExecuteSchema, then the -/// ArrowArrayStream populated by this function should only contain the schema of the -/// result set and not any data. -/// -/// Either partitions or out must be NULL to indicate which style of output is desired -/// by the caller. Supplying non-NULL values to both must result in -/// ADBC_STATUS_INVALID_ARGUMENT. If the original execution was via -/// AdbcStatementExecuteQuery and the call to AdbcStatementNextResultSet has a non-NULL -/// partitions, or the original was via AdbcStatementExecutePartitions and this call has a -/// non-NULL out, then the driver may choose to return the data in a different style than -/// the original result set. If it does not (or cannot) then it should return -/// ADBC_STATUS_INVALID_ARGUMENT. -/// -/// The driver indicates that no additional result sets are available by setting the -/// release callback on out (or partitions, whichever was not-NULL) to NULL and returning -/// ADBC_STATUS_OK. -/// -/// \param[in] statement The statement to fetch a subsequent result for -/// \param[out] out The result stream to populate, or NULL if using partitions -/// \param[out] partitions The partitions to populate, or NULL if using out -/// \param[out] rows_affected The number of rows affected if known, else -1. Pass NULL if -/// the client does not want this information. +/// To execute a statement which might potentially return multiple result sets, +/// this can be called in place of AdbcStatementExecuteQuery if the driver supports it. +/// If supported, the driver will populate the AdbcResultSet structure with all +/// necessary information to iterate through the result sets. The caller can then +/// use the NextResultSet or NextResultSetPartitions functions on the AdbcResultSet +/// struct to iterate through the result sets. +/// +/// A driver MAY support executing this function while the previous result set is +/// still being consumed (i.e. before the previous ArrowArrayStream is released), but +/// this is not required. If the driver does not support this, it should return +/// ADBC_STATUS_INVALID_STATE if the previous result set is still active. +/// +/// A driver implementing this function must also implement the AdbcResultSet struct +/// and its associated functions. +/// +/// \param[in] statement The statement to execute. +/// \param[out] results The result set struct to populate with the results of the +/// execution. /// \param[out] error An optional location to return an error message if necessary. /// /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver does not support multi-result set -/// execution, ADBC_STATUS_INVALID_STATE if called at an inappropriate time but the -/// driver does support multi-result set execution, ADBC_STATUS_INVALID_ARGUMENT if both -/// out and partitions are non-NULL, or if the output style is incompatible with the -/// original execution, and ADBC_STATUS_OK (or an appropriate error code) otherwise. +/// execution, +/// and ADBC_STATUS_OK (or an appropriate error code) otherwise. ADBC_EXPORT -AdbcStatusCode AdbcStatementNextResultSet(struct AdbcStatement* statement, - struct ArrowArrayStream* out, - struct AdbcPartitions* partitions, - int64_t* rows_affected, - struct AdbcError* error); +AdbcStatusCode AdbcStatementExecuteMulti(struct AdbcStatement* statement, + struct AdbcResultSet* results, + struct AdbcError* error); + +/// @} /// \brief Get the schema of the result set of a query without /// executing it. diff --git a/r/adbcdrivermanager/src/radbc.cc b/r/adbcdrivermanager/src/radbc.cc index c5756aeae8..8c70a894d6 100644 --- a/r/adbcdrivermanager/src/radbc.cc +++ b/r/adbcdrivermanager/src/radbc.cc @@ -105,7 +105,7 @@ extern "C" SEXP RAdbcAllocateDriver(void) { R_RegisterCFinalizer(driver_xptr, &finalize_driver_xptr); // Make sure we error when the ADBC spec is updated - static_assert(offsetof(struct AdbcDriver, StatementNextResultSet) == + static_assert(offsetof(struct AdbcDriver, StatementExecuteMulti) == ADBC_DRIVER_1_1_0_SIZE); SEXP version_sexp = PROTECT(Rf_ScalarInteger(ADBC_VERSION_1_1_0)); From d88fccbd9848c53e5586460da94282cdf494afe9 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Tue, 20 Jan 2026 11:48:26 -0500 Subject: [PATCH 06/12] convert to free functions --- c/include/arrow-adbc/adbc.h | 156 ++++++++++++++++------------ go/adbc/drivermgr/arrow-adbc/adbc.h | 156 ++++++++++++++++------------ 2 files changed, 180 insertions(+), 132 deletions(-) diff --git a/c/include/arrow-adbc/adbc.h b/c/include/arrow-adbc/adbc.h index 211db4d568..b0638918ab 100644 --- a/c/include/arrow-adbc/adbc.h +++ b/c/include/arrow-adbc/adbc.h @@ -1010,74 +1010,92 @@ struct ADBC_EXPORT AdbcResultSet { /// \brief opaque implementation-defined state void* private_data; - /// \brief Release the result set and any associated resources. - void (*release)(struct AdbcResultSet* result_set); - - /// \brief Get the next result set from a multi-result-set execution. - /// - /// The AdbcResultSet must outlive the returned ArrowArrayStream. - /// - /// The driver can decide whether to allow fetching the next result set - /// as a single stream or as a set of partitions. If the driver does not - /// support fetching the next result set as a stream (indicating it should - /// be fetched as partitions), it should return ADBC_STATUS_NOT_IMPLEMENTED. - /// - /// To indicate that no additional result sets are available, this should return - /// ADBC_STATUS_OK and set the release callback on out to NULL. The expected - /// pattern is that after calling `StatementExecuteMulti`, the caller would - /// then call `NextResultSet` repeatedly until it returns ADBC_STATUS_OK and - /// sets the release callback to NULL, indicating that there are no more result sets. - /// It is not an error to repeatedly call `NextResultSet` after the last result set - /// has been reached; it should simply continue to return ADBC_STATUS_OK with a - /// NULL release callback. - /// - /// \param[in] self The result set struct to fetch the next result from. - /// \param[out] out The result stream to populate - /// \param[out] rows_affected The number of rows affected if known, else - - /// \param[out] error An optional location to return an error message if necessary. - /// - /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results - /// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, - /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. - AdbcStatusCode (*NextResultSet)(struct AdbcResultSet* self, - struct ArrowArrayStream* out, int64_t* rows_affected, - struct AdbcError* error); - - /// \brief Get the next result set from a multi-result-set execution as partitions. - /// - /// The AdbcResultSet must outlive the returned partitions. - /// - /// The driver can decide whether to allow fetching the next result set - /// as a single stream or as a set of partitions. If the driver does not - /// support fetching the next result set as partitions (indicating it should - /// be fetched as a stream), it should return ADBC_STATUS_NOT_IMPLEMENTED. - /// - /// To indicate that no additional result sets are available, this should return - /// ADBC_STATUS_OK and set the release callback on partitions to NULL. The expected - /// pattern is that after calling `StatementExecuteMulti`, the caller would - /// then call `NextResultSetPartitions` repeatedly until it returns ADBC_STATUS_OK and - /// sets the release callback to NULL, indicating that there are no more result sets. - /// It is not an error to repeatedly call `NextResultSetPartitions` after the last - /// result set has been reached; it should simply continue to return ADBC_STATUS_OK with - /// a NULL release callback. - /// - /// \param[in] self The result set struct to fetch the next result from. - /// \param[out] schema The schema of the result set to populate - /// \param[out] partitions The partitions to populate - /// \param[out] rows_affected The number of rows affected if known, else -1. Pass NULL - /// if the client does not want this information. - /// \param[out] error An optional location to return an error message if necessary. - /// - /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results - /// as a stream, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, and - /// ADBC_STATUS_OK (or an appropriate error code) otherwise. - AdbcStatusCode (*NextResultSetPartitions)(struct AdbcResultSet* self, - struct ArrowSchema* schema, - struct AdbcPartitions* partitions, - int64_t* rows_affected, - struct AdbcError* error); + /// \brief The associated driver + struct AdbcDriver* private_driver; }; +/// \brief Release the AdbcResultSet and any associated resources. +/// +/// \since ADBC API revision 1.2.0 +/// +/// If all the result sets have not been completely consumed, then the driver +/// should cancel any remaining work if this is called. +/// +/// \param[in] result_set The result set to release. +/// \param[out] error An optional location to return an error message if necessary. +/// +/// \return ADBC_STATUS_OK on success or an appropriate error code. +AdbcStatusCode AdbcResultSetRelease(struct AdbcResultSet* result_set, + struct AdbcError* error); + +/// \brief Get the next result set from a multi-result-set execution. +/// +/// \since ADBC API revision 1.2.0 +/// +/// The AdbcResultSet must outlive the returned ArrowArrayStream. +/// +/// The driver can decide whether to allow fetching the next result set +/// as a single stream or as a set of partitions. If the driver does not +/// support fetching the next result set as a stream (indicating it should +/// be fetched as partitions), it should return ADBC_STATUS_NOT_IMPLEMENTED. +/// +/// To indicate that no additional result sets are available, this should return +/// ADBC_STATUS_OK and set the release callback on out to NULL. The expected +/// pattern is that after calling `StatementExecuteMulti`, the caller would +/// then call `NextResultSet` repeatedly until it returns ADBC_STATUS_OK and +/// sets the release callback to NULL, indicating that there are no more result sets. +/// It is not an error to repeatedly call `NextResultSet` after the last result set +/// has been reached; it should simply continue to return ADBC_STATUS_OK with a +/// NULL release callback. +/// +/// \param[in] result_set The result set struct to fetch the next result from. +/// \param[out] out The result stream to populate +/// \param[out] rows_affected The number of rows affected if known, else - +/// \param[out] error An optional location to return an error message if necessary. +/// +/// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results +/// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, +/// and ADBC_STATUS_OK (or an appropriate error code) otherwise. +AdbcStatusCode AdbcNextResultSet(struct AdbcResultSet* result_set, + struct ArrowArrayStream* out, int64_t* rows_affected, + struct AdbcError* error); + +/// \brief Get the next result set from a multi-result-set execution as partitions. +/// +/// \since ADBC API revision 1.2.0 +/// +/// The AdbcResultSet must outlive the returned partitions. +/// +/// The driver can decide whether to allow fetching the next result set +/// as a single stream or as a set of partitions. If the driver does not +/// support fetching the next result set as partitions (indicating it should +/// be fetched as a stream), it should return ADBC_STATUS_NOT_IMPLEMENTED. +/// +/// To indicate that no additional result sets are available, this should return +/// ADBC_STATUS_OK and set the release callback on partitions to NULL. The expected +/// pattern is that after calling `StatementExecuteMulti`, the caller would +/// then call `NextResultSetPartitions` repeatedly until it returns ADBC_STATUS_OK and +/// sets the release callback to NULL, indicating that there are no more result sets. +/// It is not an error to repeatedly call `NextResultSetPartitions` after the last +/// result set has been reached; it should simply continue to return ADBC_STATUS_OK with +/// a NULL release callback. +/// +/// \param[in] result_set The result set struct to fetch the next result from. +/// \param[out] schema The schema of the result set to populate +/// \param[out] partitions The partitions to populate +/// \param[out] rows_affected The number of rows affected if known, else -1. Pass NULL +/// if the client does not want this information. +/// \param[out] error An optional location to return an error message if necessary. +/// +/// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results +/// as a stream, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, and +/// ADBC_STATUS_OK (or an appropriate error code) otherwise. +AdbcStatusCode AdbcNextResultSetPartitions(struct AdbcResultSet* result_set, + struct ArrowSchema* schema, + struct AdbcPartitions* partitions, + int64_t* rows_affected, + struct AdbcError* error); + /// @} /// \defgroup adbc-driver Driver Initialization @@ -1267,6 +1285,12 @@ struct ADBC_EXPORT AdbcDriver { /// /// @{ + AdbcStatusCode (*NextResultSet)(struct AdbcResultSet*, struct ArrowArrayStream*, + int64_t*, struct AdbcError*); + AdbcStatusCode (*NextResultSetPartitions)(struct AdbcResultSet*, struct ArrowSchema*, + struct AdbcPartitions*, int64_t*, + struct AdbcError*); + AdbcStatusCode (*ResultSetRelease)(struct AdbcResultSet*, struct AdbcError*); AdbcStatusCode (*StatementExecuteMulti)(struct AdbcStatement*, struct AdbcResultSet*, struct AdbcError*); diff --git a/go/adbc/drivermgr/arrow-adbc/adbc.h b/go/adbc/drivermgr/arrow-adbc/adbc.h index 211db4d568..b0638918ab 100644 --- a/go/adbc/drivermgr/arrow-adbc/adbc.h +++ b/go/adbc/drivermgr/arrow-adbc/adbc.h @@ -1010,74 +1010,92 @@ struct ADBC_EXPORT AdbcResultSet { /// \brief opaque implementation-defined state void* private_data; - /// \brief Release the result set and any associated resources. - void (*release)(struct AdbcResultSet* result_set); - - /// \brief Get the next result set from a multi-result-set execution. - /// - /// The AdbcResultSet must outlive the returned ArrowArrayStream. - /// - /// The driver can decide whether to allow fetching the next result set - /// as a single stream or as a set of partitions. If the driver does not - /// support fetching the next result set as a stream (indicating it should - /// be fetched as partitions), it should return ADBC_STATUS_NOT_IMPLEMENTED. - /// - /// To indicate that no additional result sets are available, this should return - /// ADBC_STATUS_OK and set the release callback on out to NULL. The expected - /// pattern is that after calling `StatementExecuteMulti`, the caller would - /// then call `NextResultSet` repeatedly until it returns ADBC_STATUS_OK and - /// sets the release callback to NULL, indicating that there are no more result sets. - /// It is not an error to repeatedly call `NextResultSet` after the last result set - /// has been reached; it should simply continue to return ADBC_STATUS_OK with a - /// NULL release callback. - /// - /// \param[in] self The result set struct to fetch the next result from. - /// \param[out] out The result stream to populate - /// \param[out] rows_affected The number of rows affected if known, else - - /// \param[out] error An optional location to return an error message if necessary. - /// - /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results - /// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, - /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. - AdbcStatusCode (*NextResultSet)(struct AdbcResultSet* self, - struct ArrowArrayStream* out, int64_t* rows_affected, - struct AdbcError* error); - - /// \brief Get the next result set from a multi-result-set execution as partitions. - /// - /// The AdbcResultSet must outlive the returned partitions. - /// - /// The driver can decide whether to allow fetching the next result set - /// as a single stream or as a set of partitions. If the driver does not - /// support fetching the next result set as partitions (indicating it should - /// be fetched as a stream), it should return ADBC_STATUS_NOT_IMPLEMENTED. - /// - /// To indicate that no additional result sets are available, this should return - /// ADBC_STATUS_OK and set the release callback on partitions to NULL. The expected - /// pattern is that after calling `StatementExecuteMulti`, the caller would - /// then call `NextResultSetPartitions` repeatedly until it returns ADBC_STATUS_OK and - /// sets the release callback to NULL, indicating that there are no more result sets. - /// It is not an error to repeatedly call `NextResultSetPartitions` after the last - /// result set has been reached; it should simply continue to return ADBC_STATUS_OK with - /// a NULL release callback. - /// - /// \param[in] self The result set struct to fetch the next result from. - /// \param[out] schema The schema of the result set to populate - /// \param[out] partitions The partitions to populate - /// \param[out] rows_affected The number of rows affected if known, else -1. Pass NULL - /// if the client does not want this information. - /// \param[out] error An optional location to return an error message if necessary. - /// - /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results - /// as a stream, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, and - /// ADBC_STATUS_OK (or an appropriate error code) otherwise. - AdbcStatusCode (*NextResultSetPartitions)(struct AdbcResultSet* self, - struct ArrowSchema* schema, - struct AdbcPartitions* partitions, - int64_t* rows_affected, - struct AdbcError* error); + /// \brief The associated driver + struct AdbcDriver* private_driver; }; +/// \brief Release the AdbcResultSet and any associated resources. +/// +/// \since ADBC API revision 1.2.0 +/// +/// If all the result sets have not been completely consumed, then the driver +/// should cancel any remaining work if this is called. +/// +/// \param[in] result_set The result set to release. +/// \param[out] error An optional location to return an error message if necessary. +/// +/// \return ADBC_STATUS_OK on success or an appropriate error code. +AdbcStatusCode AdbcResultSetRelease(struct AdbcResultSet* result_set, + struct AdbcError* error); + +/// \brief Get the next result set from a multi-result-set execution. +/// +/// \since ADBC API revision 1.2.0 +/// +/// The AdbcResultSet must outlive the returned ArrowArrayStream. +/// +/// The driver can decide whether to allow fetching the next result set +/// as a single stream or as a set of partitions. If the driver does not +/// support fetching the next result set as a stream (indicating it should +/// be fetched as partitions), it should return ADBC_STATUS_NOT_IMPLEMENTED. +/// +/// To indicate that no additional result sets are available, this should return +/// ADBC_STATUS_OK and set the release callback on out to NULL. The expected +/// pattern is that after calling `StatementExecuteMulti`, the caller would +/// then call `NextResultSet` repeatedly until it returns ADBC_STATUS_OK and +/// sets the release callback to NULL, indicating that there are no more result sets. +/// It is not an error to repeatedly call `NextResultSet` after the last result set +/// has been reached; it should simply continue to return ADBC_STATUS_OK with a +/// NULL release callback. +/// +/// \param[in] result_set The result set struct to fetch the next result from. +/// \param[out] out The result stream to populate +/// \param[out] rows_affected The number of rows affected if known, else - +/// \param[out] error An optional location to return an error message if necessary. +/// +/// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results +/// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, +/// and ADBC_STATUS_OK (or an appropriate error code) otherwise. +AdbcStatusCode AdbcNextResultSet(struct AdbcResultSet* result_set, + struct ArrowArrayStream* out, int64_t* rows_affected, + struct AdbcError* error); + +/// \brief Get the next result set from a multi-result-set execution as partitions. +/// +/// \since ADBC API revision 1.2.0 +/// +/// The AdbcResultSet must outlive the returned partitions. +/// +/// The driver can decide whether to allow fetching the next result set +/// as a single stream or as a set of partitions. If the driver does not +/// support fetching the next result set as partitions (indicating it should +/// be fetched as a stream), it should return ADBC_STATUS_NOT_IMPLEMENTED. +/// +/// To indicate that no additional result sets are available, this should return +/// ADBC_STATUS_OK and set the release callback on partitions to NULL. The expected +/// pattern is that after calling `StatementExecuteMulti`, the caller would +/// then call `NextResultSetPartitions` repeatedly until it returns ADBC_STATUS_OK and +/// sets the release callback to NULL, indicating that there are no more result sets. +/// It is not an error to repeatedly call `NextResultSetPartitions` after the last +/// result set has been reached; it should simply continue to return ADBC_STATUS_OK with +/// a NULL release callback. +/// +/// \param[in] result_set The result set struct to fetch the next result from. +/// \param[out] schema The schema of the result set to populate +/// \param[out] partitions The partitions to populate +/// \param[out] rows_affected The number of rows affected if known, else -1. Pass NULL +/// if the client does not want this information. +/// \param[out] error An optional location to return an error message if necessary. +/// +/// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results +/// as a stream, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, and +/// ADBC_STATUS_OK (or an appropriate error code) otherwise. +AdbcStatusCode AdbcNextResultSetPartitions(struct AdbcResultSet* result_set, + struct ArrowSchema* schema, + struct AdbcPartitions* partitions, + int64_t* rows_affected, + struct AdbcError* error); + /// @} /// \defgroup adbc-driver Driver Initialization @@ -1267,6 +1285,12 @@ struct ADBC_EXPORT AdbcDriver { /// /// @{ + AdbcStatusCode (*NextResultSet)(struct AdbcResultSet*, struct ArrowArrayStream*, + int64_t*, struct AdbcError*); + AdbcStatusCode (*NextResultSetPartitions)(struct AdbcResultSet*, struct ArrowSchema*, + struct AdbcPartitions*, int64_t*, + struct AdbcError*); + AdbcStatusCode (*ResultSetRelease)(struct AdbcResultSet*, struct AdbcError*); AdbcStatusCode (*StatementExecuteMulti)(struct AdbcStatement*, struct AdbcResultSet*, struct AdbcError*); From 81d6a2bafcc12d0b22f541d50f48668c18638c87 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Mon, 26 Jan 2026 15:00:11 -0500 Subject: [PATCH 07/12] updates based on commments --- c/include/arrow-adbc/adbc.h | 44 ++++++++++++++--------------- go/adbc/drivermgr/arrow-adbc/adbc.h | 42 +++++++++++++-------------- 2 files changed, 42 insertions(+), 44 deletions(-) diff --git a/c/include/arrow-adbc/adbc.h b/c/include/arrow-adbc/adbc.h index b0638918ab..8c38a7974e 100644 --- a/c/include/arrow-adbc/adbc.h +++ b/c/include/arrow-adbc/adbc.h @@ -1001,12 +1001,12 @@ struct AdbcPartitions { /// /// This struct is populated by AdbcStatementExecuteMulti and can be used to iterate /// through the result sets of the execution. The caller can use the NextResultSet or -/// NextResultSetPartitions functions on the AdbcResultSet struct to iterate through the -/// result sets. The caller is responsible for calling the release function when finished -/// with the result set. +/// NextResultSetPartitions functions on the AdbcMultiResultSet struct to iterate through +/// the result sets. The caller is responsible for calling the release function when +/// finished with the result set. /// /// \since ADBC API revision 1.2.0 -struct ADBC_EXPORT AdbcResultSet { +struct ADBC_EXPORT AdbcMultiResultSet { /// \brief opaque implementation-defined state void* private_data; @@ -1014,7 +1014,7 @@ struct ADBC_EXPORT AdbcResultSet { struct AdbcDriver* private_driver; }; -/// \brief Release the AdbcResultSet and any associated resources. +/// \brief Release the AdbcMultiResultSet and any associated resources. /// /// \since ADBC API revision 1.2.0 /// @@ -1025,15 +1025,13 @@ struct ADBC_EXPORT AdbcResultSet { /// \param[out] error An optional location to return an error message if necessary. /// /// \return ADBC_STATUS_OK on success or an appropriate error code. -AdbcStatusCode AdbcResultSetRelease(struct AdbcResultSet* result_set, +AdbcStatusCode AdbcResultSetRelease(struct AdbcMultiResultSet* result_set, struct AdbcError* error); -/// \brief Get the next result set from a multi-result-set execution. +/// \brief Get the next ArrowArrayStream from an AdbcMultiResultSet. /// /// \since ADBC API revision 1.2.0 /// -/// The AdbcResultSet must outlive the returned ArrowArrayStream. -/// /// The driver can decide whether to allow fetching the next result set /// as a single stream or as a set of partitions. If the driver does not /// support fetching the next result set as a stream (indicating it should @@ -1056,7 +1054,7 @@ AdbcStatusCode AdbcResultSetRelease(struct AdbcResultSet* result_set, /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results /// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. -AdbcStatusCode AdbcNextResultSet(struct AdbcResultSet* result_set, +AdbcStatusCode AdbcNextResultSet(struct AdbcMultiResultSet* result_set, struct ArrowArrayStream* out, int64_t* rows_affected, struct AdbcError* error); @@ -1064,7 +1062,7 @@ AdbcStatusCode AdbcNextResultSet(struct AdbcResultSet* result_set, /// /// \since ADBC API revision 1.2.0 /// -/// The AdbcResultSet must outlive the returned partitions. +/// The AdbcMultiResultSet must outlive the returned partitions. /// /// The driver can decide whether to allow fetching the next result set /// as a single stream or as a set of partitions. If the driver does not @@ -1090,7 +1088,7 @@ AdbcStatusCode AdbcNextResultSet(struct AdbcResultSet* result_set, /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results /// as a stream, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, and /// ADBC_STATUS_OK (or an appropriate error code) otherwise. -AdbcStatusCode AdbcNextResultSetPartitions(struct AdbcResultSet* result_set, +AdbcStatusCode AdbcNextResultSetPartitions(struct AdbcMultiResultSet* result_set, struct ArrowSchema* schema, struct AdbcPartitions* partitions, int64_t* rows_affected, @@ -1285,14 +1283,14 @@ struct ADBC_EXPORT AdbcDriver { /// /// @{ - AdbcStatusCode (*NextResultSet)(struct AdbcResultSet*, struct ArrowArrayStream*, + AdbcStatusCode (*NextResultSet)(struct AdbcMultiResultSet*, struct ArrowArrayStream*, int64_t*, struct AdbcError*); - AdbcStatusCode (*NextResultSetPartitions)(struct AdbcResultSet*, struct ArrowSchema*, - struct AdbcPartitions*, int64_t*, - struct AdbcError*); - AdbcStatusCode (*ResultSetRelease)(struct AdbcResultSet*, struct AdbcError*); - AdbcStatusCode (*StatementExecuteMulti)(struct AdbcStatement*, struct AdbcResultSet*, - struct AdbcError*); + AdbcStatusCode (*NextResultSetPartitions)(struct AdbcMultiResultSet*, + struct ArrowSchema*, struct AdbcPartitions*, + int64_t*, struct AdbcError*); + AdbcStatusCode (*ResultSetRelease)(struct AdbcMultiResultSet*, struct AdbcError*); + AdbcStatusCode (*StatementExecuteMulti)(struct AdbcStatement*, + struct AdbcMultiResultSet*, struct AdbcError*); /// @} }; @@ -2193,9 +2191,9 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// /// To execute a statement which might potentially return multiple result sets, /// this can be called in place of AdbcStatementExecuteQuery if the driver supports it. -/// If supported, the driver will populate the AdbcResultSet structure with all +/// If supported, the driver will populate the AdbcMultiResultSet structure with all /// necessary information to iterate through the result sets. The caller can then -/// use the NextResultSet or NextResultSetPartitions functions on the AdbcResultSet +/// use the NextResultSet or NextResultSetPartitions functions on the AdbcMultiResultSet /// struct to iterate through the result sets. /// /// A driver MAY support executing this function while the previous result set is @@ -2203,7 +2201,7 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// this is not required. If the driver does not support this, it should return /// ADBC_STATUS_INVALID_STATE if the previous result set is still active. /// -/// A driver implementing this function must also implement the AdbcResultSet struct +/// A driver implementing this function must also implement the AdbcMultiResultSet struct /// and its associated functions. /// /// \param[in] statement The statement to execute. @@ -2216,7 +2214,7 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. ADBC_EXPORT AdbcStatusCode AdbcStatementExecuteMulti(struct AdbcStatement* statement, - struct AdbcResultSet* results, + struct AdbcMultiResultSet* results, struct AdbcError* error); /// @} diff --git a/go/adbc/drivermgr/arrow-adbc/adbc.h b/go/adbc/drivermgr/arrow-adbc/adbc.h index b0638918ab..927ce3ebe3 100644 --- a/go/adbc/drivermgr/arrow-adbc/adbc.h +++ b/go/adbc/drivermgr/arrow-adbc/adbc.h @@ -1001,12 +1001,12 @@ struct AdbcPartitions { /// /// This struct is populated by AdbcStatementExecuteMulti and can be used to iterate /// through the result sets of the execution. The caller can use the NextResultSet or -/// NextResultSetPartitions functions on the AdbcResultSet struct to iterate through the -/// result sets. The caller is responsible for calling the release function when finished -/// with the result set. +/// NextResultSetPartitions functions on the AdbcMultiResultSet struct to iterate through +/// the result sets. The caller is responsible for calling the release function when +/// finished with the result set. /// /// \since ADBC API revision 1.2.0 -struct ADBC_EXPORT AdbcResultSet { +struct ADBC_EXPORT AdbcMultiResultSet { /// \brief opaque implementation-defined state void* private_data; @@ -1014,7 +1014,7 @@ struct ADBC_EXPORT AdbcResultSet { struct AdbcDriver* private_driver; }; -/// \brief Release the AdbcResultSet and any associated resources. +/// \brief Release the AdbcMultiResultSet and any associated resources. /// /// \since ADBC API revision 1.2.0 /// @@ -1025,14 +1025,14 @@ struct ADBC_EXPORT AdbcResultSet { /// \param[out] error An optional location to return an error message if necessary. /// /// \return ADBC_STATUS_OK on success or an appropriate error code. -AdbcStatusCode AdbcResultSetRelease(struct AdbcResultSet* result_set, +AdbcStatusCode AdbcResultSetRelease(struct AdbcMultiResultSet* result_set, struct AdbcError* error); /// \brief Get the next result set from a multi-result-set execution. /// /// \since ADBC API revision 1.2.0 /// -/// The AdbcResultSet must outlive the returned ArrowArrayStream. +/// The AdbcMultiResultSet must outlive the returned ArrowArrayStream. /// /// The driver can decide whether to allow fetching the next result set /// as a single stream or as a set of partitions. If the driver does not @@ -1056,7 +1056,7 @@ AdbcStatusCode AdbcResultSetRelease(struct AdbcResultSet* result_set, /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results /// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. -AdbcStatusCode AdbcNextResultSet(struct AdbcResultSet* result_set, +AdbcStatusCode AdbcNextResultSet(struct AdbcMultiResultSet* result_set, struct ArrowArrayStream* out, int64_t* rows_affected, struct AdbcError* error); @@ -1064,7 +1064,7 @@ AdbcStatusCode AdbcNextResultSet(struct AdbcResultSet* result_set, /// /// \since ADBC API revision 1.2.0 /// -/// The AdbcResultSet must outlive the returned partitions. +/// The AdbcMultiResultSet must outlive the returned partitions. /// /// The driver can decide whether to allow fetching the next result set /// as a single stream or as a set of partitions. If the driver does not @@ -1090,7 +1090,7 @@ AdbcStatusCode AdbcNextResultSet(struct AdbcResultSet* result_set, /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results /// as a stream, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, and /// ADBC_STATUS_OK (or an appropriate error code) otherwise. -AdbcStatusCode AdbcNextResultSetPartitions(struct AdbcResultSet* result_set, +AdbcStatusCode AdbcNextResultSetPartitions(struct AdbcMultiResultSet* result_set, struct ArrowSchema* schema, struct AdbcPartitions* partitions, int64_t* rows_affected, @@ -1285,14 +1285,14 @@ struct ADBC_EXPORT AdbcDriver { /// /// @{ - AdbcStatusCode (*NextResultSet)(struct AdbcResultSet*, struct ArrowArrayStream*, + AdbcStatusCode (*NextResultSet)(struct AdbcMultiResultSet*, struct ArrowArrayStream*, int64_t*, struct AdbcError*); - AdbcStatusCode (*NextResultSetPartitions)(struct AdbcResultSet*, struct ArrowSchema*, - struct AdbcPartitions*, int64_t*, - struct AdbcError*); - AdbcStatusCode (*ResultSetRelease)(struct AdbcResultSet*, struct AdbcError*); - AdbcStatusCode (*StatementExecuteMulti)(struct AdbcStatement*, struct AdbcResultSet*, - struct AdbcError*); + AdbcStatusCode (*NextResultSetPartitions)(struct AdbcMultiResultSet*, + struct ArrowSchema*, struct AdbcPartitions*, + int64_t*, struct AdbcError*); + AdbcStatusCode (*ResultSetRelease)(struct AdbcMultiResultSet*, struct AdbcError*); + AdbcStatusCode (*StatementExecuteMulti)(struct AdbcStatement*, + struct AdbcMultiResultSet*, struct AdbcError*); /// @} }; @@ -2193,9 +2193,9 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// /// To execute a statement which might potentially return multiple result sets, /// this can be called in place of AdbcStatementExecuteQuery if the driver supports it. -/// If supported, the driver will populate the AdbcResultSet structure with all +/// If supported, the driver will populate the AdbcMultiResultSet structure with all /// necessary information to iterate through the result sets. The caller can then -/// use the NextResultSet or NextResultSetPartitions functions on the AdbcResultSet +/// use the NextResultSet or NextResultSetPartitions functions on the AdbcMultiResultSet /// struct to iterate through the result sets. /// /// A driver MAY support executing this function while the previous result set is @@ -2203,7 +2203,7 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// this is not required. If the driver does not support this, it should return /// ADBC_STATUS_INVALID_STATE if the previous result set is still active. /// -/// A driver implementing this function must also implement the AdbcResultSet struct +/// A driver implementing this function must also implement the AdbcMultiResultSet struct /// and its associated functions. /// /// \param[in] statement The statement to execute. @@ -2216,7 +2216,7 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. ADBC_EXPORT AdbcStatusCode AdbcStatementExecuteMulti(struct AdbcStatement* statement, - struct AdbcResultSet* results, + struct AdbcMultiResultSet* results, struct AdbcError* error); /// @} From ec8a174623829c54ba5fe9be5a2d54099088cf51 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Mon, 26 Jan 2026 15:00:46 -0500 Subject: [PATCH 08/12] pre-commit --- go/adbc/drivermgr/arrow-adbc/adbc.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/go/adbc/drivermgr/arrow-adbc/adbc.h b/go/adbc/drivermgr/arrow-adbc/adbc.h index 927ce3ebe3..8c38a7974e 100644 --- a/go/adbc/drivermgr/arrow-adbc/adbc.h +++ b/go/adbc/drivermgr/arrow-adbc/adbc.h @@ -1028,12 +1028,10 @@ struct ADBC_EXPORT AdbcMultiResultSet { AdbcStatusCode AdbcResultSetRelease(struct AdbcMultiResultSet* result_set, struct AdbcError* error); -/// \brief Get the next result set from a multi-result-set execution. +/// \brief Get the next ArrowArrayStream from an AdbcMultiResultSet. /// /// \since ADBC API revision 1.2.0 /// -/// The AdbcMultiResultSet must outlive the returned ArrowArrayStream. -/// /// The driver can decide whether to allow fetching the next result set /// as a single stream or as a set of partitions. If the driver does not /// support fetching the next result set as a stream (indicating it should From e8173f35c187016663573706f9222e9d761c7fcd Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Tue, 10 Feb 2026 11:55:21 -0500 Subject: [PATCH 09/12] add ExecuteSchemaMulti --- c/include/arrow-adbc/adbc.h | 86 +++++++++++++++++++---------- go/adbc/drivermgr/arrow-adbc/adbc.h | 86 +++++++++++++++++++---------- 2 files changed, 116 insertions(+), 56 deletions(-) diff --git a/c/include/arrow-adbc/adbc.h b/c/include/arrow-adbc/adbc.h index 8c38a7974e..80ee097b5c 100644 --- a/c/include/arrow-adbc/adbc.h +++ b/c/include/arrow-adbc/adbc.h @@ -1000,10 +1000,10 @@ struct AdbcPartitions { /// \brief A struct for handling a potentially multi-result set execution /// /// This struct is populated by AdbcStatementExecuteMulti and can be used to iterate -/// through the result sets of the execution. The caller can use the NextResultSet or -/// NextResultSetPartitions functions on the AdbcMultiResultSet struct to iterate through -/// the result sets. The caller is responsible for calling the release function when -/// finished with the result set. +/// through the result sets of the execution. The caller can use the MultiResultSetNext +/// or MultiResultSetNextPartitions functions on the AdbcMultiResultSet struct to iterate +/// through the result sets. The caller is responsible for calling the release function +/// when finished with the result set. /// /// \since ADBC API revision 1.2.0 struct ADBC_EXPORT AdbcMultiResultSet { @@ -1025,8 +1025,8 @@ struct ADBC_EXPORT AdbcMultiResultSet { /// \param[out] error An optional location to return an error message if necessary. /// /// \return ADBC_STATUS_OK on success or an appropriate error code. -AdbcStatusCode AdbcResultSetRelease(struct AdbcMultiResultSet* result_set, - struct AdbcError* error); +AdbcStatusCode AdbcMultiResultSetRelease(struct AdbcMultiResultSet* result_set, + struct AdbcError* error); /// \brief Get the next ArrowArrayStream from an AdbcMultiResultSet. /// @@ -1040,9 +1040,9 @@ AdbcStatusCode AdbcResultSetRelease(struct AdbcMultiResultSet* result_set, /// To indicate that no additional result sets are available, this should return /// ADBC_STATUS_OK and set the release callback on out to NULL. The expected /// pattern is that after calling `StatementExecuteMulti`, the caller would -/// then call `NextResultSet` repeatedly until it returns ADBC_STATUS_OK and +/// then call `MultiResultSetNext` repeatedly until it returns ADBC_STATUS_OK and /// sets the release callback to NULL, indicating that there are no more result sets. -/// It is not an error to repeatedly call `NextResultSet` after the last result set +/// It is not an error to repeatedly call `MultiResultSetNext` after the last result set /// has been reached; it should simply continue to return ADBC_STATUS_OK with a /// NULL release callback. /// @@ -1054,9 +1054,9 @@ AdbcStatusCode AdbcResultSetRelease(struct AdbcMultiResultSet* result_set, /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results /// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. -AdbcStatusCode AdbcNextResultSet(struct AdbcMultiResultSet* result_set, - struct ArrowArrayStream* out, int64_t* rows_affected, - struct AdbcError* error); +AdbcStatusCode AdbcMultiResultSetNext(struct AdbcMultiResultSet* result_set, + struct ArrowArrayStream* out, + int64_t* rows_affected, struct AdbcError* error); /// \brief Get the next result set from a multi-result-set execution as partitions. /// @@ -1072,9 +1072,9 @@ AdbcStatusCode AdbcNextResultSet(struct AdbcMultiResultSet* result_set, /// To indicate that no additional result sets are available, this should return /// ADBC_STATUS_OK and set the release callback on partitions to NULL. The expected /// pattern is that after calling `StatementExecuteMulti`, the caller would -/// then call `NextResultSetPartitions` repeatedly until it returns ADBC_STATUS_OK and -/// sets the release callback to NULL, indicating that there are no more result sets. -/// It is not an error to repeatedly call `NextResultSetPartitions` after the last +/// then call `MultiResultSetNextPartitions` repeatedly until it returns ADBC_STATUS_OK +/// and sets the release callback to NULL, indicating that there are no more result sets. +/// It is not an error to repeatedly call `MultiResultSetNextPartitions` after the last /// result set has been reached; it should simply continue to return ADBC_STATUS_OK with /// a NULL release callback. /// @@ -1088,12 +1088,11 @@ AdbcStatusCode AdbcNextResultSet(struct AdbcMultiResultSet* result_set, /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results /// as a stream, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, and /// ADBC_STATUS_OK (or an appropriate error code) otherwise. -AdbcStatusCode AdbcNextResultSetPartitions(struct AdbcMultiResultSet* result_set, - struct ArrowSchema* schema, - struct AdbcPartitions* partitions, - int64_t* rows_affected, - struct AdbcError* error); - +AdbcStatusCode AdbcMultiResultSetNextPartitions(struct AdbcMultiResultSet* result_set, + struct ArrowSchema* schema, + struct AdbcPartitions* partitions, + int64_t* rows_affected, + struct AdbcError* error); /// @} /// \defgroup adbc-driver Driver Initialization @@ -1283,12 +1282,17 @@ struct ADBC_EXPORT AdbcDriver { /// /// @{ - AdbcStatusCode (*NextResultSet)(struct AdbcMultiResultSet*, struct ArrowArrayStream*, - int64_t*, struct AdbcError*); - AdbcStatusCode (*NextResultSetPartitions)(struct AdbcMultiResultSet*, - struct ArrowSchema*, struct AdbcPartitions*, - int64_t*, struct AdbcError*); - AdbcStatusCode (*ResultSetRelease)(struct AdbcMultiResultSet*, struct AdbcError*); + AdbcStatusCode (*MultiResultSetNext)(struct AdbcMultiResultSet*, + struct ArrowArrayStream*, int64_t*, + struct AdbcError*); + AdbcStatusCode (*MultiResultSetNextPartitions)(struct AdbcMultiResultSet*, + struct ArrowSchema*, + struct AdbcPartitions*, int64_t*, + struct AdbcError*); + AdbcStatusCode (*MultiResultSetRelease)(struct AdbcMultiResultSet*, struct AdbcError*); + AdbcStatusCode (*StatementExecuteSchemaMulti)(struct AdbcStatement*, + struct AdbcMultiResultSet*, + struct AdbcError*); AdbcStatusCode (*StatementExecuteMulti)(struct AdbcStatement*, struct AdbcMultiResultSet*, struct AdbcError*); @@ -2185,6 +2189,32 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// statements and result sets. /// @{ +/// \brief Retrieve schema for statement that potentially returns multiple result sets +/// +/// \since ADBC API revision 1.2.0 +/// +/// This can be used to retrieve the schemas of all result sets without +/// executing the statement. If the driver does not support this, it should return +/// ADBC_STATUS_NOT_IMPLEMENTED. +/// +/// The ArrowArrayStream objects populated by calls to `MultiResultSetNext` with the +/// results struct returned by this function should have a valid schema but no data (i.e. +/// `get_next` should return EOS immediately). This allows clients to inspect the schemas +/// of all result sets before consuming any data, which can be useful for certain +/// applications such as query planning or UI display of results. +/// +/// \param[in] statement The statement to execute. +/// \param[out] results The result set struct to populate with the schemas of the result +/// sets. +/// \param[out] error An optional location to return an error message if necessary. +/// +/// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver does not support this, +/// and ADBC_STATUS_OK (or an appropriate error code) otherwise. +ADBC_EXPORT +AdbcStatusCode AdbcStatementExecuteMulti(struct AdbcStatement* statement, + struct AdbcMultiResultSet* results, + struct AdbcError* error); + /// \brief Execute a statement that potentially returns multiple result sets /// /// \since ADBC API revision 1.2.0 @@ -2193,8 +2223,8 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// this can be called in place of AdbcStatementExecuteQuery if the driver supports it. /// If supported, the driver will populate the AdbcMultiResultSet structure with all /// necessary information to iterate through the result sets. The caller can then -/// use the NextResultSet or NextResultSetPartitions functions on the AdbcMultiResultSet -/// struct to iterate through the result sets. +/// use the MultiResultSetNext or MultiResultSetNextPartitions functions on the +/// AdbcMultiResultSet struct to iterate through the result sets. /// /// A driver MAY support executing this function while the previous result set is /// still being consumed (i.e. before the previous ArrowArrayStream is released), but diff --git a/go/adbc/drivermgr/arrow-adbc/adbc.h b/go/adbc/drivermgr/arrow-adbc/adbc.h index 8c38a7974e..80ee097b5c 100644 --- a/go/adbc/drivermgr/arrow-adbc/adbc.h +++ b/go/adbc/drivermgr/arrow-adbc/adbc.h @@ -1000,10 +1000,10 @@ struct AdbcPartitions { /// \brief A struct for handling a potentially multi-result set execution /// /// This struct is populated by AdbcStatementExecuteMulti and can be used to iterate -/// through the result sets of the execution. The caller can use the NextResultSet or -/// NextResultSetPartitions functions on the AdbcMultiResultSet struct to iterate through -/// the result sets. The caller is responsible for calling the release function when -/// finished with the result set. +/// through the result sets of the execution. The caller can use the MultiResultSetNext +/// or MultiResultSetNextPartitions functions on the AdbcMultiResultSet struct to iterate +/// through the result sets. The caller is responsible for calling the release function +/// when finished with the result set. /// /// \since ADBC API revision 1.2.0 struct ADBC_EXPORT AdbcMultiResultSet { @@ -1025,8 +1025,8 @@ struct ADBC_EXPORT AdbcMultiResultSet { /// \param[out] error An optional location to return an error message if necessary. /// /// \return ADBC_STATUS_OK on success or an appropriate error code. -AdbcStatusCode AdbcResultSetRelease(struct AdbcMultiResultSet* result_set, - struct AdbcError* error); +AdbcStatusCode AdbcMultiResultSetRelease(struct AdbcMultiResultSet* result_set, + struct AdbcError* error); /// \brief Get the next ArrowArrayStream from an AdbcMultiResultSet. /// @@ -1040,9 +1040,9 @@ AdbcStatusCode AdbcResultSetRelease(struct AdbcMultiResultSet* result_set, /// To indicate that no additional result sets are available, this should return /// ADBC_STATUS_OK and set the release callback on out to NULL. The expected /// pattern is that after calling `StatementExecuteMulti`, the caller would -/// then call `NextResultSet` repeatedly until it returns ADBC_STATUS_OK and +/// then call `MultiResultSetNext` repeatedly until it returns ADBC_STATUS_OK and /// sets the release callback to NULL, indicating that there are no more result sets. -/// It is not an error to repeatedly call `NextResultSet` after the last result set +/// It is not an error to repeatedly call `MultiResultSetNext` after the last result set /// has been reached; it should simply continue to return ADBC_STATUS_OK with a /// NULL release callback. /// @@ -1054,9 +1054,9 @@ AdbcStatusCode AdbcResultSetRelease(struct AdbcMultiResultSet* result_set, /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results /// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. -AdbcStatusCode AdbcNextResultSet(struct AdbcMultiResultSet* result_set, - struct ArrowArrayStream* out, int64_t* rows_affected, - struct AdbcError* error); +AdbcStatusCode AdbcMultiResultSetNext(struct AdbcMultiResultSet* result_set, + struct ArrowArrayStream* out, + int64_t* rows_affected, struct AdbcError* error); /// \brief Get the next result set from a multi-result-set execution as partitions. /// @@ -1072,9 +1072,9 @@ AdbcStatusCode AdbcNextResultSet(struct AdbcMultiResultSet* result_set, /// To indicate that no additional result sets are available, this should return /// ADBC_STATUS_OK and set the release callback on partitions to NULL. The expected /// pattern is that after calling `StatementExecuteMulti`, the caller would -/// then call `NextResultSetPartitions` repeatedly until it returns ADBC_STATUS_OK and -/// sets the release callback to NULL, indicating that there are no more result sets. -/// It is not an error to repeatedly call `NextResultSetPartitions` after the last +/// then call `MultiResultSetNextPartitions` repeatedly until it returns ADBC_STATUS_OK +/// and sets the release callback to NULL, indicating that there are no more result sets. +/// It is not an error to repeatedly call `MultiResultSetNextPartitions` after the last /// result set has been reached; it should simply continue to return ADBC_STATUS_OK with /// a NULL release callback. /// @@ -1088,12 +1088,11 @@ AdbcStatusCode AdbcNextResultSet(struct AdbcMultiResultSet* result_set, /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results /// as a stream, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, and /// ADBC_STATUS_OK (or an appropriate error code) otherwise. -AdbcStatusCode AdbcNextResultSetPartitions(struct AdbcMultiResultSet* result_set, - struct ArrowSchema* schema, - struct AdbcPartitions* partitions, - int64_t* rows_affected, - struct AdbcError* error); - +AdbcStatusCode AdbcMultiResultSetNextPartitions(struct AdbcMultiResultSet* result_set, + struct ArrowSchema* schema, + struct AdbcPartitions* partitions, + int64_t* rows_affected, + struct AdbcError* error); /// @} /// \defgroup adbc-driver Driver Initialization @@ -1283,12 +1282,17 @@ struct ADBC_EXPORT AdbcDriver { /// /// @{ - AdbcStatusCode (*NextResultSet)(struct AdbcMultiResultSet*, struct ArrowArrayStream*, - int64_t*, struct AdbcError*); - AdbcStatusCode (*NextResultSetPartitions)(struct AdbcMultiResultSet*, - struct ArrowSchema*, struct AdbcPartitions*, - int64_t*, struct AdbcError*); - AdbcStatusCode (*ResultSetRelease)(struct AdbcMultiResultSet*, struct AdbcError*); + AdbcStatusCode (*MultiResultSetNext)(struct AdbcMultiResultSet*, + struct ArrowArrayStream*, int64_t*, + struct AdbcError*); + AdbcStatusCode (*MultiResultSetNextPartitions)(struct AdbcMultiResultSet*, + struct ArrowSchema*, + struct AdbcPartitions*, int64_t*, + struct AdbcError*); + AdbcStatusCode (*MultiResultSetRelease)(struct AdbcMultiResultSet*, struct AdbcError*); + AdbcStatusCode (*StatementExecuteSchemaMulti)(struct AdbcStatement*, + struct AdbcMultiResultSet*, + struct AdbcError*); AdbcStatusCode (*StatementExecuteMulti)(struct AdbcStatement*, struct AdbcMultiResultSet*, struct AdbcError*); @@ -2185,6 +2189,32 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// statements and result sets. /// @{ +/// \brief Retrieve schema for statement that potentially returns multiple result sets +/// +/// \since ADBC API revision 1.2.0 +/// +/// This can be used to retrieve the schemas of all result sets without +/// executing the statement. If the driver does not support this, it should return +/// ADBC_STATUS_NOT_IMPLEMENTED. +/// +/// The ArrowArrayStream objects populated by calls to `MultiResultSetNext` with the +/// results struct returned by this function should have a valid schema but no data (i.e. +/// `get_next` should return EOS immediately). This allows clients to inspect the schemas +/// of all result sets before consuming any data, which can be useful for certain +/// applications such as query planning or UI display of results. +/// +/// \param[in] statement The statement to execute. +/// \param[out] results The result set struct to populate with the schemas of the result +/// sets. +/// \param[out] error An optional location to return an error message if necessary. +/// +/// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver does not support this, +/// and ADBC_STATUS_OK (or an appropriate error code) otherwise. +ADBC_EXPORT +AdbcStatusCode AdbcStatementExecuteMulti(struct AdbcStatement* statement, + struct AdbcMultiResultSet* results, + struct AdbcError* error); + /// \brief Execute a statement that potentially returns multiple result sets /// /// \since ADBC API revision 1.2.0 @@ -2193,8 +2223,8 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// this can be called in place of AdbcStatementExecuteQuery if the driver supports it. /// If supported, the driver will populate the AdbcMultiResultSet structure with all /// necessary information to iterate through the result sets. The caller can then -/// use the NextResultSet or NextResultSetPartitions functions on the AdbcMultiResultSet -/// struct to iterate through the result sets. +/// use the MultiResultSetNext or MultiResultSetNextPartitions functions on the +/// AdbcMultiResultSet struct to iterate through the result sets. /// /// A driver MAY support executing this function while the previous result set is /// still being consumed (i.e. before the previous ArrowArrayStream is released), but From 0141a8f36c4b3023ea15cbc1a655dcbfff28fc92 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Wed, 11 Feb 2026 20:09:43 -0500 Subject: [PATCH 10/12] Update header docs based on comments --- c/include/arrow-adbc/adbc.h | 28 ++++++++-------------------- go/adbc/drivermgr/arrow-adbc/adbc.h | 28 ++++++++-------------------- 2 files changed, 16 insertions(+), 40 deletions(-) diff --git a/c/include/arrow-adbc/adbc.h b/c/include/arrow-adbc/adbc.h index 80ee097b5c..83f4ec13c5 100644 --- a/c/include/arrow-adbc/adbc.h +++ b/c/include/arrow-adbc/adbc.h @@ -1052,8 +1052,7 @@ AdbcStatusCode AdbcMultiResultSetRelease(struct AdbcMultiResultSet* result_set, /// \param[out] error An optional location to return an error message if necessary. /// /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results -/// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, -/// and ADBC_STATUS_OK (or an appropriate error code) otherwise. +/// as partitions or ADBC_STATUS_OK (or an appropriate error code) otherwise. AdbcStatusCode AdbcMultiResultSetNext(struct AdbcMultiResultSet* result_set, struct ArrowArrayStream* out, int64_t* rows_affected, struct AdbcError* error); @@ -1062,8 +1061,6 @@ AdbcStatusCode AdbcMultiResultSetNext(struct AdbcMultiResultSet* result_set, /// /// \since ADBC API revision 1.2.0 /// -/// The AdbcMultiResultSet must outlive the returned partitions. -/// /// The driver can decide whether to allow fetching the next result set /// as a single stream or as a set of partitions. If the driver does not /// support fetching the next result set as partitions (indicating it should @@ -1266,19 +1263,10 @@ struct ADBC_EXPORT AdbcDriver { /// the AdbcDriverInitFunc is greater than or equal to /// ADBC_VERSION_1_2_0. /// - /// When a driver implementing an older spec is loaded by a newer - /// driver manager, the newer manager will allocate the new, expanded - /// AdbcDriver struct and attempt to have the driver initialize it with - /// the newer version. This must return an error, after which the driver - /// will try again with successively older versions all the way back to - /// ADBC_VERSION_1_0_0. The driver must not access the new fields, - /// which will carry undefined values. - /// - /// When a driver implementing a newer spec is loaded by an older - /// driver manager, the older manager will allocate the old AdbcDriver - /// struct and attempt to have the driver initialize it with the - /// older version. The driver must not access the new fields, - /// and should initialize the old fields. + /// When the driver manager attempts to initalize a driver at a particular + /// version, such as the case where the driver manager and driver are using different + /// versions of the ADBC spec, the driver should not try to access any functions defined + /// in the spec after that version. /// /// @{ @@ -2211,9 +2199,9 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver does not support this, /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. ADBC_EXPORT -AdbcStatusCode AdbcStatementExecuteMulti(struct AdbcStatement* statement, - struct AdbcMultiResultSet* results, - struct AdbcError* error); +AdbcStatusCode AdbcStatementExecuteSchemaMulti(struct AdbcStatement* statement, + struct AdbcMultiResultSet* results, + struct AdbcError* error); /// \brief Execute a statement that potentially returns multiple result sets /// diff --git a/go/adbc/drivermgr/arrow-adbc/adbc.h b/go/adbc/drivermgr/arrow-adbc/adbc.h index 80ee097b5c..83f4ec13c5 100644 --- a/go/adbc/drivermgr/arrow-adbc/adbc.h +++ b/go/adbc/drivermgr/arrow-adbc/adbc.h @@ -1052,8 +1052,7 @@ AdbcStatusCode AdbcMultiResultSetRelease(struct AdbcMultiResultSet* result_set, /// \param[out] error An optional location to return an error message if necessary. /// /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching results -/// as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate time, -/// and ADBC_STATUS_OK (or an appropriate error code) otherwise. +/// as partitions or ADBC_STATUS_OK (or an appropriate error code) otherwise. AdbcStatusCode AdbcMultiResultSetNext(struct AdbcMultiResultSet* result_set, struct ArrowArrayStream* out, int64_t* rows_affected, struct AdbcError* error); @@ -1062,8 +1061,6 @@ AdbcStatusCode AdbcMultiResultSetNext(struct AdbcMultiResultSet* result_set, /// /// \since ADBC API revision 1.2.0 /// -/// The AdbcMultiResultSet must outlive the returned partitions. -/// /// The driver can decide whether to allow fetching the next result set /// as a single stream or as a set of partitions. If the driver does not /// support fetching the next result set as partitions (indicating it should @@ -1266,19 +1263,10 @@ struct ADBC_EXPORT AdbcDriver { /// the AdbcDriverInitFunc is greater than or equal to /// ADBC_VERSION_1_2_0. /// - /// When a driver implementing an older spec is loaded by a newer - /// driver manager, the newer manager will allocate the new, expanded - /// AdbcDriver struct and attempt to have the driver initialize it with - /// the newer version. This must return an error, after which the driver - /// will try again with successively older versions all the way back to - /// ADBC_VERSION_1_0_0. The driver must not access the new fields, - /// which will carry undefined values. - /// - /// When a driver implementing a newer spec is loaded by an older - /// driver manager, the older manager will allocate the old AdbcDriver - /// struct and attempt to have the driver initialize it with the - /// older version. The driver must not access the new fields, - /// and should initialize the old fields. + /// When the driver manager attempts to initalize a driver at a particular + /// version, such as the case where the driver manager and driver are using different + /// versions of the ADBC spec, the driver should not try to access any functions defined + /// in the spec after that version. /// /// @{ @@ -2211,9 +2199,9 @@ AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement, /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver does not support this, /// and ADBC_STATUS_OK (or an appropriate error code) otherwise. ADBC_EXPORT -AdbcStatusCode AdbcStatementExecuteMulti(struct AdbcStatement* statement, - struct AdbcMultiResultSet* results, - struct AdbcError* error); +AdbcStatusCode AdbcStatementExecuteSchemaMulti(struct AdbcStatement* statement, + struct AdbcMultiResultSet* results, + struct AdbcError* error); /// \brief Execute a statement that potentially returns multiple result sets /// From 77cf12418241c2ac9a80cbab4f1abdac59654be2 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Wed, 11 Feb 2026 20:22:06 -0500 Subject: [PATCH 11/12] fix typo --- c/include/arrow-adbc/adbc.h | 2 +- go/adbc/drivermgr/arrow-adbc/adbc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c/include/arrow-adbc/adbc.h b/c/include/arrow-adbc/adbc.h index 83f4ec13c5..a16e6e39b9 100644 --- a/c/include/arrow-adbc/adbc.h +++ b/c/include/arrow-adbc/adbc.h @@ -1263,7 +1263,7 @@ struct ADBC_EXPORT AdbcDriver { /// the AdbcDriverInitFunc is greater than or equal to /// ADBC_VERSION_1_2_0. /// - /// When the driver manager attempts to initalize a driver at a particular + /// When the driver manager attempts to initialize a driver at a particular /// version, such as the case where the driver manager and driver are using different /// versions of the ADBC spec, the driver should not try to access any functions defined /// in the spec after that version. diff --git a/go/adbc/drivermgr/arrow-adbc/adbc.h b/go/adbc/drivermgr/arrow-adbc/adbc.h index 83f4ec13c5..a16e6e39b9 100644 --- a/go/adbc/drivermgr/arrow-adbc/adbc.h +++ b/go/adbc/drivermgr/arrow-adbc/adbc.h @@ -1263,7 +1263,7 @@ struct ADBC_EXPORT AdbcDriver { /// the AdbcDriverInitFunc is greater than or equal to /// ADBC_VERSION_1_2_0. /// - /// When the driver manager attempts to initalize a driver at a particular + /// When the driver manager attempts to initialize a driver at a particular /// version, such as the case where the driver manager and driver are using different /// versions of the ADBC spec, the driver should not try to access any functions defined /// in the spec after that version. From b9a6f5256345c52c515e57799ad9924829bad851 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Wed, 11 Feb 2026 20:23:46 -0500 Subject: [PATCH 12/12] remove old wording from 1.1.0 --- c/include/arrow-adbc/adbc.h | 14 -------------- go/adbc/drivermgr/arrow-adbc/adbc.h | 14 -------------- 2 files changed, 28 deletions(-) diff --git a/c/include/arrow-adbc/adbc.h b/c/include/arrow-adbc/adbc.h index a16e6e39b9..4aec6aeb21 100644 --- a/c/include/arrow-adbc/adbc.h +++ b/c/include/arrow-adbc/adbc.h @@ -1178,20 +1178,6 @@ struct ADBC_EXPORT AdbcDriver { /// the AdbcDriverInitFunc is greater than or equal to /// ADBC_VERSION_1_1_0. /// - /// When a driver implementing an older spec is loaded by a newer - /// driver manager, the newer manager will allocate the new, expanded - /// AdbcDriver struct and attempt to have the driver initialize it with - /// the newer version. This must return an error, after which the driver - /// will try again with successively older versions all the way back to - /// ADBC_VERSION_1_0_0. The driver must not access the new fields, - /// which will carry undefined values. - /// - /// When a driver implementing a newer spec is loaded by an older - /// driver manager, the older manager will allocate the old AdbcDriver - /// struct and attempt to have the driver initialize it with the - /// older version. The driver must not access the new fields, - /// and should initialize the old fields. - /// /// @{ int (*ErrorGetDetailCount)(const struct AdbcError* error); diff --git a/go/adbc/drivermgr/arrow-adbc/adbc.h b/go/adbc/drivermgr/arrow-adbc/adbc.h index a16e6e39b9..4aec6aeb21 100644 --- a/go/adbc/drivermgr/arrow-adbc/adbc.h +++ b/go/adbc/drivermgr/arrow-adbc/adbc.h @@ -1178,20 +1178,6 @@ struct ADBC_EXPORT AdbcDriver { /// the AdbcDriverInitFunc is greater than or equal to /// ADBC_VERSION_1_1_0. /// - /// When a driver implementing an older spec is loaded by a newer - /// driver manager, the newer manager will allocate the new, expanded - /// AdbcDriver struct and attempt to have the driver initialize it with - /// the newer version. This must return an error, after which the driver - /// will try again with successively older versions all the way back to - /// ADBC_VERSION_1_0_0. The driver must not access the new fields, - /// which will carry undefined values. - /// - /// When a driver implementing a newer spec is loaded by an older - /// driver manager, the older manager will allocate the old AdbcDriver - /// struct and attempt to have the driver initialize it with the - /// older version. The driver must not access the new fields, - /// and should initialize the old fields. - /// /// @{ int (*ErrorGetDetailCount)(const struct AdbcError* error);