godfreyhe commented on a change in pull request #8764: [FLINK-12798][table-planner][table-api-java] Port TableEnvironment to table-api-java module URL: https://github.com/apache/flink/pull/8764#discussion_r294254584
########## File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/PlannerFactory.java ########## @@ -0,0 +1,69 @@ +/* + * 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.flink.table.api.internal; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.table.api.TableConfig; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.catalog.CatalogManager; +import org.apache.flink.table.catalog.FunctionCatalog; +import org.apache.flink.table.executor.Executor; +import org.apache.flink.table.planner.Planner; + +import java.lang.reflect.Constructor; + +/** + * Factory to construct a {@link Planner}. It will look for the planner on the classpath. + */ +@Internal +public final class PlannerFactory { + + /** + * Looks up {@link Planner} on the class path via reflection. + * + * @param executor The executor required by the planner. + * @param tableConfig The configuration of the planner to use. + * @param functionCatalog The function catalog to look up user defined functions. + * @param catalogManager The catalog manager to look up tables and views. + * @return instance of a {@link Planner} + */ + public static Planner lookupPlanner( + Executor executor, + TableConfig tableConfig, + FunctionCatalog functionCatalog, + CatalogManager catalogManager) { + try { + Class<?> clazz = Class.forName("org.apache.flink.table.planner.StreamPlanner"); Review comment: in blink-planner, there are batch planner and stream planner, that means batch planner should extend `org.apache.flink.table.planner.StreamPlanner`. it's a little strange from blink side. choose another common name ? and in blink-planner, how to distinguish between batch job and stream job ? In [FLIP-32](https://cwiki.apache.org/confluence/display/FLINK/FLIP-32%3A+Restructure+flink-table+for+future+contributions), a flag will be added in `TableConfig`, does this PR involve this? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
