Class Utils


  • public class Utils
    extends java.lang.Object
    Various common methods used by the Jet based runner.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Utils.ByteArrayKey
      A wrapper of byte[] that can be used as a hash-map key.
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> org.apache.beam.sdk.values.WindowedValue<T> decodeWindowedValue​(byte[] item, org.apache.beam.sdk.coders.Coder coder)  
      static org.apache.beam.sdk.values.WindowedValues.FullWindowedValueCoder deriveIterableValueCoder​(org.apache.beam.sdk.values.WindowedValues.FullWindowedValueCoder elementCoder)  
      static <T> byte[] encode​(T value, org.apache.beam.sdk.coders.Coder<T> coder)  
      static java.lang.String getTupleTagId​(org.apache.beam.sdk.values.PValue value)  
      static <T> java.util.List<T> roundRobinSubList​(java.util.List<T> list, int index, int count)
      Assigns the list to count sublists in a round-robin fashion.
      static <T> T serde​(T object)
      Returns a deep clone of an object by serializing and deserializing it (ser-de).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • getTupleTagId

        public static java.lang.String getTupleTagId​(org.apache.beam.sdk.values.PValue value)
      • roundRobinSubList

        @Nonnull
        public static <T> java.util.List<T> roundRobinSubList​(@Nonnull
                                                              java.util.List<T> list,
                                                              int index,
                                                              int count)
        Assigns the list to count sublists in a round-robin fashion. One call returns the index-th sublist.

        For example, for a 7-element list where count == 3, it would respectively return for indices 0..2:

           0, 3, 6
           1, 4
           2, 5
         
      • serde

        public static <T> T serde​(T object)
        Returns a deep clone of an object by serializing and deserializing it (ser-de).
      • encode

        public static <T> byte[] encode​(T value,
                                        org.apache.beam.sdk.coders.Coder<T> coder)
      • decodeWindowedValue

        public static <T> org.apache.beam.sdk.values.WindowedValue<T> decodeWindowedValue​(byte[] item,
                                                                                          org.apache.beam.sdk.coders.Coder coder)
      • deriveIterableValueCoder

        public static org.apache.beam.sdk.values.WindowedValues.FullWindowedValueCoder deriveIterableValueCoder​(org.apache.beam.sdk.values.WindowedValues.FullWindowedValueCoder elementCoder)