ないタイプは、私が「エラーでSum.SumIntegerFnが表示されていないタイプのフラグを立て持っGoogleのデータフロー:Sum.SumIntegerFnは私のEclipseでは見え
import org.apache.beam.sdk.transforms.Sum;
....
something = createAggregator("something", new Sum.SumIntegerFn());
ないタイプは、私が「エラーでSum.SumIntegerFnが表示されていないタイプのフラグを立て持っGoogleのデータフロー:Sum.SumIntegerFnは私のEclipseでは見え
import org.apache.beam.sdk.transforms.Sum;
....
something = createAggregator("something", new Sum.SumIntegerFn());
私はあなたの「インポートからご覧ください。 Apacheのビームを使用して再。あなたはSum.ofIntegers()
の代わりnew Sum.SumIntegerFn()
を使用する必要があります。
はまた、Githubの頭で、アグリゲーターが削除されていることに注意してください。代わりに、カウンタメトリックは、同様の動作を提供します。詳細についてはMetrics
を参照してください。
Sum.SumIntegerFn()
は公開されなくなり、Sum.ofIntegers()
に置き換えられました。組み込み関数の代わりに独自のIterable関数を使用するための回避策が必要な場合は、以下のコードブロックを試してみてください。
something = createAggregator("something", new SumIntegers());
public static class SumIntegers implements SerializableFunction<Iterable<Integer>, Integer> {
@Override
public Integer apply(Iterable<Integer> input) {
Integer sum = 0;
for (Integer item : input) {
sum += item;
}
return sum;
}
}
私はビームからこれを見つけた[ドキュメント](https://beam.apache.org/documentation/programming-guide/#transforms-usercodereqs)Sum.SumIntegerFn()入力PCollectionの要素を組み合わせました。 'PCollection pc = ...; PCollection sum = pc.apply( Combine.globally(new Sum.SumIntegerFn())); –
bignano
ドキュメントは古く、 'Sum.SumIntegerFn()'は公開されなくなりました。 'Sum.ofIntegers()'がそれを置き換えました。そのユースケースについては、 'Sum.integersGlobally()'を実行することもできます。元々の質問は集約者であり、結合ではありませんでした。 –
これで "Sum.ofIntegersは型に解決できません" – bignano