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/07/02 10:54:26 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #2828: Improve ergonomics of physical expr `lit`

alamb commented on code in PR #2828:
URL: https://github.com/apache/arrow-datafusion/pull/2828#discussion_r912349280


##########
datafusion/core/src/physical_optimizer/aggregate_statistics.rs:
##########
@@ -525,7 +525,7 @@ mod tests {
             expressions::binary(
                 expressions::col("a", &schema)?,
                 Operator::Gt,
-                expressions::lit(ScalarValue::from(1u32)),
+                expressions::lit(1u32),

Review Comment:
   This change shows the point of this PR pretty well 



##########
datafusion/physical-expr/src/expressions/literal.rs:
##########
@@ -74,8 +74,13 @@ impl PhysicalExpr for Literal {
 }
 
 /// Create a literal expression
-pub fn lit(value: ScalarValue) -> Arc<dyn PhysicalExpr> {
-    Arc::new(Literal::new(value))
+pub fn lit<T: datafusion_expr::Literal>(value: T) -> Arc<dyn PhysicalExpr> {

Review Comment:
   Here is the actual change. It isn't the most beautiful code but I think it is reasonable



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