簡體   English   中英

GCP Dataflow 拋出異常 Shuffle key too large

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM