You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/03/23 14:18:28 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5692: Handle serialization of TryCast

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


##########
datafusion/proto/src/logical_plan/to_proto.rs:
##########
@@ -489,50 +489,59 @@ impl TryFrom<&Expr> for protobuf::LogicalExprNode {
                     // linearized from left innermost to right outermost (but while
                     // traversing the chain we do the exact opposite).
                     operands: exprs
-                    .into_iter()
-                    .rev()
-                    .map(|expr| expr.try_into())
-                    .collect::<Result<Vec<_>, Error>>()?,
+                        .into_iter()
+                        .rev()
+                        .map(|expr| expr.try_into())
+                        .collect::<Result<Vec<_>, Error>>()?,
                     op: format!("{op:?}"),
                 };
                 Self {
                     expr_type: Some(ExprType::BinaryExpr(binary_expr)),
                 }
             }
-            Expr::Like(Like { negated, expr, pattern, escape_char }) => {
+            Expr::Like(Like {
+                negated,
+                expr,
+                pattern,
+                escape_char,
+            }) => {
                 let pb = Box::new(protobuf::LikeNode {
                     negated: *negated,
                     expr: Some(Box::new(expr.as_ref().try_into()?)),
                     pattern: Some(Box::new(pattern.as_ref().try_into()?)),
-                    escape_char: escape_char
-                        .map(|ch| ch.to_string())
-                        .unwrap_or_default()
+                    escape_char: escape_char.map(|ch| ch.to_string()).unwrap_or_default(),
                 });
                 Self {
                     expr_type: Some(ExprType::Like(pb)),
                 }
             }
-            Expr::ILike(Like { negated, expr, pattern, escape_char }) => {
+            Expr::ILike(Like {

Review Comment:
   these changes look fine to me, but it isn't clear to me why `rustfmt` / lint didn't catch them before 🤔 



##########
datafusion/proto/src/logical_plan/to_proto.rs:
##########
@@ -911,10 +943,12 @@ impl TryFrom<&Expr> for protobuf::LogicalExprNode {
                         data_type,
                     })),
                 }
-            },
+            }
 
-            Expr::QualifiedWildcard { .. } | Expr::TryCast { .. } =>
-                return Err(Error::General("Proto serialization error: Expr::QualifiedWildcard { .. } | Expr::TryCast { .. } not supported".to_string())),
+            Expr::QualifiedWildcard { .. } => return Err(Error::General(

Review Comment:
   I like the fact that `QualifiedWildcard` is the only expr left that isn't supported ❤️ 



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