Class PartialResultSet.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
com.google.bigtable.v2.PartialResultSet.Builder
All Implemented Interfaces:
PartialResultSetOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
Enclosing class:
PartialResultSet

public static final class PartialResultSet.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder> implements PartialResultSetOrBuilder
 A partial result set from the streaming query API.
 Cloud Bigtable clients buffer partial results received in this message until
 a `resume_token` is received.

 The pseudocode below describes how to buffer and parse a stream of
 `PartialResultSet` messages.

 Having:
 - queue of row results waiting to be returned `queue`
 - extensible buffer of bytes `buffer`
 - a place to keep track of the most recent `resume_token`
 for each PartialResultSet `p` received {
   if p.reset {
     ensure `queue` is empty
     ensure `buffer` is empty
   }
   if p.estimated_batch_size != 0 {
     (optional) ensure `buffer` is sized to at least `p.estimated_batch_size`
   }
   if `p.proto_rows_batch` is set {
     append `p.proto_rows_batch.bytes` to `buffer`
   }
   if p.batch_checksum is set and `buffer` is not empty {
     validate the checksum matches the contents of `buffer`
     (see comments on `batch_checksum`)
     parse `buffer` as `ProtoRows` message, clearing `buffer`
     add parsed rows to end of `queue`
   }
   if p.resume_token is set {
     release results in `queue`
     save `p.resume_token` in `resume_token`
   }
 }
 
Protobuf type google.bigtable.v2.PartialResultSet
  • Method Details

    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
    • clear

      public PartialResultSet.Builder clear()
      Specified by:
      clear in interface com.google.protobuf.Message.Builder
      Specified by:
      clear in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clear in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
    • getDescriptorForType

      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
      Specified by:
      getDescriptorForType in interface com.google.protobuf.Message.Builder
      Specified by:
      getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
      Overrides:
      getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
    • getDefaultInstanceForType

      public PartialResultSet getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
    • build

      public PartialResultSet build()
      Specified by:
      build in interface com.google.protobuf.Message.Builder
      Specified by:
      build in interface com.google.protobuf.MessageLite.Builder
    • buildPartial

      public PartialResultSet buildPartial()
      Specified by:
      buildPartial in interface com.google.protobuf.Message.Builder
      Specified by:
      buildPartial in interface com.google.protobuf.MessageLite.Builder
    • clone

      public PartialResultSet.Builder clone()
      Specified by:
      clone in interface com.google.protobuf.Message.Builder
      Specified by:
      clone in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clone in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
    • setField

      public PartialResultSet.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      Specified by:
      setField in interface com.google.protobuf.Message.Builder
      Overrides:
      setField in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
    • clearField

      public PartialResultSet.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
      Specified by:
      clearField in interface com.google.protobuf.Message.Builder
      Overrides:
      clearField in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
    • clearOneof

      public PartialResultSet.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
      Specified by:
      clearOneof in interface com.google.protobuf.Message.Builder
      Overrides:
      clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
    • setRepeatedField

      public PartialResultSet.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
      Specified by:
      setRepeatedField in interface com.google.protobuf.Message.Builder
      Overrides:
      setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
    • addRepeatedField

      public PartialResultSet.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      Specified by:
      addRepeatedField in interface com.google.protobuf.Message.Builder
      Overrides:
      addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
    • mergeFrom

      public PartialResultSet.Builder mergeFrom(com.google.protobuf.Message other)
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<PartialResultSet.Builder>
    • mergeFrom

      public PartialResultSet.Builder mergeFrom(PartialResultSet other)
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
    • mergeFrom

      public PartialResultSet.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Specified by:
      mergeFrom in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<PartialResultSet.Builder>
      Throws:
      IOException
    • getPartialRowsCase

      public PartialResultSet.PartialRowsCase getPartialRowsCase()
      Specified by:
      getPartialRowsCase in interface PartialResultSetOrBuilder
    • clearPartialRows

      public PartialResultSet.Builder clearPartialRows()
    • hasProtoRowsBatch

      public boolean hasProtoRowsBatch()
       Partial rows in serialized ProtoRows format.
       
      .google.bigtable.v2.ProtoRowsBatch proto_rows_batch = 3;
      Specified by:
      hasProtoRowsBatch in interface PartialResultSetOrBuilder
      Returns:
      Whether the protoRowsBatch field is set.
    • getProtoRowsBatch

      public ProtoRowsBatch getProtoRowsBatch()
       Partial rows in serialized ProtoRows format.
       
      .google.bigtable.v2.ProtoRowsBatch proto_rows_batch = 3;
      Specified by:
      getProtoRowsBatch in interface PartialResultSetOrBuilder
      Returns:
      The protoRowsBatch.
    • setProtoRowsBatch

      public PartialResultSet.Builder setProtoRowsBatch(ProtoRowsBatch value)
       Partial rows in serialized ProtoRows format.
       
      .google.bigtable.v2.ProtoRowsBatch proto_rows_batch = 3;
    • setProtoRowsBatch

      public PartialResultSet.Builder setProtoRowsBatch(ProtoRowsBatch.Builder builderForValue)
       Partial rows in serialized ProtoRows format.
       
      .google.bigtable.v2.ProtoRowsBatch proto_rows_batch = 3;
    • mergeProtoRowsBatch

      public PartialResultSet.Builder mergeProtoRowsBatch(ProtoRowsBatch value)
       Partial rows in serialized ProtoRows format.
       
      .google.bigtable.v2.ProtoRowsBatch proto_rows_batch = 3;
    • clearProtoRowsBatch

      public PartialResultSet.Builder clearProtoRowsBatch()
       Partial rows in serialized ProtoRows format.
       
      .google.bigtable.v2.ProtoRowsBatch proto_rows_batch = 3;
    • getProtoRowsBatchBuilder

      public ProtoRowsBatch.Builder getProtoRowsBatchBuilder()
       Partial rows in serialized ProtoRows format.
       
      .google.bigtable.v2.ProtoRowsBatch proto_rows_batch = 3;
    • getProtoRowsBatchOrBuilder

      public ProtoRowsBatchOrBuilder getProtoRowsBatchOrBuilder()
       Partial rows in serialized ProtoRows format.
       
      .google.bigtable.v2.ProtoRowsBatch proto_rows_batch = 3;
      Specified by:
      getProtoRowsBatchOrBuilder in interface PartialResultSetOrBuilder
    • hasBatchChecksum

      public boolean hasBatchChecksum()
       CRC32C checksum of concatenated `partial_rows` data for the current batch.
      
       When present, the buffered data from `partial_rows` forms a complete
       parseable message of the appropriate type.
      
       The client should mark the end of a parseable message and prepare to
       receive a new one starting from the next `PartialResultSet` message.
       Clients must verify the checksum of the serialized batch before yielding it
       to the caller.
      
       This does NOT mean the values can be yielded to the callers since a
       `resume_token` is required to safely do so.
      
       If `resume_token` is non-empty and any data has been received since the
       last one, this field is guaranteed to be non-empty. In other words, clients
       may assume that a batch will never cross a `resume_token` boundary.
       
      optional uint32 batch_checksum = 6;
      Specified by:
      hasBatchChecksum in interface PartialResultSetOrBuilder
      Returns:
      Whether the batchChecksum field is set.
    • getBatchChecksum

      public int getBatchChecksum()
       CRC32C checksum of concatenated `partial_rows` data for the current batch.
      
       When present, the buffered data from `partial_rows` forms a complete
       parseable message of the appropriate type.
      
       The client should mark the end of a parseable message and prepare to
       receive a new one starting from the next `PartialResultSet` message.
       Clients must verify the checksum of the serialized batch before yielding it
       to the caller.
      
       This does NOT mean the values can be yielded to the callers since a
       `resume_token` is required to safely do so.
      
       If `resume_token` is non-empty and any data has been received since the
       last one, this field is guaranteed to be non-empty. In other words, clients
       may assume that a batch will never cross a `resume_token` boundary.
       
      optional uint32 batch_checksum = 6;
      Specified by:
      getBatchChecksum in interface PartialResultSetOrBuilder
      Returns:
      The batchChecksum.
    • setBatchChecksum

      public PartialResultSet.Builder setBatchChecksum(int value)
       CRC32C checksum of concatenated `partial_rows` data for the current batch.
      
       When present, the buffered data from `partial_rows` forms a complete
       parseable message of the appropriate type.
      
       The client should mark the end of a parseable message and prepare to
       receive a new one starting from the next `PartialResultSet` message.
       Clients must verify the checksum of the serialized batch before yielding it
       to the caller.
      
       This does NOT mean the values can be yielded to the callers since a
       `resume_token` is required to safely do so.
      
       If `resume_token` is non-empty and any data has been received since the
       last one, this field is guaranteed to be non-empty. In other words, clients
       may assume that a batch will never cross a `resume_token` boundary.
       
      optional uint32 batch_checksum = 6;
      Parameters:
      value - The batchChecksum to set.
      Returns:
      This builder for chaining.
    • clearBatchChecksum

      public PartialResultSet.Builder clearBatchChecksum()
       CRC32C checksum of concatenated `partial_rows` data for the current batch.
      
       When present, the buffered data from `partial_rows` forms a complete
       parseable message of the appropriate type.
      
       The client should mark the end of a parseable message and prepare to
       receive a new one starting from the next `PartialResultSet` message.
       Clients must verify the checksum of the serialized batch before yielding it
       to the caller.
      
       This does NOT mean the values can be yielded to the callers since a
       `resume_token` is required to safely do so.
      
       If `resume_token` is non-empty and any data has been received since the
       last one, this field is guaranteed to be non-empty. In other words, clients
       may assume that a batch will never cross a `resume_token` boundary.
       
      optional uint32 batch_checksum = 6;
      Returns:
      This builder for chaining.
    • getResumeToken

      public com.google.protobuf.ByteString getResumeToken()
       An opaque token sent by the server to allow query resumption and signal
       that the buffered values constructed from received `partial_rows` can be
       yielded to the caller. Clients can provide this token in a subsequent
       request to resume the result stream from the current point.
      
       When `resume_token` is non-empty, the buffered values received from
       `partial_rows` since the last non-empty `resume_token` can be yielded to
       the callers, provided that the client keeps the value of `resume_token` and
       uses it on subsequent retries.
      
       A `resume_token` may be sent without information in `partial_rows` to
       checkpoint the progress of a sparse query. Any previous `partial_rows` data
       should still be yielded in this case, and the new `resume_token` should be
       saved for future retries as normal.
      
       A `resume_token` will only be sent on a boundary where there is either no
       ongoing result batch, or `batch_checksum` is also populated.
      
       The server will also send a sentinel `resume_token` when last batch of
       `partial_rows` is sent. If the client retries the ExecuteQueryRequest with
       the sentinel `resume_token`, the server will emit it again without any
       data in `partial_rows`, then return OK.
       
      bytes resume_token = 5;
      Specified by:
      getResumeToken in interface PartialResultSetOrBuilder
      Returns:
      The resumeToken.
    • setResumeToken

      public PartialResultSet.Builder setResumeToken(com.google.protobuf.ByteString value)
       An opaque token sent by the server to allow query resumption and signal
       that the buffered values constructed from received `partial_rows` can be
       yielded to the caller. Clients can provide this token in a subsequent
       request to resume the result stream from the current point.
      
       When `resume_token` is non-empty, the buffered values received from
       `partial_rows` since the last non-empty `resume_token` can be yielded to
       the callers, provided that the client keeps the value of `resume_token` and
       uses it on subsequent retries.
      
       A `resume_token` may be sent without information in `partial_rows` to
       checkpoint the progress of a sparse query. Any previous `partial_rows` data
       should still be yielded in this case, and the new `resume_token` should be
       saved for future retries as normal.
      
       A `resume_token` will only be sent on a boundary where there is either no
       ongoing result batch, or `batch_checksum` is also populated.
      
       The server will also send a sentinel `resume_token` when last batch of
       `partial_rows` is sent. If the client retries the ExecuteQueryRequest with
       the sentinel `resume_token`, the server will emit it again without any
       data in `partial_rows`, then return OK.
       
      bytes resume_token = 5;
      Parameters:
      value - The resumeToken to set.
      Returns:
      This builder for chaining.
    • clearResumeToken

      public PartialResultSet.Builder clearResumeToken()
       An opaque token sent by the server to allow query resumption and signal
       that the buffered values constructed from received `partial_rows` can be
       yielded to the caller. Clients can provide this token in a subsequent
       request to resume the result stream from the current point.
      
       When `resume_token` is non-empty, the buffered values received from
       `partial_rows` since the last non-empty `resume_token` can be yielded to
       the callers, provided that the client keeps the value of `resume_token` and
       uses it on subsequent retries.
      
       A `resume_token` may be sent without information in `partial_rows` to
       checkpoint the progress of a sparse query. Any previous `partial_rows` data
       should still be yielded in this case, and the new `resume_token` should be
       saved for future retries as normal.
      
       A `resume_token` will only be sent on a boundary where there is either no
       ongoing result batch, or `batch_checksum` is also populated.
      
       The server will also send a sentinel `resume_token` when last batch of
       `partial_rows` is sent. If the client retries the ExecuteQueryRequest with
       the sentinel `resume_token`, the server will emit it again without any
       data in `partial_rows`, then return OK.
       
      bytes resume_token = 5;
      Returns:
      This builder for chaining.
    • getReset

      public boolean getReset()
       If `true`, any data buffered since the last non-empty `resume_token` must
       be discarded before the other parts of this message, if any, are handled.
       
      bool reset = 7;
      Specified by:
      getReset in interface PartialResultSetOrBuilder
      Returns:
      The reset.
    • setReset

      public PartialResultSet.Builder setReset(boolean value)
       If `true`, any data buffered since the last non-empty `resume_token` must
       be discarded before the other parts of this message, if any, are handled.
       
      bool reset = 7;
      Parameters:
      value - The reset to set.
      Returns:
      This builder for chaining.
    • clearReset

      public PartialResultSet.Builder clearReset()
       If `true`, any data buffered since the last non-empty `resume_token` must
       be discarded before the other parts of this message, if any, are handled.
       
      bool reset = 7;
      Returns:
      This builder for chaining.
    • getEstimatedBatchSize

      public int getEstimatedBatchSize()
       Estimated size of the buffer required to hold the next batch of results.
      
       This value will be sent with the first `partial_rows` of a batch. That is,
       on the first `partial_rows` received in a stream, on the first message
       after a `batch_checksum` message, and any time `reset` is true.
      
       The client can use this estimate to allocate a buffer for the next batch of
       results. This helps minimize the number of allocations required, though the
       buffer size may still need to be increased if the estimate is too low.
       
      int32 estimated_batch_size = 4;
      Specified by:
      getEstimatedBatchSize in interface PartialResultSetOrBuilder
      Returns:
      The estimatedBatchSize.
    • setEstimatedBatchSize

      public PartialResultSet.Builder setEstimatedBatchSize(int value)
       Estimated size of the buffer required to hold the next batch of results.
      
       This value will be sent with the first `partial_rows` of a batch. That is,
       on the first `partial_rows` received in a stream, on the first message
       after a `batch_checksum` message, and any time `reset` is true.
      
       The client can use this estimate to allocate a buffer for the next batch of
       results. This helps minimize the number of allocations required, though the
       buffer size may still need to be increased if the estimate is too low.
       
      int32 estimated_batch_size = 4;
      Parameters:
      value - The estimatedBatchSize to set.
      Returns:
      This builder for chaining.
    • clearEstimatedBatchSize

      public PartialResultSet.Builder clearEstimatedBatchSize()
       Estimated size of the buffer required to hold the next batch of results.
      
       This value will be sent with the first `partial_rows` of a batch. That is,
       on the first `partial_rows` received in a stream, on the first message
       after a `batch_checksum` message, and any time `reset` is true.
      
       The client can use this estimate to allocate a buffer for the next batch of
       results. This helps minimize the number of allocations required, though the
       buffer size may still need to be increased if the estimate is too low.
       
      int32 estimated_batch_size = 4;
      Returns:
      This builder for chaining.
    • setUnknownFields

      public final PartialResultSet.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      Specified by:
      setUnknownFields in interface com.google.protobuf.Message.Builder
      Overrides:
      setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>
    • mergeUnknownFields

      public final PartialResultSet.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      Specified by:
      mergeUnknownFields in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<PartialResultSet.Builder>