SortValues转换为仅在hadoop环境中运行的Beam中的Java SDK扩展吗?

我在本地机器上尝试使用DirectRunner进行SortValues转换的示例代码(Windows)

 PCollection<KV<String, KV>> input = ... PCollection<KV<String, Iterable<KV>>> grouped = input.apply(GroupByKey.<String, KV>create()); PCollection<KV<String, Iterable<KV>>> groupedAndSorted = grouped.apply(SortValues.create(BufferedExternalSorter.options())); 

但我收到错误PipelineExecutionException: java.lang.NoClassDefFoundError: org/apache/hadoop/io/Writable 。 这是否意味着此转换function仅适用于Hadoop环境?

截至今天,如果您使用版本低于2.0.0的版本的Beam,则必须在maven pom文件中添加两个hadoop依赖项才能使此SortValues模块正常工作。

  1. 添加hadoop-common版本2.7.3或更高版本
  2. 添加hadoop-mapreduce-client-core版本2.7.3或更高版本。

否则,您只需要使用发布版本> = 2.0.0的Beam。