You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "nseekhao (via GitHub)" <gi...@apache.org> on 2023/02/24 17:06:31 UTC

[GitHub] [arrow-datafusion] nseekhao commented on a diff in pull request #5137: Substrait: Add cast expression with bool, integers and decimal128 support

nseekhao commented on code in PR #5137:
URL: https://github.com/apache/arrow-datafusion/pull/5137#discussion_r1117330249


##########
datafusion/substrait/src/consumer.rs:
##########
@@ -679,12 +680,46 @@ pub async fn from_substrait_rex(
                 }
             }
         }
+        Some(RexType::Cast(cast)) => Ok(Arc::new(Expr::Cast(Cast::new(
+            Box::new(
+                from_substrait_rex(
+                    cast.as_ref().input.as_ref().unwrap().as_ref(),
+                    input_schema,
+                    extensions,
+                )
+                .await?
+                .as_ref()
+                .clone(),
+            ),
+            from_substrait_type(cast.as_ref().r#type.as_ref().unwrap())?,

Review Comment:
   Good point. Generally if the Substrait plan has been produced correctly, the `cast` expression should always have an output type. But since we cannot guarantee that, I added a match arm to produce appropriate error in [58f90ce](https://github.com/apache/arrow-datafusion/pull/5137/commits/58f90ce085583ba392ed6bbc4db90e7b0b83656b),



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