You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "felipecrv (via GitHub)" <gi...@apache.org> on 2026/03/24 23:14:25 UTC
[PR] fix(rust/core): Handle the ASCII characters from sqlstate instead of their decimal values [arrow-adbc]
felipecrv opened a new pull request, #4141:
URL: https://github.com/apache/arrow-adbc/pull/4141
(no comment)
--
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] fix(rust/core): Handle the ASCII characters from sqlstate instead of their decimal values [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #4141:
URL: https://github.com/apache/arrow-adbc/pull/4141#discussion_r3017562363
##########
rust/core/src/error.rs:
##########
@@ -102,10 +102,26 @@ impl Error {
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let safe_ascii = |c: c_char| -> char {
+ if c == 0 {
+ '0'
+ } else if c >= 32 && c <= 126 {
+ char::from(c as u8)
+ } else {
+ '\u{FFFD}'
+ }
+ };
write!(
f,
- "{:?}: {} (sqlstate: {:?}, vendor_code: {})",
- self.status, self.message, self.sqlstate, self.vendor_code
+ "{:?}: {} (sqlstate: {}{}{}{}{}, vendor_code: {})",
Review Comment:
Same as the comment above:
> But this is because drivers can either set the SQLSTATE to all 0 integers or '0' ASCII. They are all equivalent to the end-user: they mean "empty SQLSTATE".
--
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] fix(rust/core): Handle the ASCII characters from sqlstate instead of their decimal values [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #4141:
URL: https://github.com/apache/arrow-adbc/pull/4141#discussion_r2985620177
##########
rust/core/src/error.rs:
##########
@@ -102,10 +102,26 @@ impl Error {
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let safe_ascii = |c: c_char| -> char {
+ if c == 0 {
+ '0'
+ } else if c >= 32 && c <= 126 {
+ char::from(c as u8)
+ } else {
+ '\u{FFFD}'
Review Comment:
Maybe we can still display the value somehow instead of hiding it? (Just stringify the integer value instead?)
##########
rust/core/src/error.rs:
##########
@@ -102,10 +102,26 @@ impl Error {
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let safe_ascii = |c: c_char| -> char {
+ if c == 0 {
+ '0'
+ } else if c >= 32 && c <= 126 {
+ char::from(c as u8)
+ } else {
+ '\u{FFFD}'
+ }
+ };
write!(
f,
- "{:?}: {} (sqlstate: {:?}, vendor_code: {})",
- self.status, self.message, self.sqlstate, self.vendor_code
+ "{:?}: {} (sqlstate: {}{}{}{}{}, vendor_code: {})",
Review Comment:
Maybe what'd be better is: if sqlstate is all-NUL, omit it; if all-ASCII, stringify it; else fall back to the current representation?
##########
rust/core/src/error.rs:
##########
@@ -102,10 +102,26 @@ impl Error {
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let safe_ascii = |c: c_char| -> char {
+ if c == 0 {
+ '0'
Review Comment:
I think I'd prefer something that isn't ambiguous with an actual sqlstate of '00000'.
--
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] fix(rust/core): Handle the ASCII characters from sqlstate instead of their decimal values [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #4141:
URL: https://github.com/apache/arrow-adbc/pull/4141#discussion_r3037411424
##########
rust/core/src/error.rs:
##########
@@ -102,10 +102,26 @@ impl Error {
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let safe_ascii = |c: c_char| -> char {
+ if c == 0 {
+ '0'
Review Comment:
That's why Rust (wisely) has the `fmt::Debug` and `fmt::Display` traits. `Debug` is for the developer. The derived `Debug` will print exactly what you are asking. `Display` is the "human" rendering.
When I do a `to_string()` on a error, `Display::fmt` is called because I'm rending a message to a human.
--
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] fix(rust/core): Handle the ASCII characters from sqlstate instead of their decimal values [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #4141:
URL: https://github.com/apache/arrow-adbc/pull/4141#discussion_r3017553424
##########
rust/core/src/error.rs:
##########
@@ -102,10 +102,26 @@ impl Error {
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let safe_ascii = |c: c_char| -> char {
+ if c == 0 {
+ '0'
+ } else if c >= 32 && c <= 126 {
+ char::from(c as u8)
+ } else {
+ '\u{FFFD}'
Review Comment:
I'm not hiding. I'm showing � to say "this is not valid UTF-8". SQLSTATE is ASCII/UTF-8. A C implementation of this wouldn't even bother validating the value. Would just be printing it from a `char *`.
--
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] fix(rust/core): Handle the ASCII characters from sqlstate instead of their decimal values [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on PR #4141:
URL: https://github.com/apache/arrow-adbc/pull/4141#issuecomment-4584928500
Rebased. cargo fmt'd and pushed.
--
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] fix(rust/core): Handle the ASCII characters from sqlstate instead of their decimal values [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #4141:
URL: https://github.com/apache/arrow-adbc/pull/4141#discussion_r3017559672
##########
rust/core/src/error.rs:
##########
@@ -102,10 +102,26 @@ impl Error {
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let safe_ascii = |c: c_char| -> char {
+ if c == 0 {
+ '0'
Review Comment:
But this is because drivers can either set the SQLSTATE to all 0 integers or '0' ASCII. They are all equivalent to the end-user: they mean "empty SQLSTATE".
--
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] fix(rust/core): Handle the ASCII characters from sqlstate instead of their decimal values [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on PR #4141:
URL: https://github.com/apache/arrow-adbc/pull/4141#issuecomment-4122036092
I'm tired of seeing `sqlstate: [48, 48, 48, 48, 48],` all the time. :)
--
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] fix(rust/core): Handle the ASCII characters from sqlstate instead of their decimal values [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #4141:
URL: https://github.com/apache/arrow-adbc/pull/4141#issuecomment-4483453368
@felipecrv sorry for losing track of this. Do you want to rebase and fix the Clippy lint and then we can get this merged? I'll give in to your reasoning here ^_^
--
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] fix(rust/core): Handle the ASCII characters from sqlstate instead of their decimal values [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #4141:
URL: https://github.com/apache/arrow-adbc/pull/4141#discussion_r3020065603
##########
rust/core/src/error.rs:
##########
@@ -102,10 +102,26 @@ impl Error {
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let safe_ascii = |c: c_char| -> char {
+ if c == 0 {
+ '0'
Review Comment:
At least as a developer, though, I'd like to know the exact values. I agree that we should handle the common-case, but I don't think we have to sacrifice accuracy
--
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] fix(rust/core): Handle the ASCII characters from sqlstate instead of their decimal values [arrow-adbc]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv merged PR #4141:
URL: https://github.com/apache/arrow-adbc/pull/4141
--
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