Timm0 commented on code in PR #29659:
URL: https://github.com/apache/flink/pull/29659#discussion_r4456516120
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/delegation/materializedtable/DefaultMaterializedTableExecutor.java:
##########
@@ -100,148 +90,118 @@
import static org.apache.flink.api.common.RuntimeExecutionMode.BATCH;
import static org.apache.flink.api.common.RuntimeExecutionMode.STREAMING;
-import static
org.apache.flink.configuration.CheckpointingOptions.SAVEPOINT_DIRECTORY;
-import static org.apache.flink.configuration.DeploymentOptions.TARGET;
import static org.apache.flink.configuration.ExecutionOptions.RUNTIME_MODE;
import static org.apache.flink.configuration.PipelineOptions.NAME;
-import static
org.apache.flink.configuration.PipelineOptionsInternal.PIPELINE_FIXED_JOB_ID;
import static
org.apache.flink.configuration.StateRecoveryOptions.SAVEPOINT_PATH;
import static
org.apache.flink.table.api.config.MaterializedTableConfigOptions.DATE_FORMATTER;
import static
org.apache.flink.table.api.config.MaterializedTableConfigOptions.PARTITION_FIELDS;
import static
org.apache.flink.table.api.config.MaterializedTableConfigOptions.SCHEDULE_TIME_DATE_FORMATTER_DEFAULT;
import static
org.apache.flink.table.api.internal.TableResultInternal.TABLE_RESULT_OK;
import static
org.apache.flink.table.catalog.CatalogBaseTable.TableKind.MATERIALIZED_TABLE;
import static
org.apache.flink.table.catalog.IntervalFreshness.convertFreshnessToCron;
-import static
org.apache.flink.table.factories.WorkflowSchedulerFactoryUtil.WORKFLOW_SCHEDULER_PREFIX;
-import static
org.apache.flink.table.gateway.api.endpoint.SqlGatewayEndpointFactoryUtils.getEndpointConfig;
-import static
org.apache.flink.table.gateway.service.utils.Constants.CLUSTER_INFO;
-import static org.apache.flink.table.gateway.service.utils.Constants.JOB_ID;
import static
org.apache.flink.table.utils.DateTimeUtils.formatTimestampStringWithOffset;
-/** Manager is responsible for execute the {@link MaterializedTableOperation}.
*/
+/** Default executor for {@link MaterializedTableOperation}s. */
@Internal
-public class MaterializedTableManager {
-
- private static final Logger LOG =
LoggerFactory.getLogger(MaterializedTableManager.class);
-
- private final URLClassLoader userCodeClassLoader;
-
- private final @Nullable WorkflowScheduler<? extends RefreshHandler>
workflowScheduler;
-
- private final String restEndpointUrl;
-
- public MaterializedTableManager(
- Configuration configuration, URLClassLoader userCodeClassLoader) {
- this.userCodeClassLoader = userCodeClassLoader;
- this.restEndpointUrl = buildRestEndpointUrl(configuration);
- this.workflowScheduler = buildWorkflowScheduler(configuration,
userCodeClassLoader);
- }
-
- private String buildRestEndpointUrl(Configuration configuration) {
- Configuration restEndpointConfig =
- Configuration.fromMap(
- getEndpointConfig(configuration,
SqlGatewayRestEndpointFactory.IDENTIFIER));
- String address = restEndpointConfig.get(SqlGatewayRestOptions.ADDRESS);
- int port = restEndpointConfig.get(SqlGatewayRestOptions.PORT);
-
- return String.format("http://%s:%s", address, port);
- }
-
- private WorkflowScheduler<? extends RefreshHandler> buildWorkflowScheduler(
- Configuration configuration, URLClassLoader userCodeClassLoader) {
- return WorkflowSchedulerFactoryUtil.createWorkflowScheduler(
- configuration, userCodeClassLoader);
- }
-
- public void open() throws Exception {
- if (workflowScheduler != null) {
- workflowScheduler.open();
- }
+public class DefaultMaterializedTableExecutor implements
MaterializedTableExecutor {
Review Comment:
I removed the additional failure handling. I'll create a separate ticket for
the failure handling and add it in a follow-up PR.
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/delegation/materializedtable/RefreshJobControllerTest.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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.planner.delegation.materializedtable;
+
+import org.apache.flink.api.common.JobID;
+import org.apache.flink.api.common.JobStatus;
+import org.apache.flink.api.dag.Pipeline;
+import org.apache.flink.client.deployment.StandaloneClusterId;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.core.execution.JobClient;
+import org.apache.flink.core.execution.JobRetrievalSupportedPipelineExecutor;
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.refresh.ContinuousRefreshHandler;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Tests for {@link RefreshJobController}. */
+class RefreshJobControllerTest {
Review Comment:
Done
--
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]