问题描述
我已经尝试使用 SortValues 转换的示例代码DirectRunner
在本地机器 (Windows) 上
I have tried the example code of SortValues transform using DirectRunner
on local machine (Windows)
PCollection<KV<String, KV<String, Integer>>> input = ...
PCollection<KV<String, Iterable<KV<String, Integer>>>> grouped =
input.apply(GroupByKey.<String, KV<String, Integer>>create());
PCollection<KV<String, Iterable<KV<String, Integer>>>> groupedAndSorted =
grouped.apply(SortValues.<String, String, Integer>create(BufferedExternalSorter.options()));
但我收到错误PipelineExecutionException: java.lang.NoClassDefFoundError: org/apache/hadoop/io/Writable
.这是否意味着此转换功能仅适用于 Hadoop 环境?
but I got the error PipelineExecutionException: java.lang.NoClassDefFoundError: org/apache/hadoop/io/Writable
. Does this mean this transform function only works in Hadoop environment?
推荐答案
截至今天,如果您使用 Beam 的发布版本低于 2.0.0,您将不得不在您的 maven pom 文件中为此 SortValues 模块添加两个 hadoop 依赖项工作.
As of today, if you use Beam with release version below 2.0.0, you will have to add two hadoop dependencies in your maven pom file for this SortValues module to work.
- 添加
hadoop-common
2.7.3 或更高版本 - 添加
hadoop-mapreduce-client-core
2.7.3 或更高版本.
- add
hadoop-common
version 2.7.3 or later - add
hadoop-mapreduce-client-core
version 2.7.3 or later.
否则,您只需要使用发布版本 >= 2.0.0 的 Beam.
Otherwise, you will just need to use Beam with release version >= 2.0.0.
这篇关于Beam 中的 SortValues 转换 Java SDK 扩展是否只能在 hadoop 环境中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!