ygf11 commented on code in PR #4866:
URL: https://github.com/apache/arrow-datafusion/pull/4866#discussion_r1066695239


##########
datafusion/core/tests/sql/predicates.rs:
##########
@@ -588,12 +588,11 @@ async fn multiple_or_predicates() -> Result<()> {
     let expected = vec![
         "Explain [plan_type:Utf8, plan:Utf8]",
         "  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 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_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)) AND part.p_size 
>= Int32(1) [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]",
+        "    Inner Join: lineitem.l_partkey = part.p_partkey 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]",

Review Comment:
   Sorry, it's a little different from you comment.
   
   I think both are correct, because the above expression is only related to 
`part`(`part` is one of the input).
   But I prefer join filter, because our physical join executor support it, 
although the above expression will push down.
   
   Do you have any concern? could you explain more?
   
    



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