You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by dw...@apache.org on 2018/10/29 10:29:17 UTC

[flink] 01/02: [FLINK-10675][sql-client][table] Fixed depdency issues in cep & table/sql-client integration

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

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

commit 22ac4ea14498c29a7360defd01185c6f15443238
Author: Dawid Wysakowicz <dw...@apache.org>
AuthorDate: Thu Oct 25 10:07:29 2018 +0200

    [FLINK-10675][sql-client][table] Fixed depdency issues in cep & table/sql-client integration
    
    Sql-client depends table api which results that table-api is included in
    the classloader of sql-client. As table api extends some interfaces from
    cep library for MATCH_RECOGNIZE it has to be in the same classloader as
    cep library, therefore we need to add dependency on cep to sql-client as
    well.
    
    As cep library may be in user classloader, we should use that
    classloader for checking presence of cep library.
---
 flink-libraries/flink-sql-client/pom.xml                          | 7 +++++++
 .../flink/table/plan/rules/datastream/DataStreamMatchRule.scala   | 8 +++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/flink-libraries/flink-sql-client/pom.xml b/flink-libraries/flink-sql-client/pom.xml
index 68ec718..b7b21f8 100644
--- a/flink-libraries/flink-sql-client/pom.xml
+++ b/flink-libraries/flink-sql-client/pom.xml
@@ -64,6 +64,12 @@ under the License.
 			<version>${project.version}</version>
 		</dependency>
 
+		<dependency>
+			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-cep_2.11</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+
 		<!-- logging utilities -->
 		<dependency>
 			<groupId>org.slf4j</groupId>
@@ -156,6 +162,7 @@ under the License.
 										<include>org/apache/calcite/**</include>
 										<include>org/apache/flink/calcite/shaded/**</include>
 										<include>org/apache/flink/table/**</include>
+										<include>org/apache/flink/cep/**</include>
 										<include>org.codehaus.commons.compiler.properties</include>
 										<include>org/codehaus/janino/**</include>
 										<include>org/codehaus/commons/**</include>
diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/datastream/DataStreamMatchRule.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/datastream/DataStreamMatchRule.scala
index bbebc73..5b0aa65 100644
--- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/datastream/DataStreamMatchRule.scala
+++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/datastream/DataStreamMatchRule.scala
@@ -42,11 +42,13 @@ class DataStreamMatchRule
       RelOptRule.convert(logicalMatch.getInput, FlinkConventions.DATASTREAM)
 
     try {
-      Class.forName("org.apache.flink.cep.pattern.Pattern")
+      Class
+        .forName("org.apache.flink.cep.pattern.Pattern",
+          false,
+          Thread.currentThread().getContextClassLoader)
     } catch {
       case ex: ClassNotFoundException => throw new TableException(
-        "MATCH RECOGNIZE clause requires flink-cep dependency to be present on the classpath.",
-        ex)
+        "MATCH RECOGNIZE clause requires flink-cep dependency to be present on the classpath.", ex)
     }
 
     new DataStreamMatch(