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


##########
datafusion/core/tests/sql/explain_analyze.rs:
##########
@@ -373,6 +373,28 @@ async fn csv_explain_verbose() {
     assert_contains!(actual, "SAME TEXT AS ABOVE");
 }
 
+#[tokio::test]
+async fn csv_explain_inlist_verbose() {
+    let ctx = SessionContext::new();
+    register_aggregate_csv_by_sql(&ctx).await;
+    let sql = "EXPLAIN VERBOSE SELECT c1 FROM aggregate_test_100 where c2 in 
(1,2,4)";
+    let actual = execute(&ctx, sql).await;
+
+    // Optimized by PreCastLitInComparisonExpressions rule
+    // the data type of c2 is INT32, the type of `1,2,3,4` is INT64.
+    // the value of `1,2,4` will be casted to INT32 and pre-calculated
+    // flatten to a single string

Review Comment:
   ```suggestion
   
       // flatten to a single string
   ```



##########
datafusion/core/tests/sql/explain_analyze.rs:
##########
@@ -373,6 +373,28 @@ async fn csv_explain_verbose() {
     assert_contains!(actual, "SAME TEXT AS ABOVE");
 }
 
+#[tokio::test]
+async fn csv_explain_inlist_verbose() {
+    let ctx = SessionContext::new();
+    register_aggregate_csv_by_sql(&ctx).await;
+    let sql = "EXPLAIN VERBOSE SELECT c1 FROM aggregate_test_100 where c2 in 
(1,2,4)";
+    let actual = execute(&ctx, sql).await;
+
+    // Optimized by PreCastLitInComparisonExpressions rule
+    // the data type of c2 is INT32, the type of `1,2,3,4` is INT64.
+    // the value of `1,2,4` will be casted to INT32 and pre-calculated
+    // flatten to a single string
+    let actual = actual.into_iter().map(|r| r.join("\t")).collect::<String>();
+    assert_contains!(

Review Comment:
   ```suggestion
   
       // before optimization (Int64 literals)
       assert_contains!(
   ```



##########
datafusion/core/tests/sql/explain_analyze.rs:
##########
@@ -373,6 +373,28 @@ async fn csv_explain_verbose() {
     assert_contains!(actual, "SAME TEXT AS ABOVE");
 }
 
+#[tokio::test]
+async fn csv_explain_inlist_verbose() {
+    let ctx = SessionContext::new();
+    register_aggregate_csv_by_sql(&ctx).await;
+    let sql = "EXPLAIN VERBOSE SELECT c1 FROM aggregate_test_100 where c2 in 
(1,2,4)";
+    let actual = execute(&ctx, sql).await;
+
+    // Optimized by PreCastLitInComparisonExpressions rule
+    // the data type of c2 is INT32, the type of `1,2,3,4` is INT64.
+    // the value of `1,2,4` will be casted to INT32 and pre-calculated
+    // flatten to a single string
+    let actual = actual.into_iter().map(|r| r.join("\t")).collect::<String>();
+    assert_contains!(
+        &actual,
+        "#aggregate_test_100.c2 IN ([Int64(1), Int64(2), Int64(4)])"
+    );
+    assert_contains!(

Review Comment:
   ```suggestion
       // after optimization (casted to Int32)
       assert_contains!(
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to