gpt4 book ai didi

java - 从 PCollection 获取列表

转载 作者:行者123 更新时间:2023-12-02 02:04:34 28 4
gpt4 key购买 nike

我想要 Pcollection 中的列表值。

PCollection<List<Integer>> lst =    bqT2.apply(ParDo.of(new 
UserId())); // line 1
List myList = lst.getAll(); // line 2

但是没有“getAll()”函数

我发现了类似的东西

    List<String> dummylist = Arrays.asList(dummy);
DoFnTester<String,String> fnTester = DoFnTester.of(new AAA(mapview));
fnTester.setSideInputInGlobalWindow(mapview, csvlist);
//dummylines.apply(ParDo.of(fnTester));
List<String> results = fnTester.processBatch(dummylist);

但我没有找到任何使用“DoFnTester”函数来获取列表项的方法。

有没有办法从PCollection中列出?

为了详细说明,我有两个 PCollection。

PCollection   p1 = pipeline.apply("",
BigQueryIO.read().fromQuery("SELECT * from myTable where userid in " + lst + ));

注意:lst 来自第 1 行

不确定 Google 数据流是否不支持简单用例。

最佳答案

apache_beam.transforms.combiners.ToList如果该列表适合您的内存,则可以为您工作。

beam.combiners.ToList() 是 Python 版本。

关于java - 从 PCollection 获取列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51002854/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com