Hi All, I am very new to Calcite so please bear with me if I ask questions that were already answered or do not make much sense.
Let say we have an inner join of two partitioned tables on their respective partitioning columns SELECT * FROM P1 JOIN P2 ON P1.ID <http://p1.id/> = P2.ID <http://p2.id/>; where P1.ID <http://p1.id/> and P2.ID <http://p2.id/> are partitioning columns for P1 and P2 tables. In our physical domain a scan over a partitioned table must have an additional relation above it (let say, VoltSend) which would consolidate the results from multiple partitions and send them upstream for further processing so the whole tree looks like LogicalProject | Logical Join / \ VoltSend VoltSend | | VoltTableScan VoltTableScan My goal is to simplify the above tree by pulling up both Send nodes above the Join node (if certain conditions are met like the join is on both partitioning columns) to look like this: VoltProject | VoltSend | VoltJoin / \ VoltTableScan VoltTableScan I have written a transformation rule that matches the original join and its VoltSend children and transforms it into a VoltSend -> VoltJoin sub-tree and I can see (in the debugger) that the rule is firing but the final result does not reflect it. I suspect that the reason for that has something to do with the cost of the transformed tree but I can't figure out a proper way to lower it so the optimizer would pick the new tree over the original one. Does my guess make sense to your or am I completely wrong? Is there any other way (besides costing) to make sure that one plan is chosen over another? Your input is greatly appreciated, Mike
