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

[I] rust/core/error: Make `Error` struct be boxed so stack frames aren't very large [arrow-adbc]

serramatutu opened a new issue, #4667:
URL: https://github.com/apache/arrow-adbc/issues/4667

   ### What feature or improvement would you like to see?
   
   ## Problem
   
   Currently the `adbc_core::Error` struct contains all the fields (message, status, vendor code etc), and it is directly embedded in `adbc_core::Result`. That means regardless of `sizeof!(T)`, `Result` is always at least `sizeof!(Error)`, which is large.
   
   This makes applications pay a lot of stack frame for the cold error handling path since every `Result` is big.
   
   ## Solution
   
   Change it to something like
   
   ```rust
   pub struct Error(Box<ErrorInner>);
   
   pub struct ErrorInner {
       message: String,
       // ...
   }
   
   impl Error {
       pub fn message(&self) -> &str {
           &self.0.message
       }
       
       // ....
   }
   ```
   
   Now `sizeof!(Error)` is effectively the size of a thin pointer (`usize`).
   
   Note that this will be a massive breaking change since currently all the fields in `Error` are `pub` so virtually everyone doing error handling based on those public fields will need to change their code to use accessors instead.
   


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

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


Re: [I] rust/core/error: Make `Error` struct be boxed so stack frames aren't very large [arrow-adbc]

Posted by "serramatutu (via GitHub)" <gi...@apache.org>.
serramatutu commented on issue #4667:
URL: https://github.com/apache/arrow-adbc/issues/4667#issuecomment-5204896677

   In concrete terms, on MacOS ARM:
   
   ```
   sizeof(Error) = 64 bytes
   sizeof(Box<Error>) = 8 bytes
   ```
   
   <img width="758" height="155" alt="Image" src="https://github.com/user-attachments/assets/cfa0abf4-5993-484b-b9e4-0358cb437510" />


-- 
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: [I] rust/core/error: Make `Error` struct be boxed so stack frames aren't very large [arrow-adbc]

Posted by "serramatutu (via GitHub)" <gi...@apache.org>.
serramatutu commented on issue #4667:
URL: https://github.com/apache/arrow-adbc/issues/4667#issuecomment-5206527150

   @paleolimbot FWIW we don't have stacks that go that deep and it's not a dealbreaker for us. I'm just suggesting this as an improvement before 1.0, which will make it a lot harder to make breaking changes like this.


-- 
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: [I] rust/core/error: Make `Error` struct be boxed so stack frames aren't very large [arrow-adbc]

Posted by "eitsupi (via GitHub)" <gi...@apache.org>.
eitsupi commented on issue #4667:
URL: https://github.com/apache/arrow-adbc/issues/4667#issuecomment-5210360020

   I think it makes sense to make a breaking change for this now.


-- 
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: [I] rust/core/error: Make `Error` struct be boxed so stack frames aren't very large [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #4667:
URL: https://github.com/apache/arrow-adbc/issues/4667#issuecomment-5203962627

   I was thinking about this too. It'll be messy, but we do have a chance to fix this since _technically_ we're still in 0.x. (You could perhaps argue that drivers should use their own error type internally and convert at the boundaries, but that's also a bit annoying.)


-- 
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: [I] rust/core/error: Make `Error` struct be boxed so stack frames aren't very large [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #4667:
URL: https://github.com/apache/arrow-adbc/issues/4667#issuecomment-5203990768

   CC @eitsupi @paleolimbot for opinions as well!


-- 
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: [I] rust/core/error: Make `Error` struct be boxed so stack frames aren't very large [arrow-adbc]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on issue #4667:
URL: https://github.com/apache/arrow-adbc/issues/4667#issuecomment-5205625933

   I think it's fine, and will probably not be that hard to adapt to.
   
   For what it's worth, DataFusion's result is 40 bytes. I am surprised that there are deep stacks so populated with ADBC calls that it affects the stack size, but if it's easy to do and helpful I think it's a good move.


-- 
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