BigQueryIO.Read (Google Cloud Dataflow SDK 1.9.1 API)

Google Cloud Dataflow SDK for Java, version 1.9.1

com.google.cloud.dataflow.sdk.io

Class BigQueryIO.Read

  • Enclosing class:
    BigQueryIO


    public static class BigQueryIO.Read
    extends Object
    A PTransform that reads from a BigQuery table and returns a PCollection of TableRows containing each of the rows of the table.

    Each TableRow contains values indexed by column name. Here is a sample processing function that processes a "line" column from rows:

    
     static class ExtractWordsFn extends DoFn<TableRow, String> {
       public void processElement(ProcessContext c) {
         // Get the "line" field of the TableRow object, split it into words, and emit them.
         TableRow row = c.element();
         String[] words = row.get("line").toString().split("[^a-zA-Z']+");
         for (String word : words) {
           if (!word.isEmpty()) {
             c.output(word);
           }
         }
       }
     }


Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Dataflow
Need help? Visit our support page.