Wie erhalte ich den maximalen Zeitstempel des aktuellen Schiebefensters?

Ich verwende ein gleitendes Zeitfenster mit X-Größe und Y-Periode. Um die Ausgabe jedes Fensters zu markieren, möchte ich den Zeitstempel des aktuellen Fensters von PCollection erhalten.

    PCollection<T> windowedInput = input
      .apply(Window<T>into(
          SlidingWindows.of(Duration.standardMinutes(10))
                        .every(Duration.standardMinutes(1))));

   // Extract key from each input and run a function per group.
   //
   // Q: ExtractKey() depends on the window triggered time.
   //    How can I pass the timestamp of windowedInputs to ExtractKey()?
   PCollection<KV<K, Iterable<T>>> groupedInputs = windowedInputs
     .apply(ParDo.of(new ExtractKey()))
     .apply(GroupByKey.<K, Ts>create());

   // Run Story clustering and write outputs.
   //
   // Q: Also I'd like to add a window timestamp suffix to the output.
   //    How can I pass (or get) the timestamp to SomeDoFn()?
   PCollection<String> results = groupedInputs.apply(ParDo.of(new SomeDoFn()));

Antworten auf die Frage(2)

Ihre Antwort auf die Frage