You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by he...@apache.org on 2020/03/10 03:08:09 UTC

[flink] branch master updated: [FLINK-16273][python] Set io.netty.tryReflectionSetAccessible to true by default (#11341)

This is an automated email from the ASF dual-hosted git repository.

hequn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new f21fa96  [FLINK-16273][python] Set io.netty.tryReflectionSetAccessible to true by default (#11341)
f21fa96 is described below

commit f21fa9675b15b8a9673fa529a1d368427f846161
Author: Dian Fu <di...@apache.org>
AuthorDate: Tue Mar 10 11:07:44 2020 +0800

    [FLINK-16273][python] Set io.netty.tryReflectionSetAccessible to true by default (#11341)
---
 .../arrow/AbstractArrowPythonScalarFunctionRunner.java       | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/flink-python/src/main/java/org/apache/flink/table/runtime/runners/python/scalar/arrow/AbstractArrowPythonScalarFunctionRunner.java b/flink-python/src/main/java/org/apache/flink/table/runtime/runners/python/scalar/arrow/AbstractArrowPythonScalarFunctionRunner.java
index 033d8d7..80f7ded 100644
--- a/flink-python/src/main/java/org/apache/flink/table/runtime/runners/python/scalar/arrow/AbstractArrowPythonScalarFunctionRunner.java
+++ b/flink-python/src/main/java/org/apache/flink/table/runtime/runners/python/scalar/arrow/AbstractArrowPythonScalarFunctionRunner.java
@@ -46,6 +46,18 @@ public abstract class AbstractArrowPythonScalarFunctionRunner<IN> extends Abstra
 
 	private static final String SCHEMA_ARROW_CODER_URN = "flink:coder:schema:scalar_function:arrow:v1";
 
+	static {
+		// Arrow requires the property io.netty.tryReflectionSetAccessible to
+		// be set to true for JDK >= 9. Please refer to ARROW-5412 for more details.
+		if (System.getProperty("io.netty.tryReflectionSetAccessible") == null) {
+			System.setProperty("io.netty.tryReflectionSetAccessible", "true");
+		} else if (!io.netty.util.internal.PlatformDependent.hasDirectBufferNoCleanerConstructor()) {
+			throw new RuntimeException("Vectorized Python UDF depends on " +
+				"DirectByteBuffer.<init>(long, int) which is not available. Please set the " +
+				"system property 'io.netty.tryReflectionSetAccessible' to 'true'.");
+		}
+	}
+
 	/**
 	 * Max number of elements to include in an arrow batch.
 	 */