Skip to content

Commit c079c95

Browse files
authored
Override RexNodeJsonDeserializer until loading PTFs via compiled plan is patched in Flink (#278)
1 parent c8ed73d commit c079c95

4 files changed

Lines changed: 669 additions & 4 deletions

File tree

flink-sql-runner/pom.xml

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,17 @@
5151
<scope>provided</scope>
5252
</dependency>
5353

54+
<!-- TODO: Switch back to planner loader when PTF loading is patched upstream. -->
55+
<!-- <dependency>-->
56+
<!-- <groupId>org.apache.flink</groupId>-->
57+
<!-- <artifactId>flink-table-planner-loader</artifactId>-->
58+
<!-- <version>${flink.version}</version>-->
59+
<!-- <scope>provided</scope>-->
60+
<!-- </dependency>-->
61+
5462
<dependency>
5563
<groupId>org.apache.flink</groupId>
56-
<artifactId>flink-table-planner-loader</artifactId>
64+
<artifactId>flink-table-planner_2.12</artifactId>
5765
<version>${flink.version}</version>
5866
<scope>provided</scope>
5967
</dependency>
@@ -482,6 +490,26 @@
482490
<groupId>org.apache.maven.plugins</groupId>
483491
<artifactId>maven-dependency-plugin</artifactId>
484492
<executions>
493+
<execution>
494+
<id>unpack-flink-table-planner-without-rex-json-deser</id>
495+
<goals>
496+
<goal>unpack</goal>
497+
</goals>
498+
<phase>prepare-package</phase>
499+
<configuration>
500+
<artifactItems>
501+
<artifactItem>
502+
<groupId>org.apache.flink</groupId>
503+
<artifactId>flink-table-planner_2.12</artifactId>
504+
<version>${flink.version}</version>
505+
<type>jar</type>
506+
<overWrite>true</overWrite>
507+
<outputDirectory>${project.build.directory}/flink-table-planner-temp</outputDirectory>
508+
<excludes>org/apache/flink/table/planner/plan/nodes/exec/serde/RexNodeJsonDeserializer**</excludes>
509+
</artifactItem>
510+
</artifactItems>
511+
</configuration>
512+
</execution>
485513
<execution>
486514
<id>unpack-iceberg-aws-bundle-without-logging</id>
487515
<goals>
@@ -612,12 +640,28 @@
612640
</executions>
613641
</plugin>
614642

615-
<!-- Repackage iceberg-aws-bundle without SLF4J using antrun plugin -->
616643
<plugin>
617644
<groupId>org.apache.maven.plugins</groupId>
618645
<artifactId>maven-antrun-plugin</artifactId>
619646
<executions>
620647
<execution>
648+
<!-- Repackage flink-table-planner_2.12 and override RexNodeJsonDeserializer using antrun plugin -->
649+
<id>repack-flink-table-planner</id>
650+
<goals>
651+
<goal>run</goal>
652+
</goals>
653+
<phase>prepare-package</phase>
654+
<configuration>
655+
<target>
656+
<copy failonerror="true" todir="${project.build.directory}/flink-table-planner-temp/org/apache/flink/table/planner/plan/nodes/exec/serde">
657+
<fileset dir="${project.build.outputDirectory}/org/apache/flink/table/planner/plan/nodes/exec/serde" includes="RexNodeJsonDeserializer*.class"/>
658+
</copy>
659+
<jar basedir="${project.build.directory}/flink-table-planner-temp" destfile="${project.build.directory}/flink-table-planner_2.12-${flink.version}.jar"/>
660+
</target>
661+
</configuration>
662+
</execution>
663+
<execution>
664+
<!-- Repackage iceberg-aws-bundle without SLF4J using antrun plugin -->
621665
<id>repack-iceberg-aws-bundle</id>
622666
<goals>
623667
<goal>run</goal>

flink-sql-runner/src/main/docker/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ FROM apache/flink:${flink-base-image}
1818

1919
RUN mkdir -p /opt/flink/plugins/flink-sql-runner
2020

21+
COPY flink-table-planner_2.12-*.jar /opt/flink/lib
2122
COPY flink-s3-fs-hadoop-*.jar /opt/flink/lib
2223
COPY hadoop-common-*.jar /opt/flink/lib
2324
COPY hadoop-hdfs-client-*.jar /opt/flink/lib
@@ -26,8 +27,9 @@ COPY iceberg-flink-runtime-*.jar /opt/flink/lib
2627
COPY iceberg-aws-bundle-*.jar /opt/flink/lib
2728
COPY stdlib-utils-*.jar /opt/flink/lib
2829
COPY flink-sql-runner.uber.jar /opt/flink/plugins/flink-sql-runner
29-
COPY entrypoint.sh /entrypoint.sh
30+
COPY --chmod=755 entrypoint.sh /entrypoint.sh
3031

31-
RUN ln -s /opt/flink/plugins/flink-sql-runner/flink-sql-runner.uber.jar /opt/flink/flink-sql-runner.jar
32+
RUN rm -rf /opt/flink/lib/flink-table-planner-loader-*.jar \
33+
&& ln -s /opt/flink/plugins/flink-sql-runner/flink-sql-runner.uber.jar /opt/flink/flink-sql-runner.jar
3234

3335
ENTRYPOINT ["/entrypoint.sh"]

0 commit comments

Comments
 (0)