Class SqlRowMerger

java.lang.Object
com.google.cloud.bigtable.data.v2.stub.sql.SqlRowMerger
All Implemented Interfaces:
com.google.cloud.bigtable.gaxx.reframing.Reframer<com.google.cloud.bigtable.data.v2.internal.SqlRow,ExecuteQueryResponse>

@InternalApi public final class SqlRowMerger extends Object implements com.google.cloud.bigtable.gaxx.reframing.Reframer<com.google.cloud.bigtable.data.v2.internal.SqlRow,ExecuteQueryResponse>
Used to transform a stream of ExecuteQueryResponse objects into rows. This class is not thread safe.
  • Constructor Details

    • SqlRowMerger

      public SqlRowMerger(Supplier<ResultSetMetadata> metadataSupplier)
      Parameters:
      metadataSupplier - a supplier of ResultSetMetadata. This is expected to return successfully once the first call to push has been made.

      This exists to facilitate plan refresh that can happen after creation of the row merger.

  • Method Details

    • push

      public void push(ExecuteQueryResponse response)
      Used to add responses to the SqlRowMerger as they are received.
      Specified by:
      push in interface com.google.cloud.bigtable.gaxx.reframing.Reframer<com.google.cloud.bigtable.data.v2.internal.SqlRow,ExecuteQueryResponse>
      Parameters:
      response - the next response in the stream of query responses
    • hasFullFrame

      public boolean hasFullFrame()
      Check if the merger has consumable data
      Specified by:
      hasFullFrame in interface com.google.cloud.bigtable.gaxx.reframing.Reframer<com.google.cloud.bigtable.data.v2.internal.SqlRow,ExecuteQueryResponse>
      Returns:
      true if there is a complete row, false otherwise.
    • hasPartialFrame

      public boolean hasPartialFrame()
      Check if the merger contains partially complete (or complete) data.
      Specified by:
      hasPartialFrame in interface com.google.cloud.bigtable.gaxx.reframing.Reframer<com.google.cloud.bigtable.data.v2.internal.SqlRow,ExecuteQueryResponse>
      Returns:
      true if there is a partial (or complete) batch, false otherwise.
    • pop

      public com.google.cloud.bigtable.data.v2.internal.SqlRow pop()
      pops a completed row from the FIFO queue built from the given responses.
      Specified by:
      pop in interface com.google.cloud.bigtable.gaxx.reframing.Reframer<com.google.cloud.bigtable.data.v2.internal.SqlRow,ExecuteQueryResponse>