[英]Google Dataflow / Dataprep Shuffle key too large (INVALID_ARGUMENT)
[英]GCP Dataflow throws exception Shuffle key too large
我有一段代码对我的数据进行分组,但是当我执行 output 时它会引发异常。
此 class 用作 KV 中的密钥
class CKey {
private Long id;
private Long subId;
}
这是我的数据流工作的一部分
TupleTag<CItem> itemsTuple = //...
TupleTag<CMeta> metaTuple = //...
//...
PCollection<KV<CKey, CItem>> items = null;
PCollection<KV<CKey, CMeta>> meta;
KeyedPCollectionTuple.of(itemsTuple, items).and(metaTuple, meta.next())
.apply(CoGroupByKey.create())
.apply(new CustomGroupPairsFn());
自定义function加入数据
class CustomGroupPairsFn extends DoFn<KV<CKey, CoGbkResult>, MyCustomObject> {
@ProcessElement
public void processElement(@Element KV<CKey, CoGbkResult> element, OutputReceiver<MyCustomObject> out) {
CoGbkResult pair = element.getValue();
Iterator<CItem> citem = pair.getAll(ITEMS).iterator();
Iterator<CMeta> cmeta = pair.getAll(METADATA).iterator();
try {
out.output(new MyCustomObject(citem.next(), cmeta));
} catch (Exception e) {
log.error("Error occurred", e);
}
}
}
try
里面只有 1 行代码,里面抛出异常,异常:
我该如何解决这个问题?
发生此错误是因为您正在改组一个太大的键。
这是什么意思? 在 Dataflow 中,流管道允许的最大 shuffle key 为 1.5 MB。 您似乎有一个比这更大的元素键。
也许您的管道在某个意想不到的地方有一个 GroupByKey/Shuffle 操作,这就是为什么最好有更多关于它的细节。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.