You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/06/17 14:50:22 UTC

[GitHub] [flink] dawidwys commented on a change in pull request #8764: [FLINK-12798][table-planner][table-api-java] Port TableEnvironment to table-api-java module

dawidwys 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_r294337078
 
 

 ##########
 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:
   No, as you can read in this PR description it is not possible to change the `Planner` in this PR. This is the legacy planner implementation that is hardcoded. Planner discovery will be introduced in a subsequent PR.
   
   Yes you are right you should distinguish based on that flag in a `TableConfig` (most probably), this will be also part of the `Planner` discovery. This PR focuses only on supporting what we had so far, but with `TableEnvironments` at the right locations.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services