You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/07/28 16:35:54 UTC

[GitHub] [iceberg] Reo-LEI commented on a change in pull request #2862: Flink: Enrich flink actions

Reo-LEI commented on a change in pull request #2862:
URL: https://github.com/apache/iceberg/pull/2862#discussion_r678471846



##########
File path: flink/src/main/java/org/apache/iceberg/flink/actions/FlinkActions.java
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed 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.iceberg.flink.actions;
+
+import com.twitter.chill.java.ClosureSerializer;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.configuration.CoreOptions;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.actions.ActionsProvider;
+import org.apache.iceberg.actions.ExpireSnapshots;
+
+public class FlinkActions implements ActionsProvider {
+
+  private static final Configuration CONFIG = new Configuration()
+      // disable classloader check as Avro may cache class/object in the serializers.
+      .set(CoreOptions.CHECK_LEAKED_CLASSLOADER, false);
+
+  private final StreamExecutionEnvironment env;
+
+  private FlinkActions(StreamExecutionEnvironment env) {
+    // register ClosureSerializer to prevent NPE when Kryo serialize lambda expr(e.g. HadoopFileIO.hadoopConf)
+    env.getConfig().registerTypeWithKryoSerializer(ClosureSerializer.Closure.class, ClosureSerializer.class);

Review comment:
       I fix the NPE of kryo by register `ClosureSerializer` to flink, cuz Kryo serialize lambda use `ClosureSerializer.Closure`, but not register serialize for this class. I think that is a bug for Kryo or Flink. I hope that can help you @kbendick 




-- 
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@iceberg.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org