ihuzenko commented on issue #1488: DRILL-786: Allow CROSS JOIN syntax
URL: https://github.com/apache/drill/pull/1488#issuecomment-434703183
 
 
   Hi @amansinha100 . Thanks for your active involvement, I investigated the 
issue and found that:
   
   when option `planner.slice_target` is set to low value, then StreamAggPrule 
at the first match will try to create 2 phase plan, but method 
call.transformTo(newRel) won't be called (means that rule results are ignored), 
because the rule matches at the very early stage of physical planning, there 
aren't rels matched by new traitSet with physical convention. Currently for 
simple cross join query with aggregate function, physical rules are applied in 
order, which is wrong and results into PlanningException:
   
   Prel.ScreenPrule
   Prel.ScreenPrule
   Prel.ScanPrule
   Prel.ScanPrule
   ProjectPrule
   ProjectPrule
   Prel.NestedLoopJoinPrule
   ExpandConversionRule
   ExpandConversionRule ....
   
   The problem may be fixed either by returning false from 
StreamAggPrule.create2PhasePlan(call, aggregate) for cross join queries, so 
then StreamAggPrule will be applied successfully at early stage. Or another 
option is to change NestedLoopJoinPrule left and join node's distribution trait 
from ANY to SINGLETON, which then results in activation of ProjectPrule -> 
StreamAggPrule etc. So then StreamAggPrule is activated again, but now at the 
right stage when it can be applied successfully.
   
   @vvysotskyi  suggests to proceed with second option, but in order to do this 
I need to investigate more about how changing of the distribution traits for 
NestedLoopJoinPrule left and join node impacts physical planning. And then, if 
possible, try to activate necessary rules without distribution trait change.
   
   @amansinha100 I'd appreciate if you could share your thoughts about the 
options.  

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to