You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/23 15:14:10 UTC

[GitHub] [arrow-ballista] avantgardnerio commented on issue #479: Refactor config

avantgardnerio commented on issue #479:
URL: https://github.com/apache/arrow-ballista/issues/479#issuecomment-1325232522

   FWIW, I'd love to switch to a more `Default` & [struct update syntax](https://stackoverflow.com/questions/48389072/what-is-the-syntax-inside-a-struct-literal-in-rust) format for configs. Here's an example in practice of building very complex structs for the SQL parser, but only overriding certain fields that the user cares about:
   
   ```
                       let query = ast::Query {
                           body: Box::new(SetExpr::Select(Box::new(ast::Select {
                               projection,
                               from: vec![table],
                               selection,
                               ..default_select()
                           }))),
                           ..default_query()
                       };
   ```
   
   IMO this more concisely solves the problem without the multiple state mutations of the builder pattern, which seems closer to idiomatic Rust.
   
   CC @alamb because he's talked about this in datafusion.


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