kgyrtkirk commented on code in PR #15073: URL: https://github.com/apache/druid/pull/15073#discussion_r1347650926
########## sql/src/main/java/org/apache/druid/sql/calcite/rule/DruidJoinWithUnnestOnLeftRule.java: ########## @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.sql.calcite.rule; + +import org.apache.calcite.plan.RelOptRule; +import org.apache.calcite.plan.RelOptRuleCall; +import org.apache.calcite.rel.core.Join; +import org.apache.druid.sql.calcite.planner.PlannerContext; +import org.apache.druid.sql.calcite.rel.DruidJoinUnnestRel; +import org.apache.druid.sql.calcite.rel.DruidRel; +import org.apache.druid.sql.calcite.rel.DruidUnnestRel; + +public class DruidJoinWithUnnestOnLeftRule extends RelOptRule +{ + private final PlannerContext plannerContext; + + public DruidJoinWithUnnestOnLeftRule(PlannerContext plannerContext1) + { + super( + operand( + Join.class, + operand(DruidUnnestRel.class, any()), Review Comment: I wonder if it would be possible to leave the other rule alone; and match on the following in this rule: match on: ``` operand(Join.class, operand(Join.class, operand(DruidUnnestRel.class, any() ), operand(DruidRel.class, any()) ), DruidRel.class ) ``` and after that create the new plan here with the desired layout - that way the index shifter could also be moved into this class - and the new Rel-type would not be needed; I'm not sure how other rules could react in case that reltype remains in the plan for some reason. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
