This is an automated email from the ASF dual-hosted git repository.

agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 00a17313f Make `lit` implementation more concise (#2838)
00a17313f is described below

commit 00a17313f8caa3b704fb2acee9e3fa4ac2d268ed
Author: Andrew Lamb <[email protected]>
AuthorDate: Tue Jul 5 18:54:11 2022 -0400

    Make `lit` implementation more concise (#2838)
---
 datafusion/physical-expr/src/expressions/literal.rs | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/datafusion/physical-expr/src/expressions/literal.rs 
b/datafusion/physical-expr/src/expressions/literal.rs
index 80a808cba..e711f57c0 100644
--- a/datafusion/physical-expr/src/expressions/literal.rs
+++ b/datafusion/physical-expr/src/expressions/literal.rs
@@ -75,12 +75,10 @@ impl PhysicalExpr for Literal {
 
 /// Create a literal expression
 pub fn lit<T: datafusion_expr::Literal>(value: T) -> Arc<dyn PhysicalExpr> {
-    let scalar_value = if let Expr::Literal(v) = value.lit() {
-        v
-    } else {
-        unreachable!()
-    };
-    Arc::new(Literal::new(scalar_value))
+    match value.lit() {
+        Expr::Literal(v) => Arc::new(Literal::new(v)),
+        _ => unreachable!(),
+    }
 }
 
 #[cfg(test)]

Reply via email to