You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "lidavidm (via GitHub)" <gi...@apache.org> on 2026/08/04 01:57:22 UTC

[PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

lidavidm opened a new pull request, #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645

   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 <co...@openai.com>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#discussion_r3717984095


##########
c/driver/framework/base_driver.h:
##########
@@ -54,8 +54,8 @@ enum class LifecycleState {
   kInitialized,
 };
 
-/// \brief A typed option value wrapper. It currently does not attempt
-/// conversion (i.e., getting a double option as a string).
+/// \brief A typed option value wrapper. Numeric values can be retrieved as strings,
+/// but other conversions are not attempted.

Review Comment:
   The updated docstring says "Numeric values can be retrieved as strings, but other conversions are not attempted." However, this class does perform other conversions (e.g. `CGet(double*)` accepts `int64_t` and converts via `static_cast<double>`). Please adjust the comment to reflect the actual (limited) conversion behavior.



##########
c/driver/framework/base_driver.h:
##########
@@ -169,11 +169,26 @@ class Option {
       return std::visit(
           [&](auto&& value) -> AdbcStatusCode {
             using T = std::decay_t<decltype(value)>;
-            if constexpr (std::is_same_v<T, std::string>) {
-              size_t value_size_with_terminator = value.size() + 1;
+            if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int64_t> ||
+                          std::is_same_v<T, double>) {
+              char formatted[24];  // Enough room for double/int64_t
+              std::string_view string_value;
+              if constexpr (std::is_same_v<T, std::string>) {
+                string_value = value;
+              } else {
+                auto result =
+                    std::to_chars(formatted, formatted + sizeof(formatted), value);
+                if (result.ec != std::errc()) {
+                  return status::Internal("Could not format numeric option value")
+                      .ToAdbc(error);
+                }
+                string_value = std::string_view(
+                    formatted, static_cast<size_t>(result.ptr - formatted));
+              }

Review Comment:
   `Option::CGet(char*, ...)` now formats `double` via `std::to_chars(formatted, ..., value)`, but the 3-argument `std::to_chars` overload only exists for integral types; floating-point requires specifying `std::chars_format`. As written, this will fail to compile (or be non-portable) when the variant holds a `double`.
   
   Use the floating-point overload for `double` and keep the integral overload for `int64_t` (optionally with a slightly larger buffer to avoid `value_too_large`).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#discussion_r3720717968


##########
c/driver/framework/base_driver.h:
##########
@@ -169,11 +169,19 @@ class Option {
       return std::visit(
           [&](auto&& value) -> AdbcStatusCode {
             using T = std::decay_t<decltype(value)>;
-            if constexpr (std::is_same_v<T, std::string>) {
-              size_t value_size_with_terminator = value.size() + 1;
+            if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int64_t>) {
+              std::string formatted;
+              std::string_view string_value;
+              if constexpr (std::is_same_v<T, std::string>) {
+                string_value = value;
+              } else {
+                formatted = std::to_string(value);
+                string_value = formatted;

Review Comment:
   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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#issuecomment-5577065314

   (The docs build error seems to have just been a flaky build.)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#issuecomment-5188218248

   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?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm merged PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "amoeba (via GitHub)" <gi...@apache.org>.
amoeba commented on code in PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#discussion_r3715504386


##########
c/driver/framework/base_driver.h:
##########
@@ -169,11 +169,19 @@ class Option {
       return std::visit(
           [&](auto&& value) -> AdbcStatusCode {
             using T = std::decay_t<decltype(value)>;
-            if constexpr (std::is_same_v<T, std::string>) {
-              size_t value_size_with_terminator = value.size() + 1;
+            if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int64_t>) {

Review Comment:
   Just curious, why not also cover doubles here when we're also handling ints?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "amoeba (via GitHub)" <gi...@apache.org>.
amoeba commented on code in PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#discussion_r3717515974


##########
c/driver/framework/base_driver.h:
##########
@@ -169,11 +169,19 @@ class Option {
       return std::visit(
           [&](auto&& value) -> AdbcStatusCode {
             using T = std::decay_t<decltype(value)>;
-            if constexpr (std::is_same_v<T, std::string>) {
-              size_t value_size_with_terminator = value.size() + 1;
+            if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int64_t>) {

Review Comment:
   Cool, thanks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#discussion_r3712073324


##########
c/driver/framework/base_driver.h:
##########
@@ -169,11 +169,19 @@ class Option {
       return std::visit(
           [&](auto&& value) -> AdbcStatusCode {
             using T = std::decay_t<decltype(value)>;
-            if constexpr (std::is_same_v<T, std::string>) {
-              size_t value_size_with_terminator = value.size() + 1;
+            if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int64_t>) {
+              std::string formatted;
+              std::string_view string_value;
+              if constexpr (std::is_same_v<T, std::string>) {
+                string_value = value;
+              } else {
+                formatted = std::to_string(value);
+                string_value = formatted;

Review Comment:
   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?)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#issuecomment-5576716815

   I'll fix the docs build separately.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#discussion_r3717317308


##########
c/driver/framework/base_driver.h:
##########
@@ -169,11 +169,19 @@ class Option {
       return std::visit(
           [&](auto&& value) -> AdbcStatusCode {
             using T = std::decay_t<decltype(value)>;
-            if constexpr (std::is_same_v<T, std::string>) {
-              size_t value_size_with_terminator = value.size() + 1;
+            if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int64_t>) {
+              std::string formatted;
+              std::string_view string_value;
+              if constexpr (std::is_same_v<T, std::string>) {
+                string_value = value;
+              } else {
+                formatted = std::to_string(value);
+                string_value = formatted;

Review Comment:
   Good point; let me look into that a bit



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#issuecomment-5391184422

   I realized we're using fmtlib already, so we can just use that!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#discussion_r3717318116


##########
c/driver/framework/base_driver.h:
##########
@@ -169,11 +169,19 @@ class Option {
       return std::visit(
           [&](auto&& value) -> AdbcStatusCode {
             using T = std::decay_t<decltype(value)>;
-            if constexpr (std::is_same_v<T, std::string>) {
-              size_t value_size_with_terminator = value.size() + 1;
+            if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int64_t>) {

Review Comment:
   Mostly because it wasn't strictly necessary, but I'll add it since it won't hurt



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(c/driver/sqlite): ensure batch rows option can be retrieved [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #4645:
URL: https://github.com/apache/arrow-adbc/pull/4645#discussion_r3717436732


##########
c/driver/framework/base_driver.h:
##########
@@ -169,11 +169,19 @@ class Option {
       return std::visit(
           [&](auto&& value) -> AdbcStatusCode {
             using T = std::decay_t<decltype(value)>;
-            if constexpr (std::is_same_v<T, std::string>) {
-              size_t value_size_with_terminator = value.size() + 1;
+            if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int64_t>) {
+              std::string formatted;
+              std::string_view string_value;
+              if constexpr (std::is_same_v<T, std::string>) {
+                string_value = value;
+              } else {
+                formatted = std::to_string(value);
+                string_value = formatted;

Review Comment:
   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.
   https://github.com/apache/arrow/pull/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](https://conda-forge.org/news/2026/02/06/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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org