You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "xintongsong (via GitHub)" <gi...@apache.org> on 2023/09/07 07:07:24 UTC

[GitHub] [flink] xintongsong commented on a diff in pull request #23058: [FLINK-32978] Deprecate RichFunction#open(Configuration parameters)

xintongsong commented on code in PR #23058:
URL: https://github.com/apache/flink/pull/23058#discussion_r1318172197


##########
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/conditions/RichIterativeCondition.java:
##########
@@ -67,7 +67,12 @@ public IterationRuntimeContext getIterationRuntimeContext() {
     // --------------------------------------------------------------------------------------------
 
     @Override
-    public void open(Configuration parameters) throws Exception {}
+    public void open(OpenContext openContext) throws Exception {}
+
+    @Override
+    public void open(Configuration parameters) throws Exception {
+        throw new UnsupportedOperationException();

Review Comment:
   Better explain why this is unsupported with an error message



##########
flink-libraries/flink-state-processing-api/src/main/java/org/apache/flink/state/api/input/operator/StateReaderOperator.java:
##########
@@ -103,7 +103,7 @@ protected final InternalTimerService<N> getInternalTimerService(String name) {
     }
 
     public void open() throws Exception {
-        FunctionUtils.openFunction(function, new Configuration());
+        FunctionUtils.openFunction(function, new OpenContext() {});

Review Comment:
   We'd better provide a default implementation for `OpenContext`.



##########
flink-core/src/main/java/org/apache/flink/configuration/OpenContext.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.configuration;
+
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.api.common.functions.RichFunction;
+
+/**
+ * The {@link OpenContext} interface provides the necessary information required by the {@link
+ * RichFunction} when it is opened. Additional methods will be added to this interface in the future
+ * to provide more components from the context.
+ */
+@PublicEvolving
+public interface OpenContext {}

Review Comment:
   This doesn't explain why the interface is empty now.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org