Skip to content

feat(c/driver/sqlite): ensure batch rows option can be retrieved - #4645

Open
lidavidm wants to merge 4 commits into
apache:mainfrom
lidavidm:gh-3456
Open

feat(c/driver/sqlite): ensure batch rows option can be retrieved#4645
lidavidm wants to merge 4 commits into
apache:mainfrom
lidavidm:gh-3456

Conversation

@lidavidm

@lidavidm lidavidm commented Aug 4, 2026

Copy link
Copy Markdown
Member

The getter existed, but the framework needed to be extended to also allow fetching it as a string, and tests were added.

Closes #3456.

Assisted-by: GPT-5.6 Sol codex@openai.com

@lidavidm
lidavidm marked this pull request as ready for review August 4, 2026 05:22
@lidavidm
lidavidm requested a review from paleolimbot as a code owner August 4, 2026 05:22
@lidavidm
lidavidm requested a review from amoeba August 4, 2026 06:27

@paleolimbot paleolimbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Comment thread c/driver/framework/base_driver.h Outdated
Comment on lines +178 to +179
formatted = std::to_string(value);
string_value = formatted;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any locale concerns here (i.e., doubles getting exported as 123,456 instead of 123.456)? to_chars() might be better (although I think there was a thing where some gcc versions don't include it?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point; let me look into that a bit

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we need GCC11 as a baseline. I believe that's OK: AlmaLinux etc. can install a newer GCC toolchain, and Ubuntu 22.04 has GCC11.
apache/arrow#14666
https://stackoverflow.com/questions/63963961/what-is-the-correct-way-to-call-stdto-chars
https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2017

And for clang, we need clang14 (if I understand this table right)
https://libcxx.llvm.org/Status/Cxx17.html
I believe that's supported since macOS 13, which is already EOL. But conda-forge may complain. The minimum is only macOS 11. We mark our packages as requiring macOS 12 due to Golang. And the next version of Go will also require 13. So maybe this is OK.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a tiny bit of a pain, but you could guard the double translation in a define for older gcc/clang since most of the time to_string() is fine.

Comment thread c/driver/framework/base_driver.h Outdated
The getter existed, but the framework needed to be extended to also
allow fetching it as a string, and tests were added.

Closes apache#3456.

Assisted-by: GPT-5.6 Sol <codex@openai.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Issue #3456 by extending the C driver framework option getter so that numeric option values (notably SQLite’s adbc.sqlite.query.batch_rows) can be retrieved via the string GetOption API, and adds/updates cross-language tests to validate the behavior.

Changes:

  • Extend the driver framework option wrapper to allow retrieving int64_t/double option values as strings via GetOption.
  • Add a C++ SQLite driver test validating batch_rows can be read both as int and as string (including “buffer too small” length reporting).
  • Add Python and R tests covering string/int retrieval for the option and numeric-to-string behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
c/driver/framework/base_driver.h Extends Option::CGet(char*, ...) to stringify numeric option values.
c/driver/sqlite/sqlite_test.cc Adds a regression test verifying adbc.sqlite.query.batch_rows can be retrieved as string/int across database/connection/statement.
python/adbc_driver_sqlite/tests/test_lowlevel.py Adds assertions that BATCH_ROWS can be retrieved as both string and int from Python.
r/adbcdrivermanager/tests/testthat/test-options.R Updates void-driver option tests to expect numeric options to be retrievable as strings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread c/driver/framework/base_driver.h
Comment thread c/driver/framework/base_driver.h Outdated
@lidavidm

lidavidm commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

Hmm. Indeed, we'll need to bump our macOS requirement to 13.3 and install a new toolchain for AlmaLinux 8. Given Go will force our hand on the macOS side, and the AlmaLinux side shouldn't result in any runtime differences, I think this is ok. Any objections?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: stmt.get_option(adbc_driver_sqlite.StatementOptions.BATCH_ROWS.value) raises

4 participants