Class BeamUtils


  • public class BeamUtils
    extends java.lang.Object
    Static utilities for Beam pipelines.
    • Constructor Summary

      Constructors 
      Constructor Description
      BeamUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void checkFieldsNotNull​(com.google.common.collect.ImmutableList<java.lang.String> fieldNames, org.apache.beam.sdk.io.gcp.bigquery.SchemaAndRecord schemaAndRecord)
      Checks that no expected fields in the record are missing.
      static java.lang.String createJobName​(java.lang.String prefix, Clock clock)
      Creates a beam job name and validates that it conforms to the requirements.
      static java.lang.String extractField​(org.apache.avro.generic.GenericRecord record, java.lang.String fieldName)
      Extracts a string representation of a field in a GenericRecord.
      • Methods inherited from class java.lang.Object

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

      • BeamUtils

        public BeamUtils()
    • Method Detail

      • extractField

        public static java.lang.String extractField​(org.apache.avro.generic.GenericRecord record,
                                                    java.lang.String fieldName)
        Extracts a string representation of a field in a GenericRecord.
      • checkFieldsNotNull

        public static void checkFieldsNotNull​(com.google.common.collect.ImmutableList<java.lang.String> fieldNames,
                                              org.apache.beam.sdk.io.gcp.bigquery.SchemaAndRecord schemaAndRecord)
        Checks that no expected fields in the record are missing.

        Note that this simply makes sure the field is not null; it may still generate a parse error when interpreting the string representation of an object.

        Throws:
        java.lang.IllegalStateException - if the record returns null for any field in fieldNames
      • createJobName

        public static java.lang.String createJobName​(java.lang.String prefix,
                                                     Clock clock)
        Creates a beam job name and validates that it conforms to the requirements.