Google Cloud Dataflow(Apache Beam) - 我可以将SideInput用于TextIO.write吗?

时间:2022-01-05 15:34:21

It looks so far we can use sideInputs only for DoFn to use side input when processing each input line.

到目前为止,我们可以使用sideInputs仅为DoFn在处理每个输入行时使用侧输入。

Is there any way to utilize the input with TextIO.Write ? In my case,

有没有办法利用TextIO.Write的输入?就我而言,

    outputTuple.get(deadletterTag)
        .apply("Write to deadletter files",
            TextIO.write().to(String.format("gs://dataflow-xxx/deadletter/%s/", uniqueID))
                .withSuffix(".csv")
                .withHeader(csvHeader)
        ).withSideInputs(csvHeaderView);

I have a csv header info as a PCollectionView<String> (obtained in a prior process by using Combine.globally and AsSingletonView) and want to somehow extract the header string and assign it into withHeader, but not sure if it's possible because there is no ProcessContext appears.

我有一个csv头信息作为PCollectionView (通过使用Combine.globally和AsSingletonView在先前的过程中获得)并希望以某种方式提取头字符串并将其分配到withHeader,但不确定是否可能,因为没有出现ProcessContext。

Thanks.

谢谢。

1 个解决方案

#1


1  

Unfortunately there is no easy way to do this as of Apache Beam 2.2.0 and earlier.

不幸的是,Apache Beam 2.2.0及更早版本没有简单的方法可以做到这一点。

I have created BEAM-2771 which tracks a general feature which could enable this.

我创建了BEAM-2771,它可以跟踪一个可以启用此功能的一般功能。

#1


1  

Unfortunately there is no easy way to do this as of Apache Beam 2.2.0 and earlier.

不幸的是,Apache Beam 2.2.0及更早版本没有简单的方法可以做到这一点。

I have created BEAM-2771 which tracks a general feature which could enable this.

我创建了BEAM-2771,它可以跟踪一个可以启用此功能的一般功能。