// Autogenerated by Thrift Compiler (0.13.0)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING

package admin

import (
	"bytes"
	"context"
	"database/sql/driver"
	"errors"
	"fmt"
	"github.com/apache/incubator-pegasus/go-client/idl/base"
	"github.com/apache/incubator-pegasus/go-client/idl/replication"
	"github.com/apache/thrift/lib/go/thrift"
	"reflect"
)

// (needed to ensure safety because of naive import list construction.)
var _ = thrift.ZERO
var _ = fmt.Printf
var _ = context.Background
var _ = reflect.DeepEqual
var _ = bytes.Equal

var _ = base.GoUnusedProtection__
var _ = replication.GoUnusedProtection__

type BulkLoadStatus int64

const (
	BulkLoadStatus_BLS_INVALID     BulkLoadStatus = 0
	BulkLoadStatus_BLS_DOWNLOADING BulkLoadStatus = 1
	BulkLoadStatus_BLS_DOWNLOADED  BulkLoadStatus = 2
	BulkLoadStatus_BLS_INGESTING   BulkLoadStatus = 3
	BulkLoadStatus_BLS_SUCCEED     BulkLoadStatus = 4
	BulkLoadStatus_BLS_FAILED      BulkLoadStatus = 5
	BulkLoadStatus_BLS_PAUSING     BulkLoadStatus = 6
	BulkLoadStatus_BLS_PAUSED      BulkLoadStatus = 7
	BulkLoadStatus_BLS_CANCELED    BulkLoadStatus = 8
)

func (p BulkLoadStatus) String() string {
	switch p {
	case BulkLoadStatus_BLS_INVALID:
		return "BLS_INVALID"
	case BulkLoadStatus_BLS_DOWNLOADING:
		return "BLS_DOWNLOADING"
	case BulkLoadStatus_BLS_DOWNLOADED:
		return "BLS_DOWNLOADED"
	case BulkLoadStatus_BLS_INGESTING:
		return "BLS_INGESTING"
	case BulkLoadStatus_BLS_SUCCEED:
		return "BLS_SUCCEED"
	case BulkLoadStatus_BLS_FAILED:
		return "BLS_FAILED"
	case BulkLoadStatus_BLS_PAUSING:
		return "BLS_PAUSING"
	case BulkLoadStatus_BLS_PAUSED:
		return "BLS_PAUSED"
	case BulkLoadStatus_BLS_CANCELED:
		return "BLS_CANCELED"
	}
	return "<UNSET>"
}

func BulkLoadStatusFromString(s string) (BulkLoadStatus, error) {
	switch s {
	case "BLS_INVALID":
		return BulkLoadStatus_BLS_INVALID, nil
	case "BLS_DOWNLOADING":
		return BulkLoadStatus_BLS_DOWNLOADING, nil
	case "BLS_DOWNLOADED":
		return BulkLoadStatus_BLS_DOWNLOADED, nil
	case "BLS_INGESTING":
		return BulkLoadStatus_BLS_INGESTING, nil
	case "BLS_SUCCEED":
		return BulkLoadStatus_BLS_SUCCEED, nil
	case "BLS_FAILED":
		return BulkLoadStatus_BLS_FAILED, nil
	case "BLS_PAUSING":
		return BulkLoadStatus_BLS_PAUSING, nil
	case "BLS_PAUSED":
		return BulkLoadStatus_BLS_PAUSED, nil
	case "BLS_CANCELED":
		return BulkLoadStatus_BLS_CANCELED, nil
	}
	return BulkLoadStatus(0), fmt.Errorf("not a valid BulkLoadStatus string")
}

func BulkLoadStatusPtr(v BulkLoadStatus) *BulkLoadStatus { return &v }

func (p BulkLoadStatus) MarshalText() ([]byte, error) {
	return []byte(p.String()), nil
}

func (p *BulkLoadStatus) UnmarshalText(text []byte) error {
	q, err := BulkLoadStatusFromString(string(text))
	if err != nil {
		return err
	}
	*p = q
	return nil
}

func (p *BulkLoadStatus) Scan(value interface{}) error {
	v, ok := value.(int64)
	if !ok {
		return errors.New("Scan value is not int64")
	}
	*p = BulkLoadStatus(v)
	return nil
}

func (p *BulkLoadStatus) Value() (driver.Value, error) {
	if p == nil {
		return nil, nil
	}
	return int64(*p), nil
}

type IngestionStatus int64

const (
	IngestionStatus_IS_INVALID IngestionStatus = 0
	IngestionStatus_IS_RUNNING IngestionStatus = 1
	IngestionStatus_IS_SUCCEED IngestionStatus = 2
	IngestionStatus_IS_FAILED  IngestionStatus = 3
)

func (p IngestionStatus) String() string {
	switch p {
	case IngestionStatus_IS_INVALID:
		return "IS_INVALID"
	case IngestionStatus_IS_RUNNING:
		return "IS_RUNNING"
	case IngestionStatus_IS_SUCCEED:
		return "IS_SUCCEED"
	case IngestionStatus_IS_FAILED:
		return "IS_FAILED"
	}
	return "<UNSET>"
}

func IngestionStatusFromString(s string) (IngestionStatus, error) {
	switch s {
	case "IS_INVALID":
		return IngestionStatus_IS_INVALID, nil
	case "IS_RUNNING":
		return IngestionStatus_IS_RUNNING, nil
	case "IS_SUCCEED":
		return IngestionStatus_IS_SUCCEED, nil
	case "IS_FAILED":
		return IngestionStatus_IS_FAILED, nil
	}
	return IngestionStatus(0), fmt.Errorf("not a valid IngestionStatus string")
}

func IngestionStatusPtr(v IngestionStatus) *IngestionStatus { return &v }

func (p IngestionStatus) MarshalText() ([]byte, error) {
	return []byte(p.String()), nil
}

func (p *IngestionStatus) UnmarshalText(text []byte) error {
	q, err := IngestionStatusFromString(string(text))
	if err != nil {
		return err
	}
	*p = q
	return nil
}

func (p *IngestionStatus) Scan(value interface{}) error {
	v, ok := value.(int64)
	if !ok {
		return errors.New("Scan value is not int64")
	}
	*p = IngestionStatus(v)
	return nil
}

func (p *IngestionStatus) Value() (driver.Value, error) {
	if p == nil {
		return nil, nil
	}
	return int64(*p), nil
}

type BulkLoadControlType int64

const (
	BulkLoadControlType_BLC_PAUSE        BulkLoadControlType = 0
	BulkLoadControlType_BLC_RESTART      BulkLoadControlType = 1
	BulkLoadControlType_BLC_CANCEL       BulkLoadControlType = 2
	BulkLoadControlType_BLC_FORCE_CANCEL BulkLoadControlType = 3
)

func (p BulkLoadControlType) String() string {
	switch p {
	case BulkLoadControlType_BLC_PAUSE:
		return "BLC_PAUSE"
	case BulkLoadControlType_BLC_RESTART:
		return "BLC_RESTART"
	case BulkLoadControlType_BLC_CANCEL:
		return "BLC_CANCEL"
	case BulkLoadControlType_BLC_FORCE_CANCEL:
		return "BLC_FORCE_CANCEL"
	}
	return "<UNSET>"
}

func BulkLoadControlTypeFromString(s string) (BulkLoadControlType, error) {
	switch s {
	case "BLC_PAUSE":
		return BulkLoadControlType_BLC_PAUSE, nil
	case "BLC_RESTART":
		return BulkLoadControlType_BLC_RESTART, nil
	case "BLC_CANCEL":
		return BulkLoadControlType_BLC_CANCEL, nil
	case "BLC_FORCE_CANCEL":
		return BulkLoadControlType_BLC_FORCE_CANCEL, nil
	}
	return BulkLoadControlType(0), fmt.Errorf("not a valid BulkLoadControlType string")
}

func BulkLoadControlTypePtr(v BulkLoadControlType) *BulkLoadControlType { return &v }

func (p BulkLoadControlType) MarshalText() ([]byte, error) {
	return []byte(p.String()), nil
}

func (p *BulkLoadControlType) UnmarshalText(text []byte) error {
	q, err := BulkLoadControlTypeFromString(string(text))
	if err != nil {
		return err
	}
	*p = q
	return nil
}

func (p *BulkLoadControlType) Scan(value interface{}) error {
	v, ok := value.(int64)
	if !ok {
		return errors.New("Scan value is not int64")
	}
	*p = BulkLoadControlType(v)
	return nil
}

func (p *BulkLoadControlType) Value() (driver.Value, error) {
	if p == nil {
		return nil, nil
	}
	return int64(*p), nil
}

// Attributes:
//  - Files
//  - FileTotalSize
type BulkLoadMetadata struct {
	Files         []*FileMeta `thrift:"files,1" db:"files" json:"files"`
	FileTotalSize int64       `thrift:"file_total_size,2" db:"file_total_size" json:"file_total_size"`
}

func NewBulkLoadMetadata() *BulkLoadMetadata {
	return &BulkLoadMetadata{}
}

func (p *BulkLoadMetadata) GetFiles() []*FileMeta {
	return p.Files
}

func (p *BulkLoadMetadata) GetFileTotalSize() int64 {
	return p.FileTotalSize
}
func (p *BulkLoadMetadata) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.LIST {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I64 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *BulkLoadMetadata) ReadField1(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return thrift.PrependError("error reading list begin: ", err)
	}
	tSlice := make([]*FileMeta, 0, size)
	p.Files = tSlice
	for i := 0; i < size; i++ {
		_elem0 := &FileMeta{}
		if err := _elem0.Read(iprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err)
		}
		p.Files = append(p.Files, _elem0)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return thrift.PrependError("error reading list end: ", err)
	}
	return nil
}

func (p *BulkLoadMetadata) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.FileTotalSize = v
	}
	return nil
}

func (p *BulkLoadMetadata) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("bulk_load_metadata"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *BulkLoadMetadata) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("files", thrift.LIST, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:files: ", p), err)
	}
	if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Files)); err != nil {
		return thrift.PrependError("error writing list begin: ", err)
	}
	for _, v := range p.Files {
		if err := v.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
		}
	}
	if err := oprot.WriteListEnd(); err != nil {
		return thrift.PrependError("error writing list end: ", err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:files: ", p), err)
	}
	return err
}

func (p *BulkLoadMetadata) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("file_total_size", thrift.I64, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:file_total_size: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.FileTotalSize)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.file_total_size (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:file_total_size: ", p), err)
	}
	return err
}

func (p *BulkLoadMetadata) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("BulkLoadMetadata(%+v)", *p)
}

// Attributes:
//  - AppName
//  - ClusterName
//  - FileProviderType
//  - RemoteRootPath
//  - IngestBehind
type StartBulkLoadRequest struct {
	AppName          string `thrift:"app_name,1" db:"app_name" json:"app_name"`
	ClusterName      string `thrift:"cluster_name,2" db:"cluster_name" json:"cluster_name"`
	FileProviderType string `thrift:"file_provider_type,3" db:"file_provider_type" json:"file_provider_type"`
	RemoteRootPath   string `thrift:"remote_root_path,4" db:"remote_root_path" json:"remote_root_path"`
	IngestBehind     bool   `thrift:"ingest_behind,5" db:"ingest_behind" json:"ingest_behind"`
}

func NewStartBulkLoadRequest() *StartBulkLoadRequest {
	return &StartBulkLoadRequest{}
}

func (p *StartBulkLoadRequest) GetAppName() string {
	return p.AppName
}

func (p *StartBulkLoadRequest) GetClusterName() string {
	return p.ClusterName
}

func (p *StartBulkLoadRequest) GetFileProviderType() string {
	return p.FileProviderType
}

func (p *StartBulkLoadRequest) GetRemoteRootPath() string {
	return p.RemoteRootPath
}

func (p *StartBulkLoadRequest) GetIngestBehind() bool {
	return p.IngestBehind
}
func (p *StartBulkLoadRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 5:
			if fieldTypeId == thrift.BOOL {
				if err := p.ReadField5(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *StartBulkLoadRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *StartBulkLoadRequest) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.ClusterName = v
	}
	return nil
}

func (p *StartBulkLoadRequest) ReadField3(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 3: ", err)
	} else {
		p.FileProviderType = v
	}
	return nil
}

func (p *StartBulkLoadRequest) ReadField4(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 4: ", err)
	} else {
		p.RemoteRootPath = v
	}
	return nil
}

func (p *StartBulkLoadRequest) ReadField5(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return thrift.PrependError("error reading field 5: ", err)
	} else {
		p.IngestBehind = v
	}
	return nil
}

func (p *StartBulkLoadRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("start_bulk_load_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
		if err := p.writeField5(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *StartBulkLoadRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app_name: ", p), err)
	}
	return err
}

func (p *StartBulkLoadRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("cluster_name", thrift.STRING, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:cluster_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.ClusterName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.cluster_name (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:cluster_name: ", p), err)
	}
	return err
}

func (p *StartBulkLoadRequest) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("file_provider_type", thrift.STRING, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:file_provider_type: ", p), err)
	}
	if err := oprot.WriteString(string(p.FileProviderType)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.file_provider_type (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:file_provider_type: ", p), err)
	}
	return err
}

func (p *StartBulkLoadRequest) writeField4(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("remote_root_path", thrift.STRING, 4); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:remote_root_path: ", p), err)
	}
	if err := oprot.WriteString(string(p.RemoteRootPath)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.remote_root_path (4) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 4:remote_root_path: ", p), err)
	}
	return err
}

func (p *StartBulkLoadRequest) writeField5(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("ingest_behind", thrift.BOOL, 5); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:ingest_behind: ", p), err)
	}
	if err := oprot.WriteBool(bool(p.IngestBehind)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.ingest_behind (5) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 5:ingest_behind: ", p), err)
	}
	return err
}

func (p *StartBulkLoadRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("StartBulkLoadRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - HintMsg
type StartBulkLoadResponse struct {
	Err     *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
	HintMsg string          `thrift:"hint_msg,2" db:"hint_msg" json:"hint_msg"`
}

func NewStartBulkLoadResponse() *StartBulkLoadResponse {
	return &StartBulkLoadResponse{}
}

var StartBulkLoadResponse_Err_DEFAULT *base.ErrorCode

func (p *StartBulkLoadResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return StartBulkLoadResponse_Err_DEFAULT
	}
	return p.Err
}

func (p *StartBulkLoadResponse) GetHintMsg() string {
	return p.HintMsg
}
func (p *StartBulkLoadResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *StartBulkLoadResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *StartBulkLoadResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *StartBulkLoadResponse) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.HintMsg = v
	}
	return nil
}

func (p *StartBulkLoadResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("start_bulk_load_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *StartBulkLoadResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *StartBulkLoadResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("hint_msg", thrift.STRING, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hint_msg: ", p), err)
	}
	if err := oprot.WriteString(string(p.HintMsg)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.hint_msg (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:hint_msg: ", p), err)
	}
	return err
}

func (p *StartBulkLoadResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("StartBulkLoadResponse(%+v)", *p)
}

// Attributes:
//  - DownloadProgress
//  - DownloadStatus
//  - IngestStatus
//  - IsCleanedUp
//  - IsPaused
type PartitionBulkLoadState struct {
	DownloadProgress int32           `thrift:"download_progress,1" db:"download_progress" json:"download_progress"`
	DownloadStatus   *base.ErrorCode `thrift:"download_status,2" db:"download_status" json:"download_status,omitempty"`
	IngestStatus     IngestionStatus `thrift:"ingest_status,3" db:"ingest_status" json:"ingest_status"`
	IsCleanedUp      bool            `thrift:"is_cleaned_up,4" db:"is_cleaned_up" json:"is_cleaned_up"`
	IsPaused         bool            `thrift:"is_paused,5" db:"is_paused" json:"is_paused"`
}

func NewPartitionBulkLoadState() *PartitionBulkLoadState {
	return &PartitionBulkLoadState{
		IngestStatus: 0,
	}
}

var PartitionBulkLoadState_DownloadProgress_DEFAULT int32 = 0

func (p *PartitionBulkLoadState) GetDownloadProgress() int32 {
	return p.DownloadProgress
}

var PartitionBulkLoadState_DownloadStatus_DEFAULT *base.ErrorCode

func (p *PartitionBulkLoadState) GetDownloadStatus() *base.ErrorCode {
	if !p.IsSetDownloadStatus() {
		return PartitionBulkLoadState_DownloadStatus_DEFAULT
	}
	return p.DownloadStatus
}

var PartitionBulkLoadState_IngestStatus_DEFAULT IngestionStatus = 0

func (p *PartitionBulkLoadState) GetIngestStatus() IngestionStatus {
	return p.IngestStatus
}

var PartitionBulkLoadState_IsCleanedUp_DEFAULT bool = false

func (p *PartitionBulkLoadState) GetIsCleanedUp() bool {
	return p.IsCleanedUp
}

var PartitionBulkLoadState_IsPaused_DEFAULT bool = false

func (p *PartitionBulkLoadState) GetIsPaused() bool {
	return p.IsPaused
}
func (p *PartitionBulkLoadState) IsSetDownloadProgress() bool {
	return p.DownloadProgress != PartitionBulkLoadState_DownloadProgress_DEFAULT
}

func (p *PartitionBulkLoadState) IsSetDownloadStatus() bool {
	return p.DownloadStatus != nil
}

func (p *PartitionBulkLoadState) IsSetIngestStatus() bool {
	return p.IngestStatus != PartitionBulkLoadState_IngestStatus_DEFAULT
}

func (p *PartitionBulkLoadState) IsSetIsCleanedUp() bool {
	return p.IsCleanedUp != PartitionBulkLoadState_IsCleanedUp_DEFAULT
}

func (p *PartitionBulkLoadState) IsSetIsPaused() bool {
	return p.IsPaused != PartitionBulkLoadState_IsPaused_DEFAULT
}

func (p *PartitionBulkLoadState) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.BOOL {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 5:
			if fieldTypeId == thrift.BOOL {
				if err := p.ReadField5(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *PartitionBulkLoadState) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.DownloadProgress = v
	}
	return nil
}

func (p *PartitionBulkLoadState) ReadField2(iprot thrift.TProtocol) error {
	p.DownloadStatus = &base.ErrorCode{}
	if err := p.DownloadStatus.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DownloadStatus), err)
	}
	return nil
}

func (p *PartitionBulkLoadState) ReadField3(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 3: ", err)
	} else {
		temp := IngestionStatus(v)
		p.IngestStatus = temp
	}
	return nil
}

func (p *PartitionBulkLoadState) ReadField4(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return thrift.PrependError("error reading field 4: ", err)
	} else {
		p.IsCleanedUp = v
	}
	return nil
}

func (p *PartitionBulkLoadState) ReadField5(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return thrift.PrependError("error reading field 5: ", err)
	} else {
		p.IsPaused = v
	}
	return nil
}

func (p *PartitionBulkLoadState) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("partition_bulk_load_state"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
		if err := p.writeField5(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *PartitionBulkLoadState) writeField1(oprot thrift.TProtocol) (err error) {
	if p.IsSetDownloadProgress() {
		if err := oprot.WriteFieldBegin("download_progress", thrift.I32, 1); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:download_progress: ", p), err)
		}
		if err := oprot.WriteI32(int32(p.DownloadProgress)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.download_progress (1) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 1:download_progress: ", p), err)
		}
	}
	return err
}

func (p *PartitionBulkLoadState) writeField2(oprot thrift.TProtocol) (err error) {
	if p.IsSetDownloadStatus() {
		if err := oprot.WriteFieldBegin("download_status", thrift.STRUCT, 2); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:download_status: ", p), err)
		}
		if err := p.DownloadStatus.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DownloadStatus), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 2:download_status: ", p), err)
		}
	}
	return err
}

func (p *PartitionBulkLoadState) writeField3(oprot thrift.TProtocol) (err error) {
	if p.IsSetIngestStatus() {
		if err := oprot.WriteFieldBegin("ingest_status", thrift.I32, 3); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:ingest_status: ", p), err)
		}
		if err := oprot.WriteI32(int32(p.IngestStatus)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.ingest_status (3) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 3:ingest_status: ", p), err)
		}
	}
	return err
}

func (p *PartitionBulkLoadState) writeField4(oprot thrift.TProtocol) (err error) {
	if p.IsSetIsCleanedUp() {
		if err := oprot.WriteFieldBegin("is_cleaned_up", thrift.BOOL, 4); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:is_cleaned_up: ", p), err)
		}
		if err := oprot.WriteBool(bool(p.IsCleanedUp)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.is_cleaned_up (4) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 4:is_cleaned_up: ", p), err)
		}
	}
	return err
}

func (p *PartitionBulkLoadState) writeField5(oprot thrift.TProtocol) (err error) {
	if p.IsSetIsPaused() {
		if err := oprot.WriteFieldBegin("is_paused", thrift.BOOL, 5); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:is_paused: ", p), err)
		}
		if err := oprot.WriteBool(bool(p.IsPaused)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.is_paused (5) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 5:is_paused: ", p), err)
		}
	}
	return err
}

func (p *PartitionBulkLoadState) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("PartitionBulkLoadState(%+v)", *p)
}

// Attributes:
//  - Pid
//  - AppName
//  - Primary
//  - RemoteProviderName
//  - ClusterName
//  - Ballot
//  - MetaBulkLoadStatus
//  - QueryBulkLoadMetadata
//  - RemoteRootPath
//  - HpPrimary
type BulkLoadRequest struct {
	Pid                   *base.Gpid       `thrift:"pid,1" db:"pid" json:"pid"`
	AppName               string           `thrift:"app_name,2" db:"app_name" json:"app_name"`
	Primary               *base.RPCAddress `thrift:"primary,3" db:"primary" json:"primary"`
	RemoteProviderName    string           `thrift:"remote_provider_name,4" db:"remote_provider_name" json:"remote_provider_name"`
	ClusterName           string           `thrift:"cluster_name,5" db:"cluster_name" json:"cluster_name"`
	Ballot                int64            `thrift:"ballot,6" db:"ballot" json:"ballot"`
	MetaBulkLoadStatus    BulkLoadStatus   `thrift:"meta_bulk_load_status,7" db:"meta_bulk_load_status" json:"meta_bulk_load_status"`
	QueryBulkLoadMetadata bool             `thrift:"query_bulk_load_metadata,8" db:"query_bulk_load_metadata" json:"query_bulk_load_metadata"`
	RemoteRootPath        string           `thrift:"remote_root_path,9" db:"remote_root_path" json:"remote_root_path"`
	HpPrimary             *base.HostPort   `thrift:"hp_primary,10" db:"hp_primary" json:"hp_primary,omitempty"`
}

func NewBulkLoadRequest() *BulkLoadRequest {
	return &BulkLoadRequest{}
}

var BulkLoadRequest_Pid_DEFAULT *base.Gpid

func (p *BulkLoadRequest) GetPid() *base.Gpid {
	if !p.IsSetPid() {
		return BulkLoadRequest_Pid_DEFAULT
	}
	return p.Pid
}

func (p *BulkLoadRequest) GetAppName() string {
	return p.AppName
}

var BulkLoadRequest_Primary_DEFAULT *base.RPCAddress

func (p *BulkLoadRequest) GetPrimary() *base.RPCAddress {
	if !p.IsSetPrimary() {
		return BulkLoadRequest_Primary_DEFAULT
	}
	return p.Primary
}

func (p *BulkLoadRequest) GetRemoteProviderName() string {
	return p.RemoteProviderName
}

func (p *BulkLoadRequest) GetClusterName() string {
	return p.ClusterName
}

func (p *BulkLoadRequest) GetBallot() int64 {
	return p.Ballot
}

func (p *BulkLoadRequest) GetMetaBulkLoadStatus() BulkLoadStatus {
	return p.MetaBulkLoadStatus
}

func (p *BulkLoadRequest) GetQueryBulkLoadMetadata() bool {
	return p.QueryBulkLoadMetadata
}

func (p *BulkLoadRequest) GetRemoteRootPath() string {
	return p.RemoteRootPath
}

var BulkLoadRequest_HpPrimary_DEFAULT *base.HostPort

func (p *BulkLoadRequest) GetHpPrimary() *base.HostPort {
	if !p.IsSetHpPrimary() {
		return BulkLoadRequest_HpPrimary_DEFAULT
	}
	return p.HpPrimary
}
func (p *BulkLoadRequest) IsSetPid() bool {
	return p.Pid != nil
}

func (p *BulkLoadRequest) IsSetPrimary() bool {
	return p.Primary != nil
}

func (p *BulkLoadRequest) IsSetHpPrimary() bool {
	return p.HpPrimary != nil
}

func (p *BulkLoadRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 5:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField5(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 6:
			if fieldTypeId == thrift.I64 {
				if err := p.ReadField6(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 7:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField7(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 8:
			if fieldTypeId == thrift.BOOL {
				if err := p.ReadField8(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 9:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField9(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 10:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField10(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *BulkLoadRequest) ReadField1(iprot thrift.TProtocol) error {
	p.Pid = &base.Gpid{}
	if err := p.Pid.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Pid), err)
	}
	return nil
}

func (p *BulkLoadRequest) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *BulkLoadRequest) ReadField3(iprot thrift.TProtocol) error {
	p.Primary = &base.RPCAddress{}
	if err := p.Primary.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Primary), err)
	}
	return nil
}

func (p *BulkLoadRequest) ReadField4(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 4: ", err)
	} else {
		p.RemoteProviderName = v
	}
	return nil
}

func (p *BulkLoadRequest) ReadField5(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 5: ", err)
	} else {
		p.ClusterName = v
	}
	return nil
}

func (p *BulkLoadRequest) ReadField6(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 6: ", err)
	} else {
		p.Ballot = v
	}
	return nil
}

func (p *BulkLoadRequest) ReadField7(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 7: ", err)
	} else {
		temp := BulkLoadStatus(v)
		p.MetaBulkLoadStatus = temp
	}
	return nil
}

func (p *BulkLoadRequest) ReadField8(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return thrift.PrependError("error reading field 8: ", err)
	} else {
		p.QueryBulkLoadMetadata = v
	}
	return nil
}

func (p *BulkLoadRequest) ReadField9(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 9: ", err)
	} else {
		p.RemoteRootPath = v
	}
	return nil
}

func (p *BulkLoadRequest) ReadField10(iprot thrift.TProtocol) error {
	p.HpPrimary = &base.HostPort{}
	if err := p.HpPrimary.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.HpPrimary), err)
	}
	return nil
}

func (p *BulkLoadRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("bulk_load_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
		if err := p.writeField5(oprot); err != nil {
			return err
		}
		if err := p.writeField6(oprot); err != nil {
			return err
		}
		if err := p.writeField7(oprot); err != nil {
			return err
		}
		if err := p.writeField8(oprot); err != nil {
			return err
		}
		if err := p.writeField9(oprot); err != nil {
			return err
		}
		if err := p.writeField10(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *BulkLoadRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("pid", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:pid: ", p), err)
	}
	if err := p.Pid.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Pid), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:pid: ", p), err)
	}
	return err
}

func (p *BulkLoadRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:app_name: ", p), err)
	}
	return err
}

func (p *BulkLoadRequest) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("primary", thrift.STRUCT, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:primary: ", p), err)
	}
	if err := p.Primary.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Primary), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:primary: ", p), err)
	}
	return err
}

func (p *BulkLoadRequest) writeField4(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("remote_provider_name", thrift.STRING, 4); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:remote_provider_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.RemoteProviderName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.remote_provider_name (4) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 4:remote_provider_name: ", p), err)
	}
	return err
}

func (p *BulkLoadRequest) writeField5(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("cluster_name", thrift.STRING, 5); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:cluster_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.ClusterName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.cluster_name (5) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 5:cluster_name: ", p), err)
	}
	return err
}

func (p *BulkLoadRequest) writeField6(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("ballot", thrift.I64, 6); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:ballot: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Ballot)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.ballot (6) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 6:ballot: ", p), err)
	}
	return err
}

func (p *BulkLoadRequest) writeField7(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("meta_bulk_load_status", thrift.I32, 7); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:meta_bulk_load_status: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.MetaBulkLoadStatus)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.meta_bulk_load_status (7) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 7:meta_bulk_load_status: ", p), err)
	}
	return err
}

func (p *BulkLoadRequest) writeField8(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("query_bulk_load_metadata", thrift.BOOL, 8); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:query_bulk_load_metadata: ", p), err)
	}
	if err := oprot.WriteBool(bool(p.QueryBulkLoadMetadata)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.query_bulk_load_metadata (8) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 8:query_bulk_load_metadata: ", p), err)
	}
	return err
}

func (p *BulkLoadRequest) writeField9(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("remote_root_path", thrift.STRING, 9); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:remote_root_path: ", p), err)
	}
	if err := oprot.WriteString(string(p.RemoteRootPath)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.remote_root_path (9) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 9:remote_root_path: ", p), err)
	}
	return err
}

func (p *BulkLoadRequest) writeField10(oprot thrift.TProtocol) (err error) {
	if p.IsSetHpPrimary() {
		if err := oprot.WriteFieldBegin("hp_primary", thrift.STRUCT, 10); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:hp_primary: ", p), err)
		}
		if err := p.HpPrimary.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.HpPrimary), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 10:hp_primary: ", p), err)
		}
	}
	return err
}

func (p *BulkLoadRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("BulkLoadRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - Pid
//  - AppName
//  - PrimaryBulkLoadStatus
//  - GroupBulkLoadState
//  - Metadata
//  - TotalDownloadProgress
//  - IsGroupIngestionFinished
//  - IsGroupBulkLoadContextCleanedUp
//  - IsGroupBulkLoadPaused
//  - HpGroupBulkLoadState
type BulkLoadResponse struct {
	Err                             *base.ErrorCode                              `thrift:"err,1" db:"err" json:"err"`
	Pid                             *base.Gpid                                   `thrift:"pid,2" db:"pid" json:"pid"`
	AppName                         string                                       `thrift:"app_name,3" db:"app_name" json:"app_name"`
	PrimaryBulkLoadStatus           BulkLoadStatus                               `thrift:"primary_bulk_load_status,4" db:"primary_bulk_load_status" json:"primary_bulk_load_status"`
	GroupBulkLoadState              map[*base.RPCAddress]*PartitionBulkLoadState `thrift:"group_bulk_load_state,5" db:"group_bulk_load_state" json:"group_bulk_load_state"`
	Metadata                        *BulkLoadMetadata                            `thrift:"metadata,6" db:"metadata" json:"metadata,omitempty"`
	TotalDownloadProgress           *int32                                       `thrift:"total_download_progress,7" db:"total_download_progress" json:"total_download_progress,omitempty"`
	IsGroupIngestionFinished        *bool                                        `thrift:"is_group_ingestion_finished,8" db:"is_group_ingestion_finished" json:"is_group_ingestion_finished,omitempty"`
	IsGroupBulkLoadContextCleanedUp *bool                                        `thrift:"is_group_bulk_load_context_cleaned_up,9" db:"is_group_bulk_load_context_cleaned_up" json:"is_group_bulk_load_context_cleaned_up,omitempty"`
	IsGroupBulkLoadPaused           *bool                                        `thrift:"is_group_bulk_load_paused,10" db:"is_group_bulk_load_paused" json:"is_group_bulk_load_paused,omitempty"`
	HpGroupBulkLoadState            map[*base.HostPort]*PartitionBulkLoadState   `thrift:"hp_group_bulk_load_state,11" db:"hp_group_bulk_load_state" json:"hp_group_bulk_load_state,omitempty"`
}

func NewBulkLoadResponse() *BulkLoadResponse {
	return &BulkLoadResponse{}
}

var BulkLoadResponse_Err_DEFAULT *base.ErrorCode

func (p *BulkLoadResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return BulkLoadResponse_Err_DEFAULT
	}
	return p.Err
}

var BulkLoadResponse_Pid_DEFAULT *base.Gpid

func (p *BulkLoadResponse) GetPid() *base.Gpid {
	if !p.IsSetPid() {
		return BulkLoadResponse_Pid_DEFAULT
	}
	return p.Pid
}

func (p *BulkLoadResponse) GetAppName() string {
	return p.AppName
}

func (p *BulkLoadResponse) GetPrimaryBulkLoadStatus() BulkLoadStatus {
	return p.PrimaryBulkLoadStatus
}

func (p *BulkLoadResponse) GetGroupBulkLoadState() map[*base.RPCAddress]*PartitionBulkLoadState {
	return p.GroupBulkLoadState
}

var BulkLoadResponse_Metadata_DEFAULT *BulkLoadMetadata

func (p *BulkLoadResponse) GetMetadata() *BulkLoadMetadata {
	if !p.IsSetMetadata() {
		return BulkLoadResponse_Metadata_DEFAULT
	}
	return p.Metadata
}

var BulkLoadResponse_TotalDownloadProgress_DEFAULT int32

func (p *BulkLoadResponse) GetTotalDownloadProgress() int32 {
	if !p.IsSetTotalDownloadProgress() {
		return BulkLoadResponse_TotalDownloadProgress_DEFAULT
	}
	return *p.TotalDownloadProgress
}

var BulkLoadResponse_IsGroupIngestionFinished_DEFAULT bool

func (p *BulkLoadResponse) GetIsGroupIngestionFinished() bool {
	if !p.IsSetIsGroupIngestionFinished() {
		return BulkLoadResponse_IsGroupIngestionFinished_DEFAULT
	}
	return *p.IsGroupIngestionFinished
}

var BulkLoadResponse_IsGroupBulkLoadContextCleanedUp_DEFAULT bool

func (p *BulkLoadResponse) GetIsGroupBulkLoadContextCleanedUp() bool {
	if !p.IsSetIsGroupBulkLoadContextCleanedUp() {
		return BulkLoadResponse_IsGroupBulkLoadContextCleanedUp_DEFAULT
	}
	return *p.IsGroupBulkLoadContextCleanedUp
}

var BulkLoadResponse_IsGroupBulkLoadPaused_DEFAULT bool

func (p *BulkLoadResponse) GetIsGroupBulkLoadPaused() bool {
	if !p.IsSetIsGroupBulkLoadPaused() {
		return BulkLoadResponse_IsGroupBulkLoadPaused_DEFAULT
	}
	return *p.IsGroupBulkLoadPaused
}

var BulkLoadResponse_HpGroupBulkLoadState_DEFAULT map[*base.HostPort]*PartitionBulkLoadState

func (p *BulkLoadResponse) GetHpGroupBulkLoadState() map[*base.HostPort]*PartitionBulkLoadState {
	return p.HpGroupBulkLoadState
}
func (p *BulkLoadResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *BulkLoadResponse) IsSetPid() bool {
	return p.Pid != nil
}

func (p *BulkLoadResponse) IsSetMetadata() bool {
	return p.Metadata != nil
}

func (p *BulkLoadResponse) IsSetTotalDownloadProgress() bool {
	return p.TotalDownloadProgress != nil
}

func (p *BulkLoadResponse) IsSetIsGroupIngestionFinished() bool {
	return p.IsGroupIngestionFinished != nil
}

func (p *BulkLoadResponse) IsSetIsGroupBulkLoadContextCleanedUp() bool {
	return p.IsGroupBulkLoadContextCleanedUp != nil
}

func (p *BulkLoadResponse) IsSetIsGroupBulkLoadPaused() bool {
	return p.IsGroupBulkLoadPaused != nil
}

func (p *BulkLoadResponse) IsSetHpGroupBulkLoadState() bool {
	return p.HpGroupBulkLoadState != nil
}

func (p *BulkLoadResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 5:
			if fieldTypeId == thrift.MAP {
				if err := p.ReadField5(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 6:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField6(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 7:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField7(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 8:
			if fieldTypeId == thrift.BOOL {
				if err := p.ReadField8(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 9:
			if fieldTypeId == thrift.BOOL {
				if err := p.ReadField9(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 10:
			if fieldTypeId == thrift.BOOL {
				if err := p.ReadField10(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 11:
			if fieldTypeId == thrift.MAP {
				if err := p.ReadField11(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *BulkLoadResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *BulkLoadResponse) ReadField2(iprot thrift.TProtocol) error {
	p.Pid = &base.Gpid{}
	if err := p.Pid.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Pid), err)
	}
	return nil
}

func (p *BulkLoadResponse) ReadField3(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 3: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *BulkLoadResponse) ReadField4(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 4: ", err)
	} else {
		temp := BulkLoadStatus(v)
		p.PrimaryBulkLoadStatus = temp
	}
	return nil
}

func (p *BulkLoadResponse) ReadField5(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return thrift.PrependError("error reading map begin: ", err)
	}
	tMap := make(map[*base.RPCAddress]*PartitionBulkLoadState, size)
	p.GroupBulkLoadState = tMap
	for i := 0; i < size; i++ {
		_key1 := &base.RPCAddress{}
		if err := _key1.Read(iprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _key1), err)
		}
		_val2 := &PartitionBulkLoadState{
			IngestStatus: 0,
		}
		if err := _val2.Read(iprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val2), err)
		}
		p.GroupBulkLoadState[_key1] = _val2
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return thrift.PrependError("error reading map end: ", err)
	}
	return nil
}

func (p *BulkLoadResponse) ReadField6(iprot thrift.TProtocol) error {
	p.Metadata = &BulkLoadMetadata{}
	if err := p.Metadata.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Metadata), err)
	}
	return nil
}

func (p *BulkLoadResponse) ReadField7(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 7: ", err)
	} else {
		p.TotalDownloadProgress = &v
	}
	return nil
}

func (p *BulkLoadResponse) ReadField8(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return thrift.PrependError("error reading field 8: ", err)
	} else {
		p.IsGroupIngestionFinished = &v
	}
	return nil
}

func (p *BulkLoadResponse) ReadField9(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return thrift.PrependError("error reading field 9: ", err)
	} else {
		p.IsGroupBulkLoadContextCleanedUp = &v
	}
	return nil
}

func (p *BulkLoadResponse) ReadField10(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return thrift.PrependError("error reading field 10: ", err)
	} else {
		p.IsGroupBulkLoadPaused = &v
	}
	return nil
}

func (p *BulkLoadResponse) ReadField11(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return thrift.PrependError("error reading map begin: ", err)
	}
	tMap := make(map[*base.HostPort]*PartitionBulkLoadState, size)
	p.HpGroupBulkLoadState = tMap
	for i := 0; i < size; i++ {
		_key3 := &base.HostPort{}
		if err := _key3.Read(iprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _key3), err)
		}
		_val4 := &PartitionBulkLoadState{
			IngestStatus: 0,
		}
		if err := _val4.Read(iprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val4), err)
		}
		p.HpGroupBulkLoadState[_key3] = _val4
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return thrift.PrependError("error reading map end: ", err)
	}
	return nil
}

func (p *BulkLoadResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("bulk_load_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
		if err := p.writeField5(oprot); err != nil {
			return err
		}
		if err := p.writeField6(oprot); err != nil {
			return err
		}
		if err := p.writeField7(oprot); err != nil {
			return err
		}
		if err := p.writeField8(oprot); err != nil {
			return err
		}
		if err := p.writeField9(oprot); err != nil {
			return err
		}
		if err := p.writeField10(oprot); err != nil {
			return err
		}
		if err := p.writeField11(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *BulkLoadResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *BulkLoadResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("pid", thrift.STRUCT, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:pid: ", p), err)
	}
	if err := p.Pid.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Pid), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:pid: ", p), err)
	}
	return err
}

func (p *BulkLoadResponse) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:app_name: ", p), err)
	}
	return err
}

func (p *BulkLoadResponse) writeField4(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("primary_bulk_load_status", thrift.I32, 4); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:primary_bulk_load_status: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.PrimaryBulkLoadStatus)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.primary_bulk_load_status (4) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 4:primary_bulk_load_status: ", p), err)
	}
	return err
}

func (p *BulkLoadResponse) writeField5(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("group_bulk_load_state", thrift.MAP, 5); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:group_bulk_load_state: ", p), err)
	}
	if err := oprot.WriteMapBegin(thrift.STRUCT, thrift.STRUCT, len(p.GroupBulkLoadState)); err != nil {
		return thrift.PrependError("error writing map begin: ", err)
	}
	for k, v := range p.GroupBulkLoadState {
		if err := k.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", k), err)
		}
		if err := v.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return thrift.PrependError("error writing map end: ", err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 5:group_bulk_load_state: ", p), err)
	}
	return err
}

func (p *BulkLoadResponse) writeField6(oprot thrift.TProtocol) (err error) {
	if p.IsSetMetadata() {
		if err := oprot.WriteFieldBegin("metadata", thrift.STRUCT, 6); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:metadata: ", p), err)
		}
		if err := p.Metadata.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Metadata), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 6:metadata: ", p), err)
		}
	}
	return err
}

func (p *BulkLoadResponse) writeField7(oprot thrift.TProtocol) (err error) {
	if p.IsSetTotalDownloadProgress() {
		if err := oprot.WriteFieldBegin("total_download_progress", thrift.I32, 7); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:total_download_progress: ", p), err)
		}
		if err := oprot.WriteI32(int32(*p.TotalDownloadProgress)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.total_download_progress (7) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 7:total_download_progress: ", p), err)
		}
	}
	return err
}

func (p *BulkLoadResponse) writeField8(oprot thrift.TProtocol) (err error) {
	if p.IsSetIsGroupIngestionFinished() {
		if err := oprot.WriteFieldBegin("is_group_ingestion_finished", thrift.BOOL, 8); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:is_group_ingestion_finished: ", p), err)
		}
		if err := oprot.WriteBool(bool(*p.IsGroupIngestionFinished)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.is_group_ingestion_finished (8) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 8:is_group_ingestion_finished: ", p), err)
		}
	}
	return err
}

func (p *BulkLoadResponse) writeField9(oprot thrift.TProtocol) (err error) {
	if p.IsSetIsGroupBulkLoadContextCleanedUp() {
		if err := oprot.WriteFieldBegin("is_group_bulk_load_context_cleaned_up", thrift.BOOL, 9); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:is_group_bulk_load_context_cleaned_up: ", p), err)
		}
		if err := oprot.WriteBool(bool(*p.IsGroupBulkLoadContextCleanedUp)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.is_group_bulk_load_context_cleaned_up (9) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 9:is_group_bulk_load_context_cleaned_up: ", p), err)
		}
	}
	return err
}

func (p *BulkLoadResponse) writeField10(oprot thrift.TProtocol) (err error) {
	if p.IsSetIsGroupBulkLoadPaused() {
		if err := oprot.WriteFieldBegin("is_group_bulk_load_paused", thrift.BOOL, 10); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:is_group_bulk_load_paused: ", p), err)
		}
		if err := oprot.WriteBool(bool(*p.IsGroupBulkLoadPaused)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.is_group_bulk_load_paused (10) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 10:is_group_bulk_load_paused: ", p), err)
		}
	}
	return err
}

func (p *BulkLoadResponse) writeField11(oprot thrift.TProtocol) (err error) {
	if p.IsSetHpGroupBulkLoadState() {
		if err := oprot.WriteFieldBegin("hp_group_bulk_load_state", thrift.MAP, 11); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:hp_group_bulk_load_state: ", p), err)
		}
		if err := oprot.WriteMapBegin(thrift.STRUCT, thrift.STRUCT, len(p.HpGroupBulkLoadState)); err != nil {
			return thrift.PrependError("error writing map begin: ", err)
		}
		for k, v := range p.HpGroupBulkLoadState {
			if err := k.Write(oprot); err != nil {
				return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", k), err)
			}
			if err := v.Write(oprot); err != nil {
				return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
			}
		}
		if err := oprot.WriteMapEnd(); err != nil {
			return thrift.PrependError("error writing map end: ", err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 11:hp_group_bulk_load_state: ", p), err)
		}
	}
	return err
}

func (p *BulkLoadResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("BulkLoadResponse(%+v)", *p)
}

// Attributes:
//  - AppName
//  - Target
//  - Config
//  - ProviderName
//  - ClusterName
//  - MetaBulkLoadStatus
//  - RemoteRootPath
//  - HpTarget
type GroupBulkLoadRequest struct {
	AppName            string                `thrift:"app_name,1" db:"app_name" json:"app_name"`
	Target             *base.RPCAddress      `thrift:"target,2" db:"target" json:"target"`
	Config             *ReplicaConfiguration `thrift:"config,3" db:"config" json:"config"`
	ProviderName       string                `thrift:"provider_name,4" db:"provider_name" json:"provider_name"`
	ClusterName        string                `thrift:"cluster_name,5" db:"cluster_name" json:"cluster_name"`
	MetaBulkLoadStatus BulkLoadStatus        `thrift:"meta_bulk_load_status,6" db:"meta_bulk_load_status" json:"meta_bulk_load_status"`
	RemoteRootPath     string                `thrift:"remote_root_path,7" db:"remote_root_path" json:"remote_root_path"`
	HpTarget           *base.HostPort        `thrift:"hp_target,8" db:"hp_target" json:"hp_target,omitempty"`
}

func NewGroupBulkLoadRequest() *GroupBulkLoadRequest {
	return &GroupBulkLoadRequest{}
}

func (p *GroupBulkLoadRequest) GetAppName() string {
	return p.AppName
}

var GroupBulkLoadRequest_Target_DEFAULT *base.RPCAddress

func (p *GroupBulkLoadRequest) GetTarget() *base.RPCAddress {
	if !p.IsSetTarget() {
		return GroupBulkLoadRequest_Target_DEFAULT
	}
	return p.Target
}

var GroupBulkLoadRequest_Config_DEFAULT *ReplicaConfiguration

func (p *GroupBulkLoadRequest) GetConfig() *ReplicaConfiguration {
	if !p.IsSetConfig() {
		return GroupBulkLoadRequest_Config_DEFAULT
	}
	return p.Config
}

func (p *GroupBulkLoadRequest) GetProviderName() string {
	return p.ProviderName
}

func (p *GroupBulkLoadRequest) GetClusterName() string {
	return p.ClusterName
}

func (p *GroupBulkLoadRequest) GetMetaBulkLoadStatus() BulkLoadStatus {
	return p.MetaBulkLoadStatus
}

func (p *GroupBulkLoadRequest) GetRemoteRootPath() string {
	return p.RemoteRootPath
}

var GroupBulkLoadRequest_HpTarget_DEFAULT *base.HostPort

func (p *GroupBulkLoadRequest) GetHpTarget() *base.HostPort {
	if !p.IsSetHpTarget() {
		return GroupBulkLoadRequest_HpTarget_DEFAULT
	}
	return p.HpTarget
}
func (p *GroupBulkLoadRequest) IsSetTarget() bool {
	return p.Target != nil
}

func (p *GroupBulkLoadRequest) IsSetConfig() bool {
	return p.Config != nil
}

func (p *GroupBulkLoadRequest) IsSetHpTarget() bool {
	return p.HpTarget != nil
}

func (p *GroupBulkLoadRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 5:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField5(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 6:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField6(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 7:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField7(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 8:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField8(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *GroupBulkLoadRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *GroupBulkLoadRequest) ReadField2(iprot thrift.TProtocol) error {
	p.Target = &base.RPCAddress{}
	if err := p.Target.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Target), err)
	}
	return nil
}

func (p *GroupBulkLoadRequest) ReadField3(iprot thrift.TProtocol) error {
	p.Config = &ReplicaConfiguration{
		Status: 0,
	}
	if err := p.Config.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Config), err)
	}
	return nil
}

func (p *GroupBulkLoadRequest) ReadField4(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 4: ", err)
	} else {
		p.ProviderName = v
	}
	return nil
}

func (p *GroupBulkLoadRequest) ReadField5(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 5: ", err)
	} else {
		p.ClusterName = v
	}
	return nil
}

func (p *GroupBulkLoadRequest) ReadField6(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 6: ", err)
	} else {
		temp := BulkLoadStatus(v)
		p.MetaBulkLoadStatus = temp
	}
	return nil
}

func (p *GroupBulkLoadRequest) ReadField7(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 7: ", err)
	} else {
		p.RemoteRootPath = v
	}
	return nil
}

func (p *GroupBulkLoadRequest) ReadField8(iprot thrift.TProtocol) error {
	p.HpTarget = &base.HostPort{}
	if err := p.HpTarget.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.HpTarget), err)
	}
	return nil
}

func (p *GroupBulkLoadRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("group_bulk_load_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
		if err := p.writeField5(oprot); err != nil {
			return err
		}
		if err := p.writeField6(oprot); err != nil {
			return err
		}
		if err := p.writeField7(oprot); err != nil {
			return err
		}
		if err := p.writeField8(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *GroupBulkLoadRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app_name: ", p), err)
	}
	return err
}

func (p *GroupBulkLoadRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("target", thrift.STRUCT, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:target: ", p), err)
	}
	if err := p.Target.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Target), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:target: ", p), err)
	}
	return err
}

func (p *GroupBulkLoadRequest) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("config", thrift.STRUCT, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:config: ", p), err)
	}
	if err := p.Config.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Config), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:config: ", p), err)
	}
	return err
}

func (p *GroupBulkLoadRequest) writeField4(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("provider_name", thrift.STRING, 4); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:provider_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.ProviderName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.provider_name (4) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 4:provider_name: ", p), err)
	}
	return err
}

func (p *GroupBulkLoadRequest) writeField5(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("cluster_name", thrift.STRING, 5); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:cluster_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.ClusterName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.cluster_name (5) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 5:cluster_name: ", p), err)
	}
	return err
}

func (p *GroupBulkLoadRequest) writeField6(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("meta_bulk_load_status", thrift.I32, 6); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:meta_bulk_load_status: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.MetaBulkLoadStatus)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.meta_bulk_load_status (6) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 6:meta_bulk_load_status: ", p), err)
	}
	return err
}

func (p *GroupBulkLoadRequest) writeField7(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("remote_root_path", thrift.STRING, 7); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:remote_root_path: ", p), err)
	}
	if err := oprot.WriteString(string(p.RemoteRootPath)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.remote_root_path (7) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 7:remote_root_path: ", p), err)
	}
	return err
}

func (p *GroupBulkLoadRequest) writeField8(oprot thrift.TProtocol) (err error) {
	if p.IsSetHpTarget() {
		if err := oprot.WriteFieldBegin("hp_target", thrift.STRUCT, 8); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:hp_target: ", p), err)
		}
		if err := p.HpTarget.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.HpTarget), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 8:hp_target: ", p), err)
		}
	}
	return err
}

func (p *GroupBulkLoadRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("GroupBulkLoadRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - Status
//  - BulkLoadState
type GroupBulkLoadResponse struct {
	Err           *base.ErrorCode         `thrift:"err,1" db:"err" json:"err"`
	Status        BulkLoadStatus          `thrift:"status,2" db:"status" json:"status"`
	BulkLoadState *PartitionBulkLoadState `thrift:"bulk_load_state,3" db:"bulk_load_state" json:"bulk_load_state"`
}

func NewGroupBulkLoadResponse() *GroupBulkLoadResponse {
	return &GroupBulkLoadResponse{}
}

var GroupBulkLoadResponse_Err_DEFAULT *base.ErrorCode

func (p *GroupBulkLoadResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return GroupBulkLoadResponse_Err_DEFAULT
	}
	return p.Err
}

func (p *GroupBulkLoadResponse) GetStatus() BulkLoadStatus {
	return p.Status
}

var GroupBulkLoadResponse_BulkLoadState_DEFAULT *PartitionBulkLoadState

func (p *GroupBulkLoadResponse) GetBulkLoadState() *PartitionBulkLoadState {
	if !p.IsSetBulkLoadState() {
		return GroupBulkLoadResponse_BulkLoadState_DEFAULT
	}
	return p.BulkLoadState
}
func (p *GroupBulkLoadResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *GroupBulkLoadResponse) IsSetBulkLoadState() bool {
	return p.BulkLoadState != nil
}

func (p *GroupBulkLoadResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *GroupBulkLoadResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *GroupBulkLoadResponse) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		temp := BulkLoadStatus(v)
		p.Status = temp
	}
	return nil
}

func (p *GroupBulkLoadResponse) ReadField3(iprot thrift.TProtocol) error {
	p.BulkLoadState = &PartitionBulkLoadState{
		IngestStatus: 0,
	}
	if err := p.BulkLoadState.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.BulkLoadState), err)
	}
	return nil
}

func (p *GroupBulkLoadResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("group_bulk_load_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *GroupBulkLoadResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *GroupBulkLoadResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("status", thrift.I32, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:status: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.Status)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.status (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:status: ", p), err)
	}
	return err
}

func (p *GroupBulkLoadResponse) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("bulk_load_state", thrift.STRUCT, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:bulk_load_state: ", p), err)
	}
	if err := p.BulkLoadState.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.BulkLoadState), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:bulk_load_state: ", p), err)
	}
	return err
}

func (p *GroupBulkLoadResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("GroupBulkLoadResponse(%+v)", *p)
}

// Attributes:
//  - AppName
//  - Metadata
//  - IngestBehind
//  - Ballot
//  - VerifyBeforeIngest
type IngestionRequest struct {
	AppName            string            `thrift:"app_name,1" db:"app_name" json:"app_name"`
	Metadata           *BulkLoadMetadata `thrift:"metadata,2" db:"metadata" json:"metadata"`
	IngestBehind       bool              `thrift:"ingest_behind,3" db:"ingest_behind" json:"ingest_behind"`
	Ballot             int64             `thrift:"ballot,4" db:"ballot" json:"ballot"`
	VerifyBeforeIngest bool              `thrift:"verify_before_ingest,5" db:"verify_before_ingest" json:"verify_before_ingest"`
}

func NewIngestionRequest() *IngestionRequest {
	return &IngestionRequest{}
}

func (p *IngestionRequest) GetAppName() string {
	return p.AppName
}

var IngestionRequest_Metadata_DEFAULT *BulkLoadMetadata

func (p *IngestionRequest) GetMetadata() *BulkLoadMetadata {
	if !p.IsSetMetadata() {
		return IngestionRequest_Metadata_DEFAULT
	}
	return p.Metadata
}

func (p *IngestionRequest) GetIngestBehind() bool {
	return p.IngestBehind
}

func (p *IngestionRequest) GetBallot() int64 {
	return p.Ballot
}

func (p *IngestionRequest) GetVerifyBeforeIngest() bool {
	return p.VerifyBeforeIngest
}
func (p *IngestionRequest) IsSetMetadata() bool {
	return p.Metadata != nil
}

func (p *IngestionRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.BOOL {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.I64 {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 5:
			if fieldTypeId == thrift.BOOL {
				if err := p.ReadField5(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IngestionRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *IngestionRequest) ReadField2(iprot thrift.TProtocol) error {
	p.Metadata = &BulkLoadMetadata{}
	if err := p.Metadata.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Metadata), err)
	}
	return nil
}

func (p *IngestionRequest) ReadField3(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return thrift.PrependError("error reading field 3: ", err)
	} else {
		p.IngestBehind = v
	}
	return nil
}

func (p *IngestionRequest) ReadField4(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 4: ", err)
	} else {
		p.Ballot = v
	}
	return nil
}

func (p *IngestionRequest) ReadField5(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return thrift.PrependError("error reading field 5: ", err)
	} else {
		p.VerifyBeforeIngest = v
	}
	return nil
}

func (p *IngestionRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("ingestion_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
		if err := p.writeField5(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IngestionRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app_name: ", p), err)
	}
	return err
}

func (p *IngestionRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("metadata", thrift.STRUCT, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:metadata: ", p), err)
	}
	if err := p.Metadata.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Metadata), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:metadata: ", p), err)
	}
	return err
}

func (p *IngestionRequest) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("ingest_behind", thrift.BOOL, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:ingest_behind: ", p), err)
	}
	if err := oprot.WriteBool(bool(p.IngestBehind)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.ingest_behind (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:ingest_behind: ", p), err)
	}
	return err
}

func (p *IngestionRequest) writeField4(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("ballot", thrift.I64, 4); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:ballot: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Ballot)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.ballot (4) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 4:ballot: ", p), err)
	}
	return err
}

func (p *IngestionRequest) writeField5(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("verify_before_ingest", thrift.BOOL, 5); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:verify_before_ingest: ", p), err)
	}
	if err := oprot.WriteBool(bool(p.VerifyBeforeIngest)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.verify_before_ingest (5) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 5:verify_before_ingest: ", p), err)
	}
	return err
}

func (p *IngestionRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("IngestionRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - RocksdbError
type IngestionResponse struct {
	Err          *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
	RocksdbError int32           `thrift:"rocksdb_error,2" db:"rocksdb_error" json:"rocksdb_error"`
}

func NewIngestionResponse() *IngestionResponse {
	return &IngestionResponse{}
}

var IngestionResponse_Err_DEFAULT *base.ErrorCode

func (p *IngestionResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return IngestionResponse_Err_DEFAULT
	}
	return p.Err
}

func (p *IngestionResponse) GetRocksdbError() int32 {
	return p.RocksdbError
}
func (p *IngestionResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *IngestionResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IngestionResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *IngestionResponse) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.RocksdbError = v
	}
	return nil
}

func (p *IngestionResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("ingestion_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IngestionResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *IngestionResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("rocksdb_error", thrift.I32, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:rocksdb_error: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.RocksdbError)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.rocksdb_error (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:rocksdb_error: ", p), err)
	}
	return err
}

func (p *IngestionResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("IngestionResponse(%+v)", *p)
}

// Attributes:
//  - AppName
//  - Type
type ControlBulkLoadRequest struct {
	AppName string              `thrift:"app_name,1" db:"app_name" json:"app_name"`
	Type    BulkLoadControlType `thrift:"type,2" db:"type" json:"type"`
}

func NewControlBulkLoadRequest() *ControlBulkLoadRequest {
	return &ControlBulkLoadRequest{}
}

func (p *ControlBulkLoadRequest) GetAppName() string {
	return p.AppName
}

func (p *ControlBulkLoadRequest) GetType() BulkLoadControlType {
	return p.Type
}
func (p *ControlBulkLoadRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *ControlBulkLoadRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *ControlBulkLoadRequest) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		temp := BulkLoadControlType(v)
		p.Type = temp
	}
	return nil
}

func (p *ControlBulkLoadRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("control_bulk_load_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *ControlBulkLoadRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app_name: ", p), err)
	}
	return err
}

func (p *ControlBulkLoadRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("type", thrift.I32, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:type: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.Type)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.type (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:type: ", p), err)
	}
	return err
}

func (p *ControlBulkLoadRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("ControlBulkLoadRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - HintMsg
type ControlBulkLoadResponse struct {
	Err     *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
	HintMsg *string         `thrift:"hint_msg,2" db:"hint_msg" json:"hint_msg,omitempty"`
}

func NewControlBulkLoadResponse() *ControlBulkLoadResponse {
	return &ControlBulkLoadResponse{}
}

var ControlBulkLoadResponse_Err_DEFAULT *base.ErrorCode

func (p *ControlBulkLoadResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return ControlBulkLoadResponse_Err_DEFAULT
	}
	return p.Err
}

var ControlBulkLoadResponse_HintMsg_DEFAULT string

func (p *ControlBulkLoadResponse) GetHintMsg() string {
	if !p.IsSetHintMsg() {
		return ControlBulkLoadResponse_HintMsg_DEFAULT
	}
	return *p.HintMsg
}
func (p *ControlBulkLoadResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *ControlBulkLoadResponse) IsSetHintMsg() bool {
	return p.HintMsg != nil
}

func (p *ControlBulkLoadResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *ControlBulkLoadResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *ControlBulkLoadResponse) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.HintMsg = &v
	}
	return nil
}

func (p *ControlBulkLoadResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("control_bulk_load_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *ControlBulkLoadResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *ControlBulkLoadResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if p.IsSetHintMsg() {
		if err := oprot.WriteFieldBegin("hint_msg", thrift.STRING, 2); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hint_msg: ", p), err)
		}
		if err := oprot.WriteString(string(*p.HintMsg)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.hint_msg (2) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 2:hint_msg: ", p), err)
		}
	}
	return err
}

func (p *ControlBulkLoadResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("ControlBulkLoadResponse(%+v)", *p)
}

// Attributes:
//  - AppName
type QueryBulkLoadRequest struct {
	AppName string `thrift:"app_name,1" db:"app_name" json:"app_name"`
}

func NewQueryBulkLoadRequest() *QueryBulkLoadRequest {
	return &QueryBulkLoadRequest{}
}

func (p *QueryBulkLoadRequest) GetAppName() string {
	return p.AppName
}
func (p *QueryBulkLoadRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *QueryBulkLoadRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *QueryBulkLoadRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("query_bulk_load_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *QueryBulkLoadRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app_name: ", p), err)
	}
	return err
}

func (p *QueryBulkLoadRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("QueryBulkLoadRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - AppName
//  - AppStatus
//  - PartitionsStatus
//  - MaxReplicaCount
//  - BulkLoadStates
//  - HintMsg
//  - IsBulkLoading
//  - HpBulkLoadStates
type QueryBulkLoadResponse struct {
	Err              *base.ErrorCode                                `thrift:"err,1" db:"err" json:"err"`
	AppName          string                                         `thrift:"app_name,2" db:"app_name" json:"app_name"`
	AppStatus        BulkLoadStatus                                 `thrift:"app_status,3" db:"app_status" json:"app_status"`
	PartitionsStatus []BulkLoadStatus                               `thrift:"partitions_status,4" db:"partitions_status" json:"partitions_status"`
	MaxReplicaCount  int32                                          `thrift:"max_replica_count,5" db:"max_replica_count" json:"max_replica_count"`
	BulkLoadStates   []map[*base.RPCAddress]*PartitionBulkLoadState `thrift:"bulk_load_states,6" db:"bulk_load_states" json:"bulk_load_states"`
	HintMsg          *string                                        `thrift:"hint_msg,7" db:"hint_msg" json:"hint_msg,omitempty"`
	IsBulkLoading    *bool                                          `thrift:"is_bulk_loading,8" db:"is_bulk_loading" json:"is_bulk_loading,omitempty"`
	HpBulkLoadStates []map[*base.HostPort]*PartitionBulkLoadState   `thrift:"hp_bulk_load_states,9" db:"hp_bulk_load_states" json:"hp_bulk_load_states,omitempty"`
}

func NewQueryBulkLoadResponse() *QueryBulkLoadResponse {
	return &QueryBulkLoadResponse{}
}

var QueryBulkLoadResponse_Err_DEFAULT *base.ErrorCode

func (p *QueryBulkLoadResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return QueryBulkLoadResponse_Err_DEFAULT
	}
	return p.Err
}

func (p *QueryBulkLoadResponse) GetAppName() string {
	return p.AppName
}

func (p *QueryBulkLoadResponse) GetAppStatus() BulkLoadStatus {
	return p.AppStatus
}

func (p *QueryBulkLoadResponse) GetPartitionsStatus() []BulkLoadStatus {
	return p.PartitionsStatus
}

func (p *QueryBulkLoadResponse) GetMaxReplicaCount() int32 {
	return p.MaxReplicaCount
}

func (p *QueryBulkLoadResponse) GetBulkLoadStates() []map[*base.RPCAddress]*PartitionBulkLoadState {
	return p.BulkLoadStates
}

var QueryBulkLoadResponse_HintMsg_DEFAULT string

func (p *QueryBulkLoadResponse) GetHintMsg() string {
	if !p.IsSetHintMsg() {
		return QueryBulkLoadResponse_HintMsg_DEFAULT
	}
	return *p.HintMsg
}

var QueryBulkLoadResponse_IsBulkLoading_DEFAULT bool

func (p *QueryBulkLoadResponse) GetIsBulkLoading() bool {
	if !p.IsSetIsBulkLoading() {
		return QueryBulkLoadResponse_IsBulkLoading_DEFAULT
	}
	return *p.IsBulkLoading
}

var QueryBulkLoadResponse_HpBulkLoadStates_DEFAULT []map[*base.HostPort]*PartitionBulkLoadState

func (p *QueryBulkLoadResponse) GetHpBulkLoadStates() []map[*base.HostPort]*PartitionBulkLoadState {
	return p.HpBulkLoadStates
}
func (p *QueryBulkLoadResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *QueryBulkLoadResponse) IsSetHintMsg() bool {
	return p.HintMsg != nil
}

func (p *QueryBulkLoadResponse) IsSetIsBulkLoading() bool {
	return p.IsBulkLoading != nil
}

func (p *QueryBulkLoadResponse) IsSetHpBulkLoadStates() bool {
	return p.HpBulkLoadStates != nil
}

func (p *QueryBulkLoadResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.LIST {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 5:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField5(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 6:
			if fieldTypeId == thrift.LIST {
				if err := p.ReadField6(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 7:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField7(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 8:
			if fieldTypeId == thrift.BOOL {
				if err := p.ReadField8(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 9:
			if fieldTypeId == thrift.LIST {
				if err := p.ReadField9(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *QueryBulkLoadResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *QueryBulkLoadResponse) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *QueryBulkLoadResponse) ReadField3(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 3: ", err)
	} else {
		temp := BulkLoadStatus(v)
		p.AppStatus = temp
	}
	return nil
}

func (p *QueryBulkLoadResponse) ReadField4(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return thrift.PrependError("error reading list begin: ", err)
	}
	tSlice := make([]BulkLoadStatus, 0, size)
	p.PartitionsStatus = tSlice
	for i := 0; i < size; i++ {
		var _elem5 BulkLoadStatus
		if v, err := iprot.ReadI32(); err != nil {
			return thrift.PrependError("error reading field 0: ", err)
		} else {
			temp := BulkLoadStatus(v)
			_elem5 = temp
		}
		p.PartitionsStatus = append(p.PartitionsStatus, _elem5)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return thrift.PrependError("error reading list end: ", err)
	}
	return nil
}

func (p *QueryBulkLoadResponse) ReadField5(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 5: ", err)
	} else {
		p.MaxReplicaCount = v
	}
	return nil
}

func (p *QueryBulkLoadResponse) ReadField6(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return thrift.PrependError("error reading list begin: ", err)
	}
	tSlice := make([]map[*base.RPCAddress]*PartitionBulkLoadState, 0, size)
	p.BulkLoadStates = tSlice
	for i := 0; i < size; i++ {
		_, _, size, err := iprot.ReadMapBegin()
		if err != nil {
			return thrift.PrependError("error reading map begin: ", err)
		}
		tMap := make(map[*base.RPCAddress]*PartitionBulkLoadState, size)
		_elem6 := tMap
		for i := 0; i < size; i++ {
			_key7 := &base.RPCAddress{}
			if err := _key7.Read(iprot); err != nil {
				return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _key7), err)
			}
			_val8 := &PartitionBulkLoadState{
				IngestStatus: 0,
			}
			if err := _val8.Read(iprot); err != nil {
				return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val8), err)
			}
			_elem6[_key7] = _val8
		}
		if err := iprot.ReadMapEnd(); err != nil {
			return thrift.PrependError("error reading map end: ", err)
		}
		p.BulkLoadStates = append(p.BulkLoadStates, _elem6)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return thrift.PrependError("error reading list end: ", err)
	}
	return nil
}

func (p *QueryBulkLoadResponse) ReadField7(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 7: ", err)
	} else {
		p.HintMsg = &v
	}
	return nil
}

func (p *QueryBulkLoadResponse) ReadField8(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadBool(); err != nil {
		return thrift.PrependError("error reading field 8: ", err)
	} else {
		p.IsBulkLoading = &v
	}
	return nil
}

func (p *QueryBulkLoadResponse) ReadField9(iprot thrift.TProtocol) error {
	_, size, err := iprot.ReadListBegin()
	if err != nil {
		return thrift.PrependError("error reading list begin: ", err)
	}
	tSlice := make([]map[*base.HostPort]*PartitionBulkLoadState, 0, size)
	p.HpBulkLoadStates = tSlice
	for i := 0; i < size; i++ {
		_, _, size, err := iprot.ReadMapBegin()
		if err != nil {
			return thrift.PrependError("error reading map begin: ", err)
		}
		tMap := make(map[*base.HostPort]*PartitionBulkLoadState, size)
		_elem9 := tMap
		for i := 0; i < size; i++ {
			_key10 := &base.HostPort{}
			if err := _key10.Read(iprot); err != nil {
				return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _key10), err)
			}
			_val11 := &PartitionBulkLoadState{
				IngestStatus: 0,
			}
			if err := _val11.Read(iprot); err != nil {
				return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val11), err)
			}
			_elem9[_key10] = _val11
		}
		if err := iprot.ReadMapEnd(); err != nil {
			return thrift.PrependError("error reading map end: ", err)
		}
		p.HpBulkLoadStates = append(p.HpBulkLoadStates, _elem9)
	}
	if err := iprot.ReadListEnd(); err != nil {
		return thrift.PrependError("error reading list end: ", err)
	}
	return nil
}

func (p *QueryBulkLoadResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("query_bulk_load_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
		if err := p.writeField5(oprot); err != nil {
			return err
		}
		if err := p.writeField6(oprot); err != nil {
			return err
		}
		if err := p.writeField7(oprot); err != nil {
			return err
		}
		if err := p.writeField8(oprot); err != nil {
			return err
		}
		if err := p.writeField9(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *QueryBulkLoadResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *QueryBulkLoadResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:app_name: ", p), err)
	}
	return err
}

func (p *QueryBulkLoadResponse) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_status", thrift.I32, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:app_status: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.AppStatus)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_status (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:app_status: ", p), err)
	}
	return err
}

func (p *QueryBulkLoadResponse) writeField4(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("partitions_status", thrift.LIST, 4); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:partitions_status: ", p), err)
	}
	if err := oprot.WriteListBegin(thrift.I32, len(p.PartitionsStatus)); err != nil {
		return thrift.PrependError("error writing list begin: ", err)
	}
	for _, v := range p.PartitionsStatus {
		if err := oprot.WriteI32(int32(v)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
		}
	}
	if err := oprot.WriteListEnd(); err != nil {
		return thrift.PrependError("error writing list end: ", err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 4:partitions_status: ", p), err)
	}
	return err
}

func (p *QueryBulkLoadResponse) writeField5(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("max_replica_count", thrift.I32, 5); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:max_replica_count: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.MaxReplicaCount)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.max_replica_count (5) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 5:max_replica_count: ", p), err)
	}
	return err
}

func (p *QueryBulkLoadResponse) writeField6(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("bulk_load_states", thrift.LIST, 6); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:bulk_load_states: ", p), err)
	}
	if err := oprot.WriteListBegin(thrift.MAP, len(p.BulkLoadStates)); err != nil {
		return thrift.PrependError("error writing list begin: ", err)
	}
	for _, v := range p.BulkLoadStates {
		if err := oprot.WriteMapBegin(thrift.STRUCT, thrift.STRUCT, len(v)); err != nil {
			return thrift.PrependError("error writing map begin: ", err)
		}
		for k, v := range v {
			if err := k.Write(oprot); err != nil {
				return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", k), err)
			}
			if err := v.Write(oprot); err != nil {
				return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
			}
		}
		if err := oprot.WriteMapEnd(); err != nil {
			return thrift.PrependError("error writing map end: ", err)
		}
	}
	if err := oprot.WriteListEnd(); err != nil {
		return thrift.PrependError("error writing list end: ", err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 6:bulk_load_states: ", p), err)
	}
	return err
}

func (p *QueryBulkLoadResponse) writeField7(oprot thrift.TProtocol) (err error) {
	if p.IsSetHintMsg() {
		if err := oprot.WriteFieldBegin("hint_msg", thrift.STRING, 7); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:hint_msg: ", p), err)
		}
		if err := oprot.WriteString(string(*p.HintMsg)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.hint_msg (7) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 7:hint_msg: ", p), err)
		}
	}
	return err
}

func (p *QueryBulkLoadResponse) writeField8(oprot thrift.TProtocol) (err error) {
	if p.IsSetIsBulkLoading() {
		if err := oprot.WriteFieldBegin("is_bulk_loading", thrift.BOOL, 8); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:is_bulk_loading: ", p), err)
		}
		if err := oprot.WriteBool(bool(*p.IsBulkLoading)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.is_bulk_loading (8) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 8:is_bulk_loading: ", p), err)
		}
	}
	return err
}

func (p *QueryBulkLoadResponse) writeField9(oprot thrift.TProtocol) (err error) {
	if p.IsSetHpBulkLoadStates() {
		if err := oprot.WriteFieldBegin("hp_bulk_load_states", thrift.LIST, 9); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:hp_bulk_load_states: ", p), err)
		}
		if err := oprot.WriteListBegin(thrift.MAP, len(p.HpBulkLoadStates)); err != nil {
			return thrift.PrependError("error writing list begin: ", err)
		}
		for _, v := range p.HpBulkLoadStates {
			if err := oprot.WriteMapBegin(thrift.STRUCT, thrift.STRUCT, len(v)); err != nil {
				return thrift.PrependError("error writing map begin: ", err)
			}
			for k, v := range v {
				if err := k.Write(oprot); err != nil {
					return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", k), err)
				}
				if err := v.Write(oprot); err != nil {
					return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
				}
			}
			if err := oprot.WriteMapEnd(); err != nil {
				return thrift.PrependError("error writing map end: ", err)
			}
		}
		if err := oprot.WriteListEnd(); err != nil {
			return thrift.PrependError("error writing list end: ", err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 9:hp_bulk_load_states: ", p), err)
		}
	}
	return err
}

func (p *QueryBulkLoadResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("QueryBulkLoadResponse(%+v)", *p)
}

// Attributes:
//  - AppName
type ClearBulkLoadStateRequest struct {
	AppName string `thrift:"app_name,1" db:"app_name" json:"app_name"`
}

func NewClearBulkLoadStateRequest() *ClearBulkLoadStateRequest {
	return &ClearBulkLoadStateRequest{}
}

func (p *ClearBulkLoadStateRequest) GetAppName() string {
	return p.AppName
}
func (p *ClearBulkLoadStateRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *ClearBulkLoadStateRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *ClearBulkLoadStateRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("clear_bulk_load_state_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *ClearBulkLoadStateRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app_name: ", p), err)
	}
	return err
}

func (p *ClearBulkLoadStateRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("ClearBulkLoadStateRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - HintMsg
type ClearBulkLoadStateResponse struct {
	Err     *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
	HintMsg string          `thrift:"hint_msg,2" db:"hint_msg" json:"hint_msg"`
}

func NewClearBulkLoadStateResponse() *ClearBulkLoadStateResponse {
	return &ClearBulkLoadStateResponse{}
}

var ClearBulkLoadStateResponse_Err_DEFAULT *base.ErrorCode

func (p *ClearBulkLoadStateResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return ClearBulkLoadStateResponse_Err_DEFAULT
	}
	return p.Err
}

func (p *ClearBulkLoadStateResponse) GetHintMsg() string {
	return p.HintMsg
}
func (p *ClearBulkLoadStateResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *ClearBulkLoadStateResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *ClearBulkLoadStateResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *ClearBulkLoadStateResponse) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.HintMsg = v
	}
	return nil
}

func (p *ClearBulkLoadStateResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("clear_bulk_load_state_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *ClearBulkLoadStateResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *ClearBulkLoadStateResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("hint_msg", thrift.STRING, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hint_msg: ", p), err)
	}
	if err := oprot.WriteString(string(p.HintMsg)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.hint_msg (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:hint_msg: ", p), err)
	}
	return err
}

func (p *ClearBulkLoadStateResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("ClearBulkLoadStateResponse(%+v)", *p)
}
