/*
 * Copyright 2025 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/bigquery/storage/v1beta2/storage.proto

// Protobuf Java Version: 3.25.8
package com.google.cloud.bigquery.storage.v1beta2;

/**
 *
 *
 * <pre>
 * Request message for `AppendRows`.
 * </pre>
 *
 * Protobuf type {@code google.cloud.bigquery.storage.v1beta2.AppendRowsRequest}
 */
public final class AppendRowsRequest extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.bigquery.storage.v1beta2.AppendRowsRequest)
    AppendRowsRequestOrBuilder {
  private static final long serialVersionUID = 0L;

  // Use AppendRowsRequest.newBuilder() to construct.
  private AppendRowsRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private AppendRowsRequest() {
    writeStream_ = "";
    traceId_ = "";
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new AppendRowsRequest();
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.bigquery.storage.v1beta2.StorageProto
        .internal_static_google_cloud_bigquery_storage_v1beta2_AppendRowsRequest_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.bigquery.storage.v1beta2.StorageProto
        .internal_static_google_cloud_bigquery_storage_v1beta2_AppendRowsRequest_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.class,
            com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.Builder.class);
  }

  public interface ProtoDataOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * Proto schema used to serialize the data.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
     *
     * @return Whether the writerSchema field is set.
     */
    boolean hasWriterSchema();

    /**
     *
     *
     * <pre>
     * Proto schema used to serialize the data.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
     *
     * @return The writerSchema.
     */
    com.google.cloud.bigquery.storage.v1beta2.ProtoSchema getWriterSchema();

    /**
     *
     *
     * <pre>
     * Proto schema used to serialize the data.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
     */
    com.google.cloud.bigquery.storage.v1beta2.ProtoSchemaOrBuilder getWriterSchemaOrBuilder();

    /**
     *
     *
     * <pre>
     * Serialized row data in protobuf message format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
     *
     * @return Whether the rows field is set.
     */
    boolean hasRows();

    /**
     *
     *
     * <pre>
     * Serialized row data in protobuf message format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
     *
     * @return The rows.
     */
    com.google.cloud.bigquery.storage.v1beta2.ProtoRows getRows();

    /**
     *
     *
     * <pre>
     * Serialized row data in protobuf message format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
     */
    com.google.cloud.bigquery.storage.v1beta2.ProtoRowsOrBuilder getRowsOrBuilder();
  }

  /**
   *
   *
   * <pre>
   * Proto schema and data.
   * </pre>
   *
   * Protobuf type {@code google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData}
   */
  public static final class ProtoData extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData)
      ProtoDataOrBuilder {
    private static final long serialVersionUID = 0L;

    // Use ProtoData.newBuilder() to construct.
    private ProtoData(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private ProtoData() {}

    @java.lang.Override
    @SuppressWarnings({"unused"})
    protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
      return new ProtoData();
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.bigquery.storage.v1beta2.StorageProto
          .internal_static_google_cloud_bigquery_storage_v1beta2_AppendRowsRequest_ProtoData_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.bigquery.storage.v1beta2.StorageProto
          .internal_static_google_cloud_bigquery_storage_v1beta2_AppendRowsRequest_ProtoData_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData.class,
              com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData.Builder.class);
    }

    private int bitField0_;
    public static final int WRITER_SCHEMA_FIELD_NUMBER = 1;
    private com.google.cloud.bigquery.storage.v1beta2.ProtoSchema writerSchema_;

    /**
     *
     *
     * <pre>
     * Proto schema used to serialize the data.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
     *
     * @return Whether the writerSchema field is set.
     */
    @java.lang.Override
    public boolean hasWriterSchema() {
      return ((bitField0_ & 0x00000001) != 0);
    }

    /**
     *
     *
     * <pre>
     * Proto schema used to serialize the data.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
     *
     * @return The writerSchema.
     */
    @java.lang.Override
    public com.google.cloud.bigquery.storage.v1beta2.ProtoSchema getWriterSchema() {
      return writerSchema_ == null
          ? com.google.cloud.bigquery.storage.v1beta2.ProtoSchema.getDefaultInstance()
          : writerSchema_;
    }

    /**
     *
     *
     * <pre>
     * Proto schema used to serialize the data.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
     */
    @java.lang.Override
    public com.google.cloud.bigquery.storage.v1beta2.ProtoSchemaOrBuilder
        getWriterSchemaOrBuilder() {
      return writerSchema_ == null
          ? com.google.cloud.bigquery.storage.v1beta2.ProtoSchema.getDefaultInstance()
          : writerSchema_;
    }

    public static final int ROWS_FIELD_NUMBER = 2;
    private com.google.cloud.bigquery.storage.v1beta2.ProtoRows rows_;

    /**
     *
     *
     * <pre>
     * Serialized row data in protobuf message format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
     *
     * @return Whether the rows field is set.
     */
    @java.lang.Override
    public boolean hasRows() {
      return ((bitField0_ & 0x00000002) != 0);
    }

    /**
     *
     *
     * <pre>
     * Serialized row data in protobuf message format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
     *
     * @return The rows.
     */
    @java.lang.Override
    public com.google.cloud.bigquery.storage.v1beta2.ProtoRows getRows() {
      return rows_ == null
          ? com.google.cloud.bigquery.storage.v1beta2.ProtoRows.getDefaultInstance()
          : rows_;
    }

    /**
     *
     *
     * <pre>
     * Serialized row data in protobuf message format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
     */
    @java.lang.Override
    public com.google.cloud.bigquery.storage.v1beta2.ProtoRowsOrBuilder getRowsOrBuilder() {
      return rows_ == null
          ? com.google.cloud.bigquery.storage.v1beta2.ProtoRows.getDefaultInstance()
          : rows_;
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      if (hasWriterSchema()) {
        if (!getWriterSchema().isInitialized()) {
          memoizedIsInitialized = 0;
          return false;
        }
      }
      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
      if (((bitField0_ & 0x00000001) != 0)) {
        output.writeMessage(1, getWriterSchema());
      }
      if (((bitField0_ & 0x00000002) != 0)) {
        output.writeMessage(2, getRows());
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) != 0)) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getWriterSchema());
      }
      if (((bitField0_ & 0x00000002) != 0)) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getRows());
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData)) {
        return super.equals(obj);
      }
      com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData other =
          (com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData) obj;

      if (hasWriterSchema() != other.hasWriterSchema()) return false;
      if (hasWriterSchema()) {
        if (!getWriterSchema().equals(other.getWriterSchema())) return false;
      }
      if (hasRows() != other.hasRows()) return false;
      if (hasRows()) {
        if (!getRows().equals(other.getRows())) return false;
      }
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      if (hasWriterSchema()) {
        hash = (37 * hash) + WRITER_SCHEMA_FIELD_NUMBER;
        hash = (53 * hash) + getWriterSchema().hashCode();
      }
      if (hasRows()) {
        hash = (37 * hash) + ROWS_FIELD_NUMBER;
        hash = (53 * hash) + getRows().hashCode();
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData parseFrom(
        byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
        parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
        parseDelimitedFrom(
            java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
      return newBuilder();
    }

    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(
        com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * Proto schema and data.
     * </pre>
     *
     * Protobuf type {@code google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData)
        com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoDataOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.cloud.bigquery.storage.v1beta2.StorageProto
            .internal_static_google_cloud_bigquery_storage_v1beta2_AppendRowsRequest_ProtoData_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.cloud.bigquery.storage.v1beta2.StorageProto
            .internal_static_google_cloud_bigquery_storage_v1beta2_AppendRowsRequest_ProtoData_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData.class,
                com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData.Builder
                    .class);
      }

      // Construct using
      // com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }

      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
          getWriterSchemaFieldBuilder();
          getRowsFieldBuilder();
        }
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        writerSchema_ = null;
        if (writerSchemaBuilder_ != null) {
          writerSchemaBuilder_.dispose();
          writerSchemaBuilder_ = null;
        }
        rows_ = null;
        if (rowsBuilder_ != null) {
          rowsBuilder_.dispose();
          rowsBuilder_ = null;
        }
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.cloud.bigquery.storage.v1beta2.StorageProto
            .internal_static_google_cloud_bigquery_storage_v1beta2_AppendRowsRequest_ProtoData_descriptor;
      }

      @java.lang.Override
      public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
          getDefaultInstanceForType() {
        return com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
            .getDefaultInstance();
      }

      @java.lang.Override
      public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData build() {
        com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData result =
            buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData buildPartial() {
        com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData result =
            new com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartial0(
          com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData result) {
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.writerSchema_ =
              writerSchemaBuilder_ == null ? writerSchema_ : writerSchemaBuilder_.build();
          to_bitField0_ |= 0x00000001;
        }
        if (((from_bitField0_ & 0x00000002) != 0)) {
          result.rows_ = rowsBuilder_ == null ? rows_ : rowsBuilder_.build();
          to_bitField0_ |= 0x00000002;
        }
        result.bitField0_ |= to_bitField0_;
      }

      @java.lang.Override
      public Builder clone() {
        return super.clone();
      }

      @java.lang.Override
      public Builder setField(
          com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
        return super.setField(field, value);
      }

      @java.lang.Override
      public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
        return super.clearField(field);
      }

      @java.lang.Override
      public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
        return super.clearOneof(oneof);
      }

      @java.lang.Override
      public Builder setRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          int index,
          java.lang.Object value) {
        return super.setRepeatedField(field, index, value);
      }

      @java.lang.Override
      public Builder addRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
        return super.addRepeatedField(field, value);
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other
            instanceof com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData) {
          return mergeFrom(
              (com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(
          com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData other) {
        if (other
            == com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
                .getDefaultInstance()) return this;
        if (other.hasWriterSchema()) {
          mergeWriterSchema(other.getWriterSchema());
        }
        if (other.hasRows()) {
          mergeRows(other.getRows());
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        if (hasWriterSchema()) {
          if (!getWriterSchema().isInitialized()) {
            return false;
          }
        }
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 10:
                {
                  input.readMessage(getWriterSchemaFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000001;
                  break;
                } // case 10
              case 18:
                {
                  input.readMessage(getRowsFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000002;
                  break;
                } // case 18
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int bitField0_;

      private com.google.cloud.bigquery.storage.v1beta2.ProtoSchema writerSchema_;
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.cloud.bigquery.storage.v1beta2.ProtoSchema,
              com.google.cloud.bigquery.storage.v1beta2.ProtoSchema.Builder,
              com.google.cloud.bigquery.storage.v1beta2.ProtoSchemaOrBuilder>
          writerSchemaBuilder_;

      /**
       *
       *
       * <pre>
       * Proto schema used to serialize the data.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
       *
       * @return Whether the writerSchema field is set.
       */
      public boolean hasWriterSchema() {
        return ((bitField0_ & 0x00000001) != 0);
      }

      /**
       *
       *
       * <pre>
       * Proto schema used to serialize the data.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
       *
       * @return The writerSchema.
       */
      public com.google.cloud.bigquery.storage.v1beta2.ProtoSchema getWriterSchema() {
        if (writerSchemaBuilder_ == null) {
          return writerSchema_ == null
              ? com.google.cloud.bigquery.storage.v1beta2.ProtoSchema.getDefaultInstance()
              : writerSchema_;
        } else {
          return writerSchemaBuilder_.getMessage();
        }
      }

      /**
       *
       *
       * <pre>
       * Proto schema used to serialize the data.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
       */
      public Builder setWriterSchema(com.google.cloud.bigquery.storage.v1beta2.ProtoSchema value) {
        if (writerSchemaBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          writerSchema_ = value;
        } else {
          writerSchemaBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Proto schema used to serialize the data.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
       */
      public Builder setWriterSchema(
          com.google.cloud.bigquery.storage.v1beta2.ProtoSchema.Builder builderForValue) {
        if (writerSchemaBuilder_ == null) {
          writerSchema_ = builderForValue.build();
        } else {
          writerSchemaBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Proto schema used to serialize the data.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
       */
      public Builder mergeWriterSchema(
          com.google.cloud.bigquery.storage.v1beta2.ProtoSchema value) {
        if (writerSchemaBuilder_ == null) {
          if (((bitField0_ & 0x00000001) != 0)
              && writerSchema_ != null
              && writerSchema_
                  != com.google.cloud.bigquery.storage.v1beta2.ProtoSchema.getDefaultInstance()) {
            getWriterSchemaBuilder().mergeFrom(value);
          } else {
            writerSchema_ = value;
          }
        } else {
          writerSchemaBuilder_.mergeFrom(value);
        }
        if (writerSchema_ != null) {
          bitField0_ |= 0x00000001;
          onChanged();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * Proto schema used to serialize the data.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
       */
      public Builder clearWriterSchema() {
        bitField0_ = (bitField0_ & ~0x00000001);
        writerSchema_ = null;
        if (writerSchemaBuilder_ != null) {
          writerSchemaBuilder_.dispose();
          writerSchemaBuilder_ = null;
        }
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Proto schema used to serialize the data.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
       */
      public com.google.cloud.bigquery.storage.v1beta2.ProtoSchema.Builder
          getWriterSchemaBuilder() {
        bitField0_ |= 0x00000001;
        onChanged();
        return getWriterSchemaFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * Proto schema used to serialize the data.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
       */
      public com.google.cloud.bigquery.storage.v1beta2.ProtoSchemaOrBuilder
          getWriterSchemaOrBuilder() {
        if (writerSchemaBuilder_ != null) {
          return writerSchemaBuilder_.getMessageOrBuilder();
        } else {
          return writerSchema_ == null
              ? com.google.cloud.bigquery.storage.v1beta2.ProtoSchema.getDefaultInstance()
              : writerSchema_;
        }
      }

      /**
       *
       *
       * <pre>
       * Proto schema used to serialize the data.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoSchema writer_schema = 1;</code>
       */
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.cloud.bigquery.storage.v1beta2.ProtoSchema,
              com.google.cloud.bigquery.storage.v1beta2.ProtoSchema.Builder,
              com.google.cloud.bigquery.storage.v1beta2.ProtoSchemaOrBuilder>
          getWriterSchemaFieldBuilder() {
        if (writerSchemaBuilder_ == null) {
          writerSchemaBuilder_ =
              new com.google.protobuf.SingleFieldBuilderV3<
                  com.google.cloud.bigquery.storage.v1beta2.ProtoSchema,
                  com.google.cloud.bigquery.storage.v1beta2.ProtoSchema.Builder,
                  com.google.cloud.bigquery.storage.v1beta2.ProtoSchemaOrBuilder>(
                  getWriterSchema(), getParentForChildren(), isClean());
          writerSchema_ = null;
        }
        return writerSchemaBuilder_;
      }

      private com.google.cloud.bigquery.storage.v1beta2.ProtoRows rows_;
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.cloud.bigquery.storage.v1beta2.ProtoRows,
              com.google.cloud.bigquery.storage.v1beta2.ProtoRows.Builder,
              com.google.cloud.bigquery.storage.v1beta2.ProtoRowsOrBuilder>
          rowsBuilder_;

      /**
       *
       *
       * <pre>
       * Serialized row data in protobuf message format.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
       *
       * @return Whether the rows field is set.
       */
      public boolean hasRows() {
        return ((bitField0_ & 0x00000002) != 0);
      }

      /**
       *
       *
       * <pre>
       * Serialized row data in protobuf message format.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
       *
       * @return The rows.
       */
      public com.google.cloud.bigquery.storage.v1beta2.ProtoRows getRows() {
        if (rowsBuilder_ == null) {
          return rows_ == null
              ? com.google.cloud.bigquery.storage.v1beta2.ProtoRows.getDefaultInstance()
              : rows_;
        } else {
          return rowsBuilder_.getMessage();
        }
      }

      /**
       *
       *
       * <pre>
       * Serialized row data in protobuf message format.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
       */
      public Builder setRows(com.google.cloud.bigquery.storage.v1beta2.ProtoRows value) {
        if (rowsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          rows_ = value;
        } else {
          rowsBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Serialized row data in protobuf message format.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
       */
      public Builder setRows(
          com.google.cloud.bigquery.storage.v1beta2.ProtoRows.Builder builderForValue) {
        if (rowsBuilder_ == null) {
          rows_ = builderForValue.build();
        } else {
          rowsBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Serialized row data in protobuf message format.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
       */
      public Builder mergeRows(com.google.cloud.bigquery.storage.v1beta2.ProtoRows value) {
        if (rowsBuilder_ == null) {
          if (((bitField0_ & 0x00000002) != 0)
              && rows_ != null
              && rows_
                  != com.google.cloud.bigquery.storage.v1beta2.ProtoRows.getDefaultInstance()) {
            getRowsBuilder().mergeFrom(value);
          } else {
            rows_ = value;
          }
        } else {
          rowsBuilder_.mergeFrom(value);
        }
        if (rows_ != null) {
          bitField0_ |= 0x00000002;
          onChanged();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * Serialized row data in protobuf message format.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
       */
      public Builder clearRows() {
        bitField0_ = (bitField0_ & ~0x00000002);
        rows_ = null;
        if (rowsBuilder_ != null) {
          rowsBuilder_.dispose();
          rowsBuilder_ = null;
        }
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Serialized row data in protobuf message format.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
       */
      public com.google.cloud.bigquery.storage.v1beta2.ProtoRows.Builder getRowsBuilder() {
        bitField0_ |= 0x00000002;
        onChanged();
        return getRowsFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * Serialized row data in protobuf message format.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
       */
      public com.google.cloud.bigquery.storage.v1beta2.ProtoRowsOrBuilder getRowsOrBuilder() {
        if (rowsBuilder_ != null) {
          return rowsBuilder_.getMessageOrBuilder();
        } else {
          return rows_ == null
              ? com.google.cloud.bigquery.storage.v1beta2.ProtoRows.getDefaultInstance()
              : rows_;
        }
      }

      /**
       *
       *
       * <pre>
       * Serialized row data in protobuf message format.
       * </pre>
       *
       * <code>.google.cloud.bigquery.storage.v1beta2.ProtoRows rows = 2;</code>
       */
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.cloud.bigquery.storage.v1beta2.ProtoRows,
              com.google.cloud.bigquery.storage.v1beta2.ProtoRows.Builder,
              com.google.cloud.bigquery.storage.v1beta2.ProtoRowsOrBuilder>
          getRowsFieldBuilder() {
        if (rowsBuilder_ == null) {
          rowsBuilder_ =
              new com.google.protobuf.SingleFieldBuilderV3<
                  com.google.cloud.bigquery.storage.v1beta2.ProtoRows,
                  com.google.cloud.bigquery.storage.v1beta2.ProtoRows.Builder,
                  com.google.cloud.bigquery.storage.v1beta2.ProtoRowsOrBuilder>(
                  getRows(), getParentForChildren(), isClean());
          rows_ = null;
        }
        return rowsBuilder_;
      }

      @java.lang.Override
      public final Builder setUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
        return super.setUnknownFields(unknownFields);
      }

      @java.lang.Override
      public final Builder mergeUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
        return super.mergeUnknownFields(unknownFields);
      }

      // @@protoc_insertion_point(builder_scope:google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData)
    }

    // @@protoc_insertion_point(class_scope:google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData)
    private static final com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
        DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE =
          new com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData();
    }

    public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
        getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<ProtoData> PARSER =
        new com.google.protobuf.AbstractParser<ProtoData>() {
          @java.lang.Override
          public ProtoData parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            Builder builder = newBuilder();
            try {
              builder.mergeFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
              throw e.setUnfinishedMessage(builder.buildPartial());
            } catch (com.google.protobuf.UninitializedMessageException e) {
              throw e.asInvalidProtocolBufferException()
                  .setUnfinishedMessage(builder.buildPartial());
            } catch (java.io.IOException e) {
              throw new com.google.protobuf.InvalidProtocolBufferException(e)
                  .setUnfinishedMessage(builder.buildPartial());
            }
            return builder.buildPartial();
          }
        };

    public static com.google.protobuf.Parser<ProtoData> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<ProtoData> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
        getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  private int bitField0_;
  private int rowsCase_ = 0;

  @SuppressWarnings("serial")
  private java.lang.Object rows_;

  public enum RowsCase
      implements
          com.google.protobuf.Internal.EnumLite,
          com.google.protobuf.AbstractMessage.InternalOneOfEnum {
    PROTO_ROWS(4),
    ROWS_NOT_SET(0);
    private final int value;

    private RowsCase(int value) {
      this.value = value;
    }

    /**
     * @param value The number of the enum to look for.
     * @return The enum associated with the given number.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static RowsCase valueOf(int value) {
      return forNumber(value);
    }

    public static RowsCase forNumber(int value) {
      switch (value) {
        case 4:
          return PROTO_ROWS;
        case 0:
          return ROWS_NOT_SET;
        default:
          return null;
      }
    }

    public int getNumber() {
      return this.value;
    }
  };

  public RowsCase getRowsCase() {
    return RowsCase.forNumber(rowsCase_);
  }

  public static final int WRITE_STREAM_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private volatile java.lang.Object writeStream_ = "";

  /**
   *
   *
   * <pre>
   * Required. The stream that is the target of the append operation. This value
   * must be specified for the initial request. If subsequent requests specify
   * the stream name, it must equal to the value provided in the first request.
   * To write to the _default stream, populate this field with a string in the
   * format `projects/{project}/datasets/{dataset}/tables/{table}/_default`.
   * </pre>
   *
   * <code>
   * string write_stream = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   * </code>
   *
   * @return The writeStream.
   */
  @java.lang.Override
  public java.lang.String getWriteStream() {
    java.lang.Object ref = writeStream_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      writeStream_ = s;
      return s;
    }
  }

  /**
   *
   *
   * <pre>
   * Required. The stream that is the target of the append operation. This value
   * must be specified for the initial request. If subsequent requests specify
   * the stream name, it must equal to the value provided in the first request.
   * To write to the _default stream, populate this field with a string in the
   * format `projects/{project}/datasets/{dataset}/tables/{table}/_default`.
   * </pre>
   *
   * <code>
   * string write_stream = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   * </code>
   *
   * @return The bytes for writeStream.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getWriteStreamBytes() {
    java.lang.Object ref = writeStream_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      writeStream_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int OFFSET_FIELD_NUMBER = 2;
  private com.google.protobuf.Int64Value offset_;

  /**
   *
   *
   * <pre>
   * If present, the write is only performed if the next append offset is same
   * as the provided value. If not present, the write is performed at the
   * current end of stream. Specifying a value for this field is not allowed
   * when calling AppendRows for the '_default' stream.
   * </pre>
   *
   * <code>.google.protobuf.Int64Value offset = 2;</code>
   *
   * @return Whether the offset field is set.
   */
  @java.lang.Override
  public boolean hasOffset() {
    return ((bitField0_ & 0x00000001) != 0);
  }

  /**
   *
   *
   * <pre>
   * If present, the write is only performed if the next append offset is same
   * as the provided value. If not present, the write is performed at the
   * current end of stream. Specifying a value for this field is not allowed
   * when calling AppendRows for the '_default' stream.
   * </pre>
   *
   * <code>.google.protobuf.Int64Value offset = 2;</code>
   *
   * @return The offset.
   */
  @java.lang.Override
  public com.google.protobuf.Int64Value getOffset() {
    return offset_ == null ? com.google.protobuf.Int64Value.getDefaultInstance() : offset_;
  }

  /**
   *
   *
   * <pre>
   * If present, the write is only performed if the next append offset is same
   * as the provided value. If not present, the write is performed at the
   * current end of stream. Specifying a value for this field is not allowed
   * when calling AppendRows for the '_default' stream.
   * </pre>
   *
   * <code>.google.protobuf.Int64Value offset = 2;</code>
   */
  @java.lang.Override
  public com.google.protobuf.Int64ValueOrBuilder getOffsetOrBuilder() {
    return offset_ == null ? com.google.protobuf.Int64Value.getDefaultInstance() : offset_;
  }

  public static final int PROTO_ROWS_FIELD_NUMBER = 4;

  /**
   *
   *
   * <pre>
   * Rows in proto format.
   * </pre>
   *
   * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;</code>
   *
   * @return Whether the protoRows field is set.
   */
  @java.lang.Override
  public boolean hasProtoRows() {
    return rowsCase_ == 4;
  }

  /**
   *
   *
   * <pre>
   * Rows in proto format.
   * </pre>
   *
   * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;</code>
   *
   * @return The protoRows.
   */
  @java.lang.Override
  public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData getProtoRows() {
    if (rowsCase_ == 4) {
      return (com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData) rows_;
    }
    return com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
        .getDefaultInstance();
  }

  /**
   *
   *
   * <pre>
   * Rows in proto format.
   * </pre>
   *
   * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;</code>
   */
  @java.lang.Override
  public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoDataOrBuilder
      getProtoRowsOrBuilder() {
    if (rowsCase_ == 4) {
      return (com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData) rows_;
    }
    return com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
        .getDefaultInstance();
  }

  public static final int TRACE_ID_FIELD_NUMBER = 6;

  @SuppressWarnings("serial")
  private volatile java.lang.Object traceId_ = "";

  /**
   *
   *
   * <pre>
   * Id set by client to annotate its identity. Only initial request setting is
   * respected.
   * </pre>
   *
   * <code>string trace_id = 6;</code>
   *
   * @return The traceId.
   */
  @java.lang.Override
  public java.lang.String getTraceId() {
    java.lang.Object ref = traceId_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      traceId_ = s;
      return s;
    }
  }

  /**
   *
   *
   * <pre>
   * Id set by client to annotate its identity. Only initial request setting is
   * respected.
   * </pre>
   *
   * <code>string trace_id = 6;</code>
   *
   * @return The bytes for traceId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getTraceIdBytes() {
    java.lang.Object ref = traceId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      traceId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    if (hasProtoRows()) {
      if (!getProtoRows().isInitialized()) {
        memoizedIsInitialized = 0;
        return false;
      }
    }
    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(writeStream_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, writeStream_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      output.writeMessage(2, getOffset());
    }
    if (rowsCase_ == 4) {
      output.writeMessage(
          4, (com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData) rows_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(traceId_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 6, traceId_);
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(writeStream_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, writeStream_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getOffset());
    }
    if (rowsCase_ == 4) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              4, (com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData) rows_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(traceId_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, traceId_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest)) {
      return super.equals(obj);
    }
    com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest other =
        (com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest) obj;

    if (!getWriteStream().equals(other.getWriteStream())) return false;
    if (hasOffset() != other.hasOffset()) return false;
    if (hasOffset()) {
      if (!getOffset().equals(other.getOffset())) return false;
    }
    if (!getTraceId().equals(other.getTraceId())) return false;
    if (!getRowsCase().equals(other.getRowsCase())) return false;
    switch (rowsCase_) {
      case 4:
        if (!getProtoRows().equals(other.getProtoRows())) return false;
        break;
      case 0:
      default:
    }
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + WRITE_STREAM_FIELD_NUMBER;
    hash = (53 * hash) + getWriteStream().hashCode();
    if (hasOffset()) {
      hash = (37 * hash) + OFFSET_FIELD_NUMBER;
      hash = (53 * hash) + getOffset().hashCode();
    }
    hash = (37 * hash) + TRACE_ID_FIELD_NUMBER;
    hash = (53 * hash) + getTraceId().hashCode();
    switch (rowsCase_) {
      case 4:
        hash = (37 * hash) + PROTO_ROWS_FIELD_NUMBER;
        hash = (53 * hash) + getProtoRows().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(
      com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }

  /**
   *
   *
   * <pre>
   * Request message for `AppendRows`.
   * </pre>
   *
   * Protobuf type {@code google.cloud.bigquery.storage.v1beta2.AppendRowsRequest}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.bigquery.storage.v1beta2.AppendRowsRequest)
      com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequestOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.bigquery.storage.v1beta2.StorageProto
          .internal_static_google_cloud_bigquery_storage_v1beta2_AppendRowsRequest_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.bigquery.storage.v1beta2.StorageProto
          .internal_static_google_cloud_bigquery_storage_v1beta2_AppendRowsRequest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.class,
              com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.Builder.class);
    }

    // Construct using com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
        getOffsetFieldBuilder();
      }
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      writeStream_ = "";
      offset_ = null;
      if (offsetBuilder_ != null) {
        offsetBuilder_.dispose();
        offsetBuilder_ = null;
      }
      if (protoRowsBuilder_ != null) {
        protoRowsBuilder_.clear();
      }
      traceId_ = "";
      rowsCase_ = 0;
      rows_ = null;
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.bigquery.storage.v1beta2.StorageProto
          .internal_static_google_cloud_bigquery_storage_v1beta2_AppendRowsRequest_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest getDefaultInstanceForType() {
      return com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest build() {
      com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest buildPartial() {
      com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest result =
          new com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest(this);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      buildPartialOneofs(result);
      onBuilt();
      return result;
    }

    private void buildPartial0(com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.writeStream_ = writeStream_;
      }
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.offset_ = offsetBuilder_ == null ? offset_ : offsetBuilder_.build();
        to_bitField0_ |= 0x00000001;
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.traceId_ = traceId_;
      }
      result.bitField0_ |= to_bitField0_;
    }

    private void buildPartialOneofs(
        com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest result) {
      result.rowsCase_ = rowsCase_;
      result.rows_ = this.rows_;
      if (rowsCase_ == 4 && protoRowsBuilder_ != null) {
        result.rows_ = protoRowsBuilder_.build();
      }
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest) {
        return mergeFrom((com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest other) {
      if (other == com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.getDefaultInstance())
        return this;
      if (!other.getWriteStream().isEmpty()) {
        writeStream_ = other.writeStream_;
        bitField0_ |= 0x00000001;
        onChanged();
      }
      if (other.hasOffset()) {
        mergeOffset(other.getOffset());
      }
      if (!other.getTraceId().isEmpty()) {
        traceId_ = other.traceId_;
        bitField0_ |= 0x00000008;
        onChanged();
      }
      switch (other.getRowsCase()) {
        case PROTO_ROWS:
          {
            mergeProtoRows(other.getProtoRows());
            break;
          }
        case ROWS_NOT_SET:
          {
            break;
          }
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      if (hasProtoRows()) {
        if (!getProtoRows().isInitialized()) {
          return false;
        }
      }
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                writeStream_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                input.readMessage(getOffsetFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 34:
              {
                input.readMessage(getProtoRowsFieldBuilder().getBuilder(), extensionRegistry);
                rowsCase_ = 4;
                break;
              } // case 34
            case 50:
              {
                traceId_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000008;
                break;
              } // case 50
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int rowsCase_ = 0;
    private java.lang.Object rows_;

    public RowsCase getRowsCase() {
      return RowsCase.forNumber(rowsCase_);
    }

    public Builder clearRows() {
      rowsCase_ = 0;
      rows_ = null;
      onChanged();
      return this;
    }

    private int bitField0_;

    private java.lang.Object writeStream_ = "";

    /**
     *
     *
     * <pre>
     * Required. The stream that is the target of the append operation. This value
     * must be specified for the initial request. If subsequent requests specify
     * the stream name, it must equal to the value provided in the first request.
     * To write to the _default stream, populate this field with a string in the
     * format `projects/{project}/datasets/{dataset}/tables/{table}/_default`.
     * </pre>
     *
     * <code>
     * string write_stream = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return The writeStream.
     */
    public java.lang.String getWriteStream() {
      java.lang.Object ref = writeStream_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        writeStream_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * Required. The stream that is the target of the append operation. This value
     * must be specified for the initial request. If subsequent requests specify
     * the stream name, it must equal to the value provided in the first request.
     * To write to the _default stream, populate this field with a string in the
     * format `projects/{project}/datasets/{dataset}/tables/{table}/_default`.
     * </pre>
     *
     * <code>
     * string write_stream = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return The bytes for writeStream.
     */
    public com.google.protobuf.ByteString getWriteStreamBytes() {
      java.lang.Object ref = writeStream_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        writeStream_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * Required. The stream that is the target of the append operation. This value
     * must be specified for the initial request. If subsequent requests specify
     * the stream name, it must equal to the value provided in the first request.
     * To write to the _default stream, populate this field with a string in the
     * format `projects/{project}/datasets/{dataset}/tables/{table}/_default`.
     * </pre>
     *
     * <code>
     * string write_stream = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @param value The writeStream to set.
     * @return This builder for chaining.
     */
    public Builder setWriteStream(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      writeStream_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Required. The stream that is the target of the append operation. This value
     * must be specified for the initial request. If subsequent requests specify
     * the stream name, it must equal to the value provided in the first request.
     * To write to the _default stream, populate this field with a string in the
     * format `projects/{project}/datasets/{dataset}/tables/{table}/_default`.
     * </pre>
     *
     * <code>
     * string write_stream = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return This builder for chaining.
     */
    public Builder clearWriteStream() {
      writeStream_ = getDefaultInstance().getWriteStream();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Required. The stream that is the target of the append operation. This value
     * must be specified for the initial request. If subsequent requests specify
     * the stream name, it must equal to the value provided in the first request.
     * To write to the _default stream, populate this field with a string in the
     * format `projects/{project}/datasets/{dataset}/tables/{table}/_default`.
     * </pre>
     *
     * <code>
     * string write_stream = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @param value The bytes for writeStream to set.
     * @return This builder for chaining.
     */
    public Builder setWriteStreamBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      writeStream_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    private com.google.protobuf.Int64Value offset_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Int64Value,
            com.google.protobuf.Int64Value.Builder,
            com.google.protobuf.Int64ValueOrBuilder>
        offsetBuilder_;

    /**
     *
     *
     * <pre>
     * If present, the write is only performed if the next append offset is same
     * as the provided value. If not present, the write is performed at the
     * current end of stream. Specifying a value for this field is not allowed
     * when calling AppendRows for the '_default' stream.
     * </pre>
     *
     * <code>.google.protobuf.Int64Value offset = 2;</code>
     *
     * @return Whether the offset field is set.
     */
    public boolean hasOffset() {
      return ((bitField0_ & 0x00000002) != 0);
    }

    /**
     *
     *
     * <pre>
     * If present, the write is only performed if the next append offset is same
     * as the provided value. If not present, the write is performed at the
     * current end of stream. Specifying a value for this field is not allowed
     * when calling AppendRows for the '_default' stream.
     * </pre>
     *
     * <code>.google.protobuf.Int64Value offset = 2;</code>
     *
     * @return The offset.
     */
    public com.google.protobuf.Int64Value getOffset() {
      if (offsetBuilder_ == null) {
        return offset_ == null ? com.google.protobuf.Int64Value.getDefaultInstance() : offset_;
      } else {
        return offsetBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * If present, the write is only performed if the next append offset is same
     * as the provided value. If not present, the write is performed at the
     * current end of stream. Specifying a value for this field is not allowed
     * when calling AppendRows for the '_default' stream.
     * </pre>
     *
     * <code>.google.protobuf.Int64Value offset = 2;</code>
     */
    public Builder setOffset(com.google.protobuf.Int64Value value) {
      if (offsetBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        offset_ = value;
      } else {
        offsetBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * If present, the write is only performed if the next append offset is same
     * as the provided value. If not present, the write is performed at the
     * current end of stream. Specifying a value for this field is not allowed
     * when calling AppendRows for the '_default' stream.
     * </pre>
     *
     * <code>.google.protobuf.Int64Value offset = 2;</code>
     */
    public Builder setOffset(com.google.protobuf.Int64Value.Builder builderForValue) {
      if (offsetBuilder_ == null) {
        offset_ = builderForValue.build();
      } else {
        offsetBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * If present, the write is only performed if the next append offset is same
     * as the provided value. If not present, the write is performed at the
     * current end of stream. Specifying a value for this field is not allowed
     * when calling AppendRows for the '_default' stream.
     * </pre>
     *
     * <code>.google.protobuf.Int64Value offset = 2;</code>
     */
    public Builder mergeOffset(com.google.protobuf.Int64Value value) {
      if (offsetBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)
            && offset_ != null
            && offset_ != com.google.protobuf.Int64Value.getDefaultInstance()) {
          getOffsetBuilder().mergeFrom(value);
        } else {
          offset_ = value;
        }
      } else {
        offsetBuilder_.mergeFrom(value);
      }
      if (offset_ != null) {
        bitField0_ |= 0x00000002;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * If present, the write is only performed if the next append offset is same
     * as the provided value. If not present, the write is performed at the
     * current end of stream. Specifying a value for this field is not allowed
     * when calling AppendRows for the '_default' stream.
     * </pre>
     *
     * <code>.google.protobuf.Int64Value offset = 2;</code>
     */
    public Builder clearOffset() {
      bitField0_ = (bitField0_ & ~0x00000002);
      offset_ = null;
      if (offsetBuilder_ != null) {
        offsetBuilder_.dispose();
        offsetBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * If present, the write is only performed if the next append offset is same
     * as the provided value. If not present, the write is performed at the
     * current end of stream. Specifying a value for this field is not allowed
     * when calling AppendRows for the '_default' stream.
     * </pre>
     *
     * <code>.google.protobuf.Int64Value offset = 2;</code>
     */
    public com.google.protobuf.Int64Value.Builder getOffsetBuilder() {
      bitField0_ |= 0x00000002;
      onChanged();
      return getOffsetFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * If present, the write is only performed if the next append offset is same
     * as the provided value. If not present, the write is performed at the
     * current end of stream. Specifying a value for this field is not allowed
     * when calling AppendRows for the '_default' stream.
     * </pre>
     *
     * <code>.google.protobuf.Int64Value offset = 2;</code>
     */
    public com.google.protobuf.Int64ValueOrBuilder getOffsetOrBuilder() {
      if (offsetBuilder_ != null) {
        return offsetBuilder_.getMessageOrBuilder();
      } else {
        return offset_ == null ? com.google.protobuf.Int64Value.getDefaultInstance() : offset_;
      }
    }

    /**
     *
     *
     * <pre>
     * If present, the write is only performed if the next append offset is same
     * as the provided value. If not present, the write is performed at the
     * current end of stream. Specifying a value for this field is not allowed
     * when calling AppendRows for the '_default' stream.
     * </pre>
     *
     * <code>.google.protobuf.Int64Value offset = 2;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Int64Value,
            com.google.protobuf.Int64Value.Builder,
            com.google.protobuf.Int64ValueOrBuilder>
        getOffsetFieldBuilder() {
      if (offsetBuilder_ == null) {
        offsetBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Int64Value,
                com.google.protobuf.Int64Value.Builder,
                com.google.protobuf.Int64ValueOrBuilder>(
                getOffset(), getParentForChildren(), isClean());
        offset_ = null;
      }
      return offsetBuilder_;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData,
            com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData.Builder,
            com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoDataOrBuilder>
        protoRowsBuilder_;

    /**
     *
     *
     * <pre>
     * Rows in proto format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;
     * </code>
     *
     * @return Whether the protoRows field is set.
     */
    @java.lang.Override
    public boolean hasProtoRows() {
      return rowsCase_ == 4;
    }

    /**
     *
     *
     * <pre>
     * Rows in proto format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;
     * </code>
     *
     * @return The protoRows.
     */
    @java.lang.Override
    public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData getProtoRows() {
      if (protoRowsBuilder_ == null) {
        if (rowsCase_ == 4) {
          return (com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData) rows_;
        }
        return com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
            .getDefaultInstance();
      } else {
        if (rowsCase_ == 4) {
          return protoRowsBuilder_.getMessage();
        }
        return com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
            .getDefaultInstance();
      }
    }

    /**
     *
     *
     * <pre>
     * Rows in proto format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;
     * </code>
     */
    public Builder setProtoRows(
        com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData value) {
      if (protoRowsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        rows_ = value;
        onChanged();
      } else {
        protoRowsBuilder_.setMessage(value);
      }
      rowsCase_ = 4;
      return this;
    }

    /**
     *
     *
     * <pre>
     * Rows in proto format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;
     * </code>
     */
    public Builder setProtoRows(
        com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData.Builder
            builderForValue) {
      if (protoRowsBuilder_ == null) {
        rows_ = builderForValue.build();
        onChanged();
      } else {
        protoRowsBuilder_.setMessage(builderForValue.build());
      }
      rowsCase_ = 4;
      return this;
    }

    /**
     *
     *
     * <pre>
     * Rows in proto format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;
     * </code>
     */
    public Builder mergeProtoRows(
        com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData value) {
      if (protoRowsBuilder_ == null) {
        if (rowsCase_ == 4
            && rows_
                != com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
                    .getDefaultInstance()) {
          rows_ =
              com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData.newBuilder(
                      (com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData) rows_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          rows_ = value;
        }
        onChanged();
      } else {
        if (rowsCase_ == 4) {
          protoRowsBuilder_.mergeFrom(value);
        } else {
          protoRowsBuilder_.setMessage(value);
        }
      }
      rowsCase_ = 4;
      return this;
    }

    /**
     *
     *
     * <pre>
     * Rows in proto format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;
     * </code>
     */
    public Builder clearProtoRows() {
      if (protoRowsBuilder_ == null) {
        if (rowsCase_ == 4) {
          rowsCase_ = 0;
          rows_ = null;
          onChanged();
        }
      } else {
        if (rowsCase_ == 4) {
          rowsCase_ = 0;
          rows_ = null;
        }
        protoRowsBuilder_.clear();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Rows in proto format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;
     * </code>
     */
    public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData.Builder
        getProtoRowsBuilder() {
      return getProtoRowsFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * Rows in proto format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;
     * </code>
     */
    @java.lang.Override
    public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoDataOrBuilder
        getProtoRowsOrBuilder() {
      if ((rowsCase_ == 4) && (protoRowsBuilder_ != null)) {
        return protoRowsBuilder_.getMessageOrBuilder();
      } else {
        if (rowsCase_ == 4) {
          return (com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData) rows_;
        }
        return com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
            .getDefaultInstance();
      }
    }

    /**
     *
     *
     * <pre>
     * Rows in proto format.
     * </pre>
     *
     * <code>.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData proto_rows = 4;
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData,
            com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData.Builder,
            com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoDataOrBuilder>
        getProtoRowsFieldBuilder() {
      if (protoRowsBuilder_ == null) {
        if (!(rowsCase_ == 4)) {
          rows_ =
              com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData
                  .getDefaultInstance();
        }
        protoRowsBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData,
                com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData.Builder,
                com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoDataOrBuilder>(
                (com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest.ProtoData) rows_,
                getParentForChildren(),
                isClean());
        rows_ = null;
      }
      rowsCase_ = 4;
      onChanged();
      return protoRowsBuilder_;
    }

    private java.lang.Object traceId_ = "";

    /**
     *
     *
     * <pre>
     * Id set by client to annotate its identity. Only initial request setting is
     * respected.
     * </pre>
     *
     * <code>string trace_id = 6;</code>
     *
     * @return The traceId.
     */
    public java.lang.String getTraceId() {
      java.lang.Object ref = traceId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        traceId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * Id set by client to annotate its identity. Only initial request setting is
     * respected.
     * </pre>
     *
     * <code>string trace_id = 6;</code>
     *
     * @return The bytes for traceId.
     */
    public com.google.protobuf.ByteString getTraceIdBytes() {
      java.lang.Object ref = traceId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        traceId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * Id set by client to annotate its identity. Only initial request setting is
     * respected.
     * </pre>
     *
     * <code>string trace_id = 6;</code>
     *
     * @param value The traceId to set.
     * @return This builder for chaining.
     */
    public Builder setTraceId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      traceId_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Id set by client to annotate its identity. Only initial request setting is
     * respected.
     * </pre>
     *
     * <code>string trace_id = 6;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearTraceId() {
      traceId_ = getDefaultInstance().getTraceId();
      bitField0_ = (bitField0_ & ~0x00000008);
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Id set by client to annotate its identity. Only initial request setting is
     * respected.
     * </pre>
     *
     * <code>string trace_id = 6;</code>
     *
     * @param value The bytes for traceId to set.
     * @return This builder for chaining.
     */
    public Builder setTraceIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      traceId_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.cloud.bigquery.storage.v1beta2.AppendRowsRequest)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.bigquery.storage.v1beta2.AppendRowsRequest)
  private static final com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest();
  }

  public static com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<AppendRowsRequest> PARSER =
      new com.google.protobuf.AbstractParser<AppendRowsRequest>() {
        @java.lang.Override
        public AppendRowsRequest parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

  public static com.google.protobuf.Parser<AppendRowsRequest> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<AppendRowsRequest> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.cloud.bigquery.storage.v1beta2.AppendRowsRequest getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
