walterddr commented on a change in pull request #8340: URL: https://github.com/apache/pinot/pull/8340#discussion_r830069740
########## File path: pinot-query-planner/src/main/java/org/apache/pinot/query/QueryEnvironment.java ########## @@ -0,0 +1,156 @@ +/** + * 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.pinot.query; + +import java.util.Collection; +import org.apache.calcite.jdbc.CalciteSchema; +import org.apache.calcite.plan.Contexts; +import org.apache.calcite.plan.RelOptCluster; +import org.apache.calcite.plan.RelOptPlanner; +import org.apache.calcite.plan.RelOptRule; +import org.apache.calcite.plan.RelOptUtil; +import org.apache.calcite.plan.hep.HepProgramBuilder; +import org.apache.calcite.prepare.CalciteCatalogReader; +import org.apache.calcite.prepare.PlannerImpl; +import org.apache.calcite.prepare.Prepare; +import org.apache.calcite.rel.RelNode; +import org.apache.calcite.rel.RelRoot; +import org.apache.calcite.rel.type.RelDataTypeFactory; +import org.apache.calcite.rex.RexBuilder; +import org.apache.calcite.sql.SqlKind; +import org.apache.calcite.sql.SqlNode; +import org.apache.calcite.sql.fun.SqlStdOperatorTable; +import org.apache.calcite.sql.validate.SqlValidator; +import org.apache.calcite.sql2rel.SqlToRelConverter; +import org.apache.calcite.sql2rel.StandardConvertletTable; +import org.apache.calcite.tools.FrameworkConfig; +import org.apache.calcite.tools.Frameworks; +import org.apache.pinot.query.context.PlannerContext; +import org.apache.pinot.query.parser.CalciteSqlParser; +import org.apache.pinot.query.planner.LogicalPlanner; +import org.apache.pinot.query.planner.QueryPlan; +import org.apache.pinot.query.planner.StagePlanner; +import org.apache.pinot.query.routing.WorkerManager; +import org.apache.pinot.query.rules.PinotQueryRuleSets; +import org.apache.pinot.query.type.TypeFactory; +import org.apache.pinot.query.validate.Validator; + + +/** + * The {@code QueryEnvironment} contains the main entrypoint for query planning. Review comment: this actually is a good question on a 2nd thought. some of the components are actually not reusable. let me rethink this design ########## File path: pinot-query-planner/src/main/java/org/apache/pinot/query/QueryEnvironment.java ########## @@ -0,0 +1,156 @@ +/** + * 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.pinot.query; + +import java.util.Collection; +import org.apache.calcite.jdbc.CalciteSchema; +import org.apache.calcite.plan.Contexts; +import org.apache.calcite.plan.RelOptCluster; +import org.apache.calcite.plan.RelOptPlanner; +import org.apache.calcite.plan.RelOptRule; +import org.apache.calcite.plan.RelOptUtil; +import org.apache.calcite.plan.hep.HepProgramBuilder; +import org.apache.calcite.prepare.CalciteCatalogReader; +import org.apache.calcite.prepare.PlannerImpl; +import org.apache.calcite.prepare.Prepare; +import org.apache.calcite.rel.RelNode; +import org.apache.calcite.rel.RelRoot; +import org.apache.calcite.rel.type.RelDataTypeFactory; +import org.apache.calcite.rex.RexBuilder; +import org.apache.calcite.sql.SqlKind; +import org.apache.calcite.sql.SqlNode; +import org.apache.calcite.sql.fun.SqlStdOperatorTable; +import org.apache.calcite.sql.validate.SqlValidator; +import org.apache.calcite.sql2rel.SqlToRelConverter; +import org.apache.calcite.sql2rel.StandardConvertletTable; +import org.apache.calcite.tools.FrameworkConfig; +import org.apache.calcite.tools.Frameworks; +import org.apache.pinot.query.context.PlannerContext; +import org.apache.pinot.query.parser.CalciteSqlParser; +import org.apache.pinot.query.planner.LogicalPlanner; +import org.apache.pinot.query.planner.QueryPlan; +import org.apache.pinot.query.planner.StagePlanner; +import org.apache.pinot.query.routing.WorkerManager; +import org.apache.pinot.query.rules.PinotQueryRuleSets; +import org.apache.pinot.query.type.TypeFactory; +import org.apache.pinot.query.validate.Validator; + + +/** + * The {@code QueryEnvironment} contains the main entrypoint for query planning. Review comment: it should be created once per compile instance. but yeah let me update the documentation ########## File path: pinot-query-planner/src/main/java/org/apache/pinot/query/QueryEnvironment.java ########## @@ -0,0 +1,156 @@ +/** + * 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.pinot.query; + +import java.util.Collection; +import org.apache.calcite.jdbc.CalciteSchema; +import org.apache.calcite.plan.Contexts; +import org.apache.calcite.plan.RelOptCluster; +import org.apache.calcite.plan.RelOptPlanner; +import org.apache.calcite.plan.RelOptRule; +import org.apache.calcite.plan.RelOptUtil; +import org.apache.calcite.plan.hep.HepProgramBuilder; +import org.apache.calcite.prepare.CalciteCatalogReader; +import org.apache.calcite.prepare.PlannerImpl; +import org.apache.calcite.prepare.Prepare; +import org.apache.calcite.rel.RelNode; +import org.apache.calcite.rel.RelRoot; +import org.apache.calcite.rel.type.RelDataTypeFactory; +import org.apache.calcite.rex.RexBuilder; +import org.apache.calcite.sql.SqlKind; +import org.apache.calcite.sql.SqlNode; +import org.apache.calcite.sql.fun.SqlStdOperatorTable; +import org.apache.calcite.sql.validate.SqlValidator; +import org.apache.calcite.sql2rel.SqlToRelConverter; +import org.apache.calcite.sql2rel.StandardConvertletTable; +import org.apache.calcite.tools.FrameworkConfig; +import org.apache.calcite.tools.Frameworks; +import org.apache.pinot.query.context.PlannerContext; +import org.apache.pinot.query.parser.CalciteSqlParser; +import org.apache.pinot.query.planner.LogicalPlanner; +import org.apache.pinot.query.planner.QueryPlan; +import org.apache.pinot.query.planner.StagePlanner; +import org.apache.pinot.query.routing.WorkerManager; +import org.apache.pinot.query.rules.PinotQueryRuleSets; +import org.apache.pinot.query.type.TypeFactory; +import org.apache.pinot.query.validate.Validator; + + +/** + * The {@code QueryEnvironment} contains the main entrypoint for query planning. + * + * <p>It provide the higher level entry interface to convert a SQL string into a {@link QueryPlan}. + */ +public class QueryEnvironment { Review comment: the reason why I called it environment is because it holds some stateful info during the planning and it is not stateless. but let me think more on the naming for this (and javadoc) -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org