liukun4515 commented on code in PR #2764:
URL: https://github.com/apache/arrow-datafusion/pull/2764#discussion_r903542187


##########
datafusion/physical-expr/src/expressions/in_list.rs:
##########
@@ -645,8 +744,55 @@ pub fn in_list(
     expr: Arc<dyn PhysicalExpr>,
     list: Vec<Arc<dyn PhysicalExpr>>,
     negated: &bool,
+    input_schema: &Schema,
 ) -> Result<Arc<dyn PhysicalExpr>> {
-    Ok(Arc::new(InListExpr::new(expr, list, *negated)))
+    let (cast_expr, cast_list) = in_list_cast(expr, list, input_schema)?;
+    Ok(Arc::new(InListExpr::new(cast_expr, cast_list, *negated)))
+}
+
+fn in_list_cast(
+    expr: Arc<dyn PhysicalExpr>,
+    list: Vec<Arc<dyn PhysicalExpr>>,
+    input_schema: &Schema,
+) -> Result<(Arc<dyn PhysicalExpr>, Vec<Arc<dyn PhysicalExpr>>)> {
+    let expr_type = &expr.data_type(input_schema)?;
+    let list_types: Vec<DataType> = list
+        .iter()
+        .map(|list_expr| list_expr.data_type(input_schema).unwrap())
+        .collect();
+    // TODO in the arrow-rs, should support NULL type to Decimal Data type
+    // TODO support in the arrow-rs, NULL value cast to Decimal Value
+    let result_type = get_coerce_type(expr_type, &list_types);

Review Comment:
   In this issue: https://github.com/apache/arrow-datafusion/issues/2759
   The type of list is `BOOLEAN, INT32`, and these two type are not compatible.



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to