aljoscha commented on a change in pull request #8852: [FLINK-12798][table-api][table-planner] Add a proper discover mechanism that will enable switching between Flink & Blink Planner/Executor URL: https://github.com/apache/flink/pull/8852#discussion_r297189136
########## File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/descriptors/PlannerDescriptor.java ########## @@ -0,0 +1,102 @@ +/* + * 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.descriptors; + +import org.apache.flink.annotation.VisibleForTesting; +import org.apache.flink.table.delegation.Executor; +import org.apache.flink.table.delegation.Planner; + +import javax.annotation.Nullable; + +import java.util.Map; + +/** + * Common class that defines necessary properties to choose and create both + * {@link Executor} and {@link Planner}. + */ +public class PlannerDescriptor { + public static final String BATCH_MODE = "batch-mode"; + public static final String CLASS_NAME = "class-name"; + + private final DescriptorProperties commonProperties = new DescriptorProperties(); + private final String plannerClass; + private final String executorClass; + + @VisibleForTesting + private PlannerDescriptor(@Nullable String plannerClass, @Nullable String executorClass) { + this.plannerClass = plannerClass; + this.executorClass = executorClass; + } + + /** + * Sets the legacy planner as the required module. + */ + public static PlannerDescriptor legacy() { Review comment: I don't like the hardcoded methods to much because it basically links the descriptor tightly to the planners at the time when this was created. `legacy()` will be outdated soon, and then `blink()` will be outdated as well. An alternative could be a method `planner(Class<? extends Planner> planner)` and `planner(String plannerClass)`. What do you think? With this, `any()` could also be renamed to `create()`, which would then roughly yield: ``` PlannerDescriptor desscriptor = PlannerDescriptor.create() .planner(StreamPlannerFactory.class) .executor(...) .batch() ``` I realize that calling planner and executor is a bit wordy, though... 😓 ---------------------------------------------------------------- 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
