DhamoPS commented on code in PR #3334:
URL: https://github.com/apache/arrow-datafusion/pull/3334#discussion_r963686945


##########
datafusion/core/tests/sql/predicates.rs:
##########
@@ -427,11 +427,10 @@ async fn multiple_or_predicates() -> Result<()> {
     let expected =vec![
         "Explain [plan_type:Utf8, plan:Utf8]",
         "  Projection: #lineitem.l_partkey [l_partkey:Int64]",
-        "    Projection: #part.p_partkey = #lineitem.l_partkey AS 
BinaryExpr-=Column-lineitem.l_partkeyColumn-part.p_partkey, 
#lineitem.l_partkey, #lineitem.l_quantity, #part.p_brand, #part.p_size 
[BinaryExpr-=Column-lineitem.l_partkeyColumn-part.p_partkey:Boolean;N, 
l_partkey:Int64, l_quantity:Float64, p_brand:Utf8, p_size:Int32]",
-        "      Filter: #part.p_partkey = #lineitem.l_partkey AND #part.p_brand 
= Utf8(\"Brand#12\") AND #lineitem.l_quantity >= Int64(1) AND 
#lineitem.l_quantity <= Int64(11) AND #part.p_size BETWEEN Int64(1) AND 
Int64(5) OR #part.p_brand = Utf8(\"Brand#23\") AND #lineitem.l_quantity >= 
Int64(10) AND #lineitem.l_quantity <= Int64(20) AND #part.p_size BETWEEN 
Int64(1) AND Int64(10) OR #part.p_brand = Utf8(\"Brand#34\") AND 
#lineitem.l_quantity >= Int64(20) AND #lineitem.l_quantity <= Int64(30) AND 
#part.p_size BETWEEN Int64(1) AND Int64(15) [l_partkey:Int64, 
l_quantity:Float64, p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
-        "        CrossJoin: [l_partkey:Int64, l_quantity:Float64, 
p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
-        "          TableScan: lineitem projection=[l_partkey, l_quantity] 
[l_partkey:Int64, l_quantity:Float64]",
-        "          TableScan: part projection=[p_partkey, p_brand, p_size] 
[p_partkey:Int64, p_brand:Utf8, p_size:Int32]",
+        "    Filter: #part.p_brand = Utf8(\"Brand#12\") AND 
#lineitem.l_quantity >= Int64(1) AND #lineitem.l_quantity <= Int64(11) AND 
#part.p_size BETWEEN Int64(1) AND Int64(5) OR #part.p_brand = 
Utf8(\"Brand#23\") AND #lineitem.l_quantity >= Int64(10) AND 
#lineitem.l_quantity <= Int64(20) AND #part.p_size BETWEEN Int64(1) AND 
Int64(10) OR #part.p_brand = Utf8(\"Brand#34\") AND #lineitem.l_quantity >= 
Int64(20) AND #lineitem.l_quantity <= Int64(30) AND #part.p_size BETWEEN 
Int64(1) AND Int64(15) [l_partkey:Int64, l_quantity:Float64, p_partkey:Int64, 
p_brand:Utf8, p_size:Int32]",

Review Comment:
   @alamb I have checked the #2858. Even though, it would help in handling of 
disjunctive predicates, it does not solve the problem of #78. I understand that 
we need to write these rules in optimizer.rs, so that it would be applicable 
for DATAFRAME API plans as well. 
   I would convert my fix into optimizer rule as suggested. CrossJoins must be 
converted to InnerJoins if there is one or more common predicates between those 
tables.



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