[
https://issues.apache.org/jira/browse/BEAM-7420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16849262#comment-16849262
]
Mike Kaplinskiy commented on BEAM-7420:
---------------------------------------
Technically the artifact does depend on Flink, but the JVM loads classes
lazily. That is, unless you actually use something Flink-related (e.g.
{{FlinkRunner}} itself), the classes aren't actually required. It's pretty
weird, but it's part of the language spec:
https://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.4.1 .
Currently it looks like the {{FlinkPipelineOptions}} are loaded eagerly by the
{{PipelineOptionsFactory}} because of the {{PipelineOptionsRegistrar}} Flink
provides. So even though you might pass {{--runner=direct}}, the
{{FlinkPipelineOptions}} class is instantiated - even though no options are
set/used.
If the options class didn't use any Flink directly (as part of annotations,
etc) you would be able to use the same fat jar with multiple runners -
including the test runner. The Spark runner does something similar here:
https://github.com/apache/beam/blob/8304e9497abfd0e92337837a2bfb63bdf2178ce8/runners/spark/src/main/java/org/apache/beam/runners/spark/SparkPipelineOptions.java#L52-L54
.
> Including the Flink runner causes exceptions unless running in a flink
> environment
> ----------------------------------------------------------------------------------
>
> Key: BEAM-7420
> URL: https://issues.apache.org/jira/browse/BEAM-7420
> Project: Beam
> Issue Type: Bug
> Components: runner-flink
> Reporter: Mike Kaplinskiy
> Priority: Major
>
> The {{FlinkPipelineOptions}} imports various Flink enums which make it
> impossible to e.g. run the direct runner with the same classpath but without
> the flink runtime. The fix is potentially easy - make the arguments strings
> and convert them to enums at the callsites.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)