Ted-Jiang commented on code in PR #4487:
URL: https://github.com/apache/arrow-datafusion/pull/4487#discussion_r1040416110


##########
datafusion/core/tests/sql/predicates.rs:
##########
@@ -589,19 +588,15 @@ async fn multiple_or_predicates() -> Result<()> {
     // factored out and appear only once in the following plan
     let expected = vec![
         "Explain [plan_type:Utf8, plan:Utf8]",
-        "  Projection: #lineitem.l_partkey [l_partkey:Int64]",
-        "    Projection: #part.p_size >= Int32(1) AS #part.p_size >= 
Int32(1)Int32(1)#part.p_size, #lineitem.l_partkey, #lineitem.l_quantity, 
#part.p_brand, #part.p_size [#part.p_size >= 
Int32(1)Int32(1)#part.p_size:Boolean;N, l_partkey:Int64, 
l_quantity:Decimal128(15, 2), p_brand:Utf8, p_size:Int32]",
-        "      Filter: #part.p_brand = Utf8(\"Brand#12\") AND 
#lineitem.l_quantity >= Decimal128(Some(100),15,2) AND #lineitem.l_quantity <= 
Decimal128(Some(1100),15,2) AND #part.p_size <= Int32(5) OR #part.p_brand = 
Utf8(\"Brand#23\") AND #lineitem.l_quantity >= Decimal128(Some(1000),15,2) AND 
#lineitem.l_quantity <= Decimal128(Some(2000),15,2) AND #part.p_size <= 
Int32(10) OR #part.p_brand = Utf8(\"Brand#34\") AND #lineitem.l_quantity >= 
Decimal128(Some(2000),15,2) AND #lineitem.l_quantity <= 
Decimal128(Some(3000),15,2) AND #part.p_size <= Int32(15) [l_partkey:Int64, 
l_quantity:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
-        "        Inner Join: #lineitem.l_partkey = #part.p_partkey 
[l_partkey:Int64, l_quantity:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8, 
p_size:Int32]",
-        "          Filter: #lineitem.l_quantity >= Decimal128(Some(100),15,2) 
AND #lineitem.l_quantity <= Decimal128(Some(1100),15,2) OR #lineitem.l_quantity 
>= Decimal128(Some(1000),15,2) AND #lineitem.l_quantity <= 
Decimal128(Some(2000),15,2) OR #lineitem.l_quantity >= 
Decimal128(Some(2000),15,2) AND #lineitem.l_quantity <= 
Decimal128(Some(3000),15,2) [l_partkey:Int64, l_quantity:Decimal128(15, 2)]",
-        "            TableScan: lineitem projection=[l_partkey, l_quantity], 
partial_filters=[#lineitem.l_quantity >= Decimal128(Some(100),15,2) AND 
#lineitem.l_quantity <= Decimal128(Some(1100),15,2) OR #lineitem.l_quantity >= 
Decimal128(Some(1000),15,2) AND #lineitem.l_quantity <= 
Decimal128(Some(2000),15,2) OR #lineitem.l_quantity >= 
Decimal128(Some(2000),15,2) AND #lineitem.l_quantity <= 
Decimal128(Some(3000),15,2)] [l_partkey:Int64, l_quantity:Decimal128(15, 2)]",
-        "          Filter: #part.p_size >= Int32(1) AND #part.p_brand = 
Utf8(\"Brand#12\") AND #part.p_size <= Int32(5) OR #part.p_brand = 
Utf8(\"Brand#23\") AND #part.p_size <= Int32(10) OR #part.p_brand = 
Utf8(\"Brand#34\") AND #part.p_size <= Int32(15) [p_partkey:Int64, 
p_brand:Utf8, p_size:Int32]",
-        "            TableScan: part projection=[p_partkey, p_brand, p_size], 
partial_filters=[#part.p_size >= Int32(1), #part.p_brand = Utf8(\"Brand#12\") 
AND #part.p_size <= Int32(5) OR #part.p_brand = Utf8(\"Brand#23\") AND 
#part.p_size <= Int32(10) OR #part.p_brand = Utf8(\"Brand#34\") AND 
#part.p_size <= Int32(15)] [p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
         "  Projection: lineitem.l_partkey [l_partkey:Int64]",
-        "    Filter: part.p_brand = Utf8(\"Brand#12\") AND lineitem.l_quantity 
>= Decimal128(Some(100),15,2) AND lineitem.l_quantity <= 
Decimal128(Some(1100),15,2) AND CAST(part.p_size AS Int64) BETWEEN Int64(1) AND 
Int64(5) OR part.p_brand = Utf8(\"Brand#23\") AND lineitem.l_quantity >= 
Decimal128(Some(1000),15,2) AND lineitem.l_quantity <= 
Decimal128(Some(2000),15,2) AND CAST(part.p_size AS Int64) BETWEEN Int64(1) AND 
Int64(10) OR part.p_brand = Utf8(\"Brand#34\") AND lineitem.l_quantity >= 
Decimal128(Some(2000),15,2) AND lineitem.l_quantity <= 
Decimal128(Some(3000),15,2) AND CAST(part.p_size AS Int64) BETWEEN Int64(1) AND 
Int64(15) [l_partkey:Int64, l_quantity:Decimal128(15, 2), p_partkey:Int64, 
p_brand:Utf8, p_size:Int32]",
+        "    Filter: part.p_brand = Utf8(\"Brand#12\") AND lineitem.l_quantity 
>= Decimal128(Some(100),15,2) AND lineitem.l_quantity <= 
Decimal128(Some(1100),15,2) AND part.p_size <= Int32(5) OR part.p_brand = 
Utf8(\"Brand#23\") AND lineitem.l_quantity >= Decimal128(Some(1000),15,2) AND 
lineitem.l_quantity <= Decimal128(Some(2000),15,2) AND part.p_size <= Int32(10) 
OR part.p_brand = Utf8(\"Brand#34\") AND lineitem.l_quantity >= 
Decimal128(Some(2000),15,2) AND lineitem.l_quantity <= 
Decimal128(Some(3000),15,2) AND part.p_size <= Int32(15) [l_partkey:Int64, 
l_quantity:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
         "      Inner Join: lineitem.l_partkey = part.p_partkey 
[l_partkey:Int64, l_quantity:Decimal128(15, 2), p_partkey:Int64, p_brand:Utf8, 
p_size:Int32]",
-        "        TableScan: lineitem projection=[l_partkey, l_quantity] 
[l_partkey:Int64, l_quantity:Decimal128(15, 2)]",
-        "        TableScan: part projection=[p_partkey, p_brand, p_size] 
[p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
+        "        Projection: lineitem.l_partkey, lineitem.l_quantity 
[l_partkey:Int64, l_quantity:Decimal128(15, 2)]",
+        "          Filter: (lineitem.l_quantity >= 
Decimal128(Some(100),15,2)Decimal128(Some(100),15,2)lineitem.l_quantity AND 
lineitem.l_quantity <= 
Decimal128(Some(1100),15,2)Decimal128(Some(1100),15,2)lineitem.l_quantity OR 
lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)Decimal128(Some(1000),15,2)lineitem.l_quantity AND 
lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)Decimal128(Some(2000),15,2)lineitem.l_quantity OR 
lineitem.l_quantity >= 
Decimal128(Some(2000),15,2)Decimal128(Some(2000),15,2)lineitem.l_quantity AND 
lineitem.l_quantity <= 
Decimal128(Some(3000),15,2)Decimal128(Some(3000),15,2)lineitem.l_quantity) AND 
(lineitem.l_quantity >= Decimal128(Some(100),15,2) OR lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)Decimal128(Some(1000),15,2)lineitem.l_quantitylineitem.l_quantity
 >= Decimal128(Some(100),15,2)Decimal128(Some(100),15,2)lineitem.l_quantity OR 
lineitem.l_quantity >= Decimal128(Some(2000),15,2)Decimal128(Some(20
 00),15,2)lineitem.l_quantity) AND (lineitem.l_quantity >= 
Decimal128(Some(100),15,2) OR lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)Decimal128(Some(1000),15,2)lineitem.l_quantitylineitem.l_quantity
 >= Decimal128(Some(100),15,2)Decimal128(Some(100),15,2)lineitem.l_quantity OR 
lineitem.l_quantity <= 
Decimal128(Some(3000),15,2)Decimal128(Some(3000),15,2)lineitem.l_quantity) AND 
(lineitem.l_quantity >= Decimal128(Some(100),15,2) OR lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)Decimal128(Some(2000),15,2)lineitem.l_quantitylineitem.l_quantity
 >= Decimal128(Some(100),15,2)Decimal128(Some(100),15,2)lineitem.l_quantity OR 
lineitem.l_quantity >= 
Decimal128(Some(2000),15,2)Decimal128(Some(2000),15,2)lineitem.l_quantity) AND 
(lineitem.l_quantity >= Decimal128(Some(100),15,2) OR lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)Decimal12
 8(Some(2000),15,2)lineitem.l_quantitylineitem.l_quantity >= 
Decimal128(Some(100),15,2)Decimal128(Some(100),15,2)lineitem.l_quantity OR 
lineitem.l_quantity <= 
Decimal128(Some(3000),15,2)Decimal128(Some(3000),15,2)lineitem.l_quantity) AND 
(lineitem.l_quantity <= Decimal128(Some(1100),15,2) OR lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)Decimal128(Some(1000),15,2)lineitem.l_quantitylineitem.l_quantity
 <= Decimal128(Some(1100),15,2)Decimal128(Some(1100),15,2)lineitem.l_quantity 
OR lineitem.l_quantity >= 
Decimal128(Some(2000),15,2)Decimal128(Some(2000),15,2)lineitem.l_quantity) AND 
(lineitem.l_quantity <= Decimal128(Some(1100),15,2) OR lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)Decimal128(Some(1000),15,2)lineitem.l_quantitylineitem.l_quantity
 <= Decimal128(Some(1100),15,2)Decimal128(Some(1100),15,2)lineitem.l_quantity 
OR lineitem.l_quantity <= Decimal128(Some(3000),15,2)Decima
 l128(Some(3000),15,2)lineitem.l_quantity) AND (lineitem.l_quantity <= 
Decimal128(Some(1100),15,2) OR lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)Decimal128(Some(2000),15,2)lineitem.l_quantitylineitem.l_quantity
 <= Decimal128(Some(1100),15,2)Decimal128(Some(1100),15,2)lineitem.l_quantity 
OR lineitem.l_quantity >= 
Decimal128(Some(2000),15,2)Decimal128(Some(2000),15,2)lineitem.l_quantity) AND 
(lineitem.l_quantity <= Decimal128(Some(1100),15,2) OR lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)Decimal128(Some(2000),15,2)lineitem.l_quantitylineitem.l_quantity
 <= Decimal128(Some(1100),15,2)Decimal128(Some(1100),15,2)lineitem.l_quantity 
OR lineitem.l_quantity <= 
Decimal128(Some(3000),15,2)Decimal128(Some(3000),15,2)lineitem.l_quantity) 
[lineitem.l_quantity <= Decimal128(Some(1100),15,2) OR lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)lineitem.l_quantity <= Decimal128(Some(2000)
 ,15,2)Decimal128(Some(2000),15,2)lineitem.l_quantitylineitem.l_quantity <= 
Decimal128(Some(1100),15,2)Decimal128(Some(1100),15,2)lineitem.l_quantity:Boolean;N,
 lineitem.l_quantity <= Decimal128(Some(1100),15,2) OR lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)Decimal128(Some(1000),15,2)lineitem.l_quantitylineitem.l_quantity
 <= 
Decimal128(Some(1100),15,2)Decimal128(Some(1100),15,2)lineitem.l_quantity:Boolean;N,
 lineitem.l_quantity <= 
Decimal128(Some(1100),15,2)Decimal128(Some(1100),15,2)lineitem.l_quantity:Boolean;N,
 lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)Decimal128(Some(2000),15,2)lineitem.l_quantity:Boolean;N,
 lineitem.l_quantity <= 
Decimal128(Some(3000),15,2)Decimal128(Some(3000),15,2)lineitem.l_quantity:Boolean;N,
 lineitem.l_quantity >= Decimal128(Some(100),15,2) OR lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)lineitem.l_quantity <= 
Decimal128(Some(2000),15,2)Decimal128(Some(2000),15,2)lineitem.l_quantitylineit
 em.l_quantity >= 
Decimal128(Some(100),15,2)Decimal128(Some(100),15,2)lineitem.l_quantity:Boolean;N,
 lineitem.l_quantity >= Decimal128(Some(100),15,2) OR lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)Decimal128(Some(1000),15,2)lineitem.l_quantitylineitem.l_quantity
 >= 
Decimal128(Some(100),15,2)Decimal128(Some(100),15,2)lineitem.l_quantity:Boolean;N,
 lineitem.l_quantity >= 
Decimal128(Some(100),15,2)Decimal128(Some(100),15,2)lineitem.l_quantity:Boolean;N,
 lineitem.l_quantity >= 
Decimal128(Some(1000),15,2)Decimal128(Some(1000),15,2)lineitem.l_quantity:Boolean;N,
 lineitem.l_quantity >= 
Decimal128(Some(2000),15,2)Decimal128(Some(2000),15,2)lineitem.l_quantity:Boolean;N,
 l_partkey:Int64, l_quantity:Decimal128(15, 2)]",

Review Comment:
   yes, seems not readable, maybe we can try to keep both input and result only 
show the input one 🤔 
   



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