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 2020/07/20 18:18:40 UTC

[GitHub] [arrow] andygrove opened a new pull request #7809: ARROW-9534: [Rust] [DataFusion] Add functions to create literal expressions

andygrove opened a new pull request #7809:
URL: https://github.com/apache/arrow/pull/7809


   


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

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



[GitHub] [arrow] andygrove commented on pull request #7809: ARROW-9534: [Rust] [DataFusion] Add functions to create literal expressions

Posted by GitBox <gi...@apache.org>.
andygrove commented on pull request #7809:
URL: https://github.com/apache/arrow/pull/7809#issuecomment-661264618


   @jorgecarleitao fyi


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

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



[GitHub] [arrow] jorgecarleitao commented on pull request #7809: ARROW-9534: [Rust] [DataFusion] Add functions to create literal expressions

Posted by GitBox <gi...@apache.org>.
jorgecarleitao commented on pull request #7809:
URL: https://github.com/apache/arrow/pull/7809#issuecomment-661276604


   Nice! I just needed this in my ballista's PR!
   
   following [this SO answer](https://stackoverflow.com/a/40776087/931303), what do you think of
   
   ```
   trait Literal {
       fn lit(&self) -> ScalarValue;
   }
   
   impl Literal for i32 {
       fn lit(&self) -> ScalarValue {
           ScalarValue::Int(self.clone())
       }
   }
   impl Literal for bool {
       fn lit(&self) -> ScalarValue {
           ScalarValue::Boolean(self.clone())
       }
   }
   
   fn lit<T: Literal>(n: T) -> ScalarValue {
       n.lit()
   }
   
   # usage:
   # lit(2);
   # lit(true);
   ```
   
   this way, the user does not have to import nor remember the value's type; they can just call `lit`. It seems to be a common pattern in rust.
   


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

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



[GitHub] [arrow] github-actions[bot] commented on pull request #7809: ARROW-9534: [Rust] [DataFusion] Add functions to create literal expressions

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #7809:
URL: https://github.com/apache/arrow/pull/7809#issuecomment-661260249


   https://issues.apache.org/jira/browse/ARROW-9534


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

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



[GitHub] [arrow] andygrove closed pull request #7809: ARROW-9534: [Rust] [DataFusion] Add functions to create literal expressions

Posted by GitBox <gi...@apache.org>.
andygrove closed pull request #7809:
URL: https://github.com/apache/arrow/pull/7809


   


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

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



[GitHub] [arrow] jorgecarleitao commented on pull request #7809: ARROW-9534: [Rust] [DataFusion] Add functions to create literal expressions

Posted by GitBox <gi...@apache.org>.
jorgecarleitao commented on pull request #7809:
URL: https://github.com/apache/arrow/pull/7809#issuecomment-661286169


   I can take 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.

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



[GitHub] [arrow] andygrove commented on pull request #7809: ARROW-9534: [Rust] [DataFusion] Add functions to create literal expressions

Posted by GitBox <gi...@apache.org>.
andygrove commented on pull request #7809:
URL: https://github.com/apache/arrow/pull/7809#issuecomment-661283955


   @jorgecarleitao Oh, that is much nicer. Do you want to PR that and I'll close this one?


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

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