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

package beeswax

import (
	"bytes"
	"context"
	"reflect"
	"database/sql/driver"
	"errors"
	"fmt"
	"github.com/apache/thrift/lib/go/thrift"
	"github.com/bippio/go-impala/services/hive_metastore"

)

// (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 _ = hive_metastore.GoUnusedProtection__
type QueryState int64
const (
  QueryState_CREATED QueryState = 0
  QueryState_INITIALIZED QueryState = 1
  QueryState_COMPILED QueryState = 2
  QueryState_RUNNING QueryState = 3
  QueryState_FINISHED QueryState = 4
  QueryState_EXCEPTION QueryState = 5
)

func (p QueryState) String() string {
  switch p {
  case QueryState_CREATED: return "CREATED"
  case QueryState_INITIALIZED: return "INITIALIZED"
  case QueryState_COMPILED: return "COMPILED"
  case QueryState_RUNNING: return "RUNNING"
  case QueryState_FINISHED: return "FINISHED"
  case QueryState_EXCEPTION: return "EXCEPTION"
  }
  return "<UNSET>"
}

func QueryStateFromString(s string) (QueryState, error) {
  switch s {
  case "CREATED": return QueryState_CREATED, nil 
  case "INITIALIZED": return QueryState_INITIALIZED, nil 
  case "COMPILED": return QueryState_COMPILED, nil 
  case "RUNNING": return QueryState_RUNNING, nil 
  case "FINISHED": return QueryState_FINISHED, nil 
  case "EXCEPTION": return QueryState_EXCEPTION, nil 
  }
  return QueryState(0), fmt.Errorf("not a valid QueryState string")
}


func QueryStatePtr(v QueryState) *QueryState { return &v }

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

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

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

func (p * QueryState) Value() (driver.Value, error) {
  if p == nil {
    return nil, nil
  }
return int64(*p), nil
}
type LogContextId string

func LogContextIdPtr(v LogContextId) *LogContextId { return &v }

// Attributes:
//  - Query
//  - Configuration
//  - HadoopUser
type Query struct {
  Query string `thrift:"query,1" db:"query" json:"query"`
  // unused field # 2
  Configuration []string `thrift:"configuration,3" db:"configuration" json:"configuration"`
  HadoopUser string `thrift:"hadoop_user,4" db:"hadoop_user" json:"hadoop_user"`
}

func NewQuery() *Query {
  return &Query{}
}


func (p *Query) GetQuery() string {
  return p.Query
}

func (p *Query) GetConfiguration() []string {
  return p.Configuration
}

func (p *Query) GetHadoopUser() string {
  return p.HadoopUser
}
func (p *Query) 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 3:
      if fieldTypeId == thrift.LIST {
        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
        }
      }
    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 *Query)  ReadField1(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadString(); err != nil {
  return thrift.PrependError("error reading field 1: ", err)
} else {
  p.Query = v
}
  return nil
}

func (p *Query)  ReadField3(iprot thrift.TProtocol) error {
  _, size, err := iprot.ReadListBegin()
  if err != nil {
    return thrift.PrependError("error reading list begin: ", err)
  }
  tSlice := make([]string, 0, size)
  p.Configuration =  tSlice
  for i := 0; i < size; i ++ {
var _elem0 string
    if v, err := iprot.ReadString(); err != nil {
    return thrift.PrependError("error reading field 0: ", err)
} else {
    _elem0 = v
}
    p.Configuration = append(p.Configuration, _elem0)
  }
  if err := iprot.ReadListEnd(); err != nil {
    return thrift.PrependError("error reading list end: ", err)
  }
  return nil
}

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

func (p *Query) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("Query"); 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.writeField3(oprot); err != nil { return err }
    if err := p.writeField4(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 *Query) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("query", thrift.STRING, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) }
  if err := oprot.WriteString(string(p.Query)); err != nil {
  return thrift.PrependError(fmt.Sprintf("%T.query (1) field write error: ", p), err) }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) }
  return err
}

func (p *Query) writeField3(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("configuration", thrift.LIST, 3); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:configuration: ", p), err) }
  if err := oprot.WriteListBegin(thrift.STRING, len(p.Configuration)); err != nil {
    return thrift.PrependError("error writing list begin: ", err)
  }
  for _, v := range p.Configuration {
    if err := oprot.WriteString(string(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 3:configuration: ", p), err) }
  return err
}

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

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

// Attributes:
//  - ID
//  - LogContext
type QueryHandle struct {
  ID string `thrift:"id,1" db:"id" json:"id"`
  LogContext LogContextId `thrift:"log_context,2" db:"log_context" json:"log_context"`
}

func NewQueryHandle() *QueryHandle {
  return &QueryHandle{}
}


func (p *QueryHandle) GetID() string {
  return p.ID
}

func (p *QueryHandle) GetLogContext() LogContextId {
  return p.LogContext
}
func (p *QueryHandle) 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
        }
      }
    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 *QueryHandle)  ReadField1(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadString(); err != nil {
  return thrift.PrependError("error reading field 1: ", err)
} else {
  p.ID = v
}
  return nil
}

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

func (p *QueryHandle) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("QueryHandle"); 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 *QueryHandle) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("id", thrift.STRING, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:id: ", p), err) }
  if err := oprot.WriteString(string(p.ID)); err != nil {
  return thrift.PrependError(fmt.Sprintf("%T.id (1) field write error: ", p), err) }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:id: ", p), err) }
  return err
}

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

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

// Attributes:
//  - Textual
type QueryExplanation struct {
  Textual string `thrift:"textual,1" db:"textual" json:"textual"`
}

func NewQueryExplanation() *QueryExplanation {
  return &QueryExplanation{}
}


func (p *QueryExplanation) GetTextual() string {
  return p.Textual
}
func (p *QueryExplanation) 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 *QueryExplanation)  ReadField1(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadString(); err != nil {
  return thrift.PrependError("error reading field 1: ", err)
} else {
  p.Textual = v
}
  return nil
}

func (p *QueryExplanation) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("QueryExplanation"); 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 *QueryExplanation) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("textual", thrift.STRING, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:textual: ", p), err) }
  if err := oprot.WriteString(string(p.Textual)); err != nil {
  return thrift.PrependError(fmt.Sprintf("%T.textual (1) field write error: ", p), err) }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:textual: ", p), err) }
  return err
}

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

// Attributes:
//  - Ready
//  - Columns
//  - Data
//  - StartRow
//  - HasMore
type Results struct {
  Ready bool `thrift:"ready,1" db:"ready" json:"ready"`
  Columns []string `thrift:"columns,2" db:"columns" json:"columns"`
  Data []string `thrift:"data,3" db:"data" json:"data"`
  StartRow int64 `thrift:"start_row,4" db:"start_row" json:"start_row"`
  HasMore bool `thrift:"has_more,5" db:"has_more" json:"has_more"`
}

func NewResults() *Results {
  return &Results{}
}


func (p *Results) GetReady() bool {
  return p.Ready
}

func (p *Results) GetColumns() []string {
  return p.Columns
}

func (p *Results) GetData() []string {
  return p.Data
}

func (p *Results) GetStartRow() int64 {
  return p.StartRow
}

func (p *Results) GetHasMore() bool {
  return p.HasMore
}
func (p *Results) 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.BOOL {
        if err := p.ReadField1(iprot); err != nil {
          return err
        }
      } else {
        if err := iprot.Skip(fieldTypeId); err != nil {
          return err
        }
      }
    case 2:
      if fieldTypeId == thrift.LIST {
        if err := p.ReadField2(iprot); err != nil {
          return err
        }
      } else {
        if err := iprot.Skip(fieldTypeId); err != nil {
          return err
        }
      }
    case 3:
      if fieldTypeId == thrift.LIST {
        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 *Results)  ReadField1(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadBool(); err != nil {
  return thrift.PrependError("error reading field 1: ", err)
} else {
  p.Ready = v
}
  return nil
}

func (p *Results)  ReadField2(iprot thrift.TProtocol) error {
  _, size, err := iprot.ReadListBegin()
  if err != nil {
    return thrift.PrependError("error reading list begin: ", err)
  }
  tSlice := make([]string, 0, size)
  p.Columns =  tSlice
  for i := 0; i < size; i ++ {
var _elem1 string
    if v, err := iprot.ReadString(); err != nil {
    return thrift.PrependError("error reading field 0: ", err)
} else {
    _elem1 = v
}
    p.Columns = append(p.Columns, _elem1)
  }
  if err := iprot.ReadListEnd(); err != nil {
    return thrift.PrependError("error reading list end: ", err)
  }
  return nil
}

func (p *Results)  ReadField3(iprot thrift.TProtocol) error {
  _, size, err := iprot.ReadListBegin()
  if err != nil {
    return thrift.PrependError("error reading list begin: ", err)
  }
  tSlice := make([]string, 0, size)
  p.Data =  tSlice
  for i := 0; i < size; i ++ {
var _elem2 string
    if v, err := iprot.ReadString(); err != nil {
    return thrift.PrependError("error reading field 0: ", err)
} else {
    _elem2 = v
}
    p.Data = append(p.Data, _elem2)
  }
  if err := iprot.ReadListEnd(); err != nil {
    return thrift.PrependError("error reading list end: ", err)
  }
  return nil
}

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

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

func (p *Results) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("Results"); 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 *Results) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("ready", thrift.BOOL, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ready: ", p), err) }
  if err := oprot.WriteBool(bool(p.Ready)); err != nil {
  return thrift.PrependError(fmt.Sprintf("%T.ready (1) field write error: ", p), err) }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ready: ", p), err) }
  return err
}

func (p *Results) writeField2(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("columns", thrift.LIST, 2); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:columns: ", p), err) }
  if err := oprot.WriteListBegin(thrift.STRING, len(p.Columns)); err != nil {
    return thrift.PrependError("error writing list begin: ", err)
  }
  for _, v := range p.Columns {
    if err := oprot.WriteString(string(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 2:columns: ", p), err) }
  return err
}

func (p *Results) writeField3(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("data", thrift.LIST, 3); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:data: ", p), err) }
  if err := oprot.WriteListBegin(thrift.STRING, len(p.Data)); err != nil {
    return thrift.PrependError("error writing list begin: ", err)
  }
  for _, v := range p.Data {
    if err := oprot.WriteString(string(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 3:data: ", p), err) }
  return err
}

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

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

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

// Metadata information about the results.
// Applicable only for SELECT.
// 
// Attributes:
//  - Schema: The schema of the results
//  - TableDir: The directory containing the results. Not applicable for partition table.
//  - InTablename: If the results are straight from an existing table, the table name.
//  - Delim: Field delimiter
type ResultsMetadata struct {
  Schema *hive_metastore.Schema `thrift:"schema,1" db:"schema" json:"schema"`
  TableDir string `thrift:"table_dir,2" db:"table_dir" json:"table_dir"`
  InTablename string `thrift:"in_tablename,3" db:"in_tablename" json:"in_tablename"`
  Delim string `thrift:"delim,4" db:"delim" json:"delim"`
}

func NewResultsMetadata() *ResultsMetadata {
  return &ResultsMetadata{}
}

var ResultsMetadata_Schema_DEFAULT *hive_metastore.Schema
func (p *ResultsMetadata) GetSchema() *hive_metastore.Schema {
  if !p.IsSetSchema() {
    return ResultsMetadata_Schema_DEFAULT
  }
return p.Schema
}

func (p *ResultsMetadata) GetTableDir() string {
  return p.TableDir
}

func (p *ResultsMetadata) GetInTablename() string {
  return p.InTablename
}

func (p *ResultsMetadata) GetDelim() string {
  return p.Delim
}
func (p *ResultsMetadata) IsSetSchema() bool {
  return p.Schema != nil
}

func (p *ResultsMetadata) 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.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
        }
      }
    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 *ResultsMetadata)  ReadField1(iprot thrift.TProtocol) error {
  p.Schema = &hive_metastore.Schema{}
  if err := p.Schema.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Schema), err)
  }
  return nil
}

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

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

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

func (p *ResultsMetadata) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("ResultsMetadata"); 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 := 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 *ResultsMetadata) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("schema", thrift.STRUCT, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:schema: ", p), err) }
  if err := p.Schema.Write(oprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Schema), err)
  }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:schema: ", p), err) }
  return err
}

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

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

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

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

// Attributes:
//  - Message
//  - LogContext
//  - Handle
//  - ErrorCode
//  - SQLState
type BeeswaxException struct {
  Message string `thrift:"message,1" db:"message" json:"message"`
  LogContext LogContextId `thrift:"log_context,2" db:"log_context" json:"log_context"`
  Handle *QueryHandle `thrift:"handle,3" db:"handle" json:"handle"`
  ErrorCode int32 `thrift:"errorCode,4" db:"errorCode" json:"errorCode,omitempty"`
  SQLState string `thrift:"SQLState,5" db:"SQLState" json:"SQLState,omitempty"`
}

func NewBeeswaxException() *BeeswaxException {
  return &BeeswaxException{
SQLState: "     ",
}
}


func (p *BeeswaxException) GetMessage() string {
  return p.Message
}

func (p *BeeswaxException) GetLogContext() LogContextId {
  return p.LogContext
}
var BeeswaxException_Handle_DEFAULT *QueryHandle
func (p *BeeswaxException) GetHandle() *QueryHandle {
  if !p.IsSetHandle() {
    return BeeswaxException_Handle_DEFAULT
  }
return p.Handle
}
var BeeswaxException_ErrorCode_DEFAULT int32 = 0

func (p *BeeswaxException) GetErrorCode() int32 {
  return p.ErrorCode
}
var BeeswaxException_SQLState_DEFAULT string = "     "

func (p *BeeswaxException) GetSQLState() string {
  return p.SQLState
}
func (p *BeeswaxException) IsSetHandle() bool {
  return p.Handle != nil
}

func (p *BeeswaxException) IsSetErrorCode() bool {
  return p.ErrorCode != BeeswaxException_ErrorCode_DEFAULT
}

func (p *BeeswaxException) IsSetSQLState() bool {
  return p.SQLState != BeeswaxException_SQLState_DEFAULT
}

func (p *BeeswaxException) 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.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.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.STRING {
        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 *BeeswaxException)  ReadField1(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadString(); err != nil {
  return thrift.PrependError("error reading field 1: ", err)
} else {
  p.Message = v
}
  return nil
}

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

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

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

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

func (p *BeeswaxException) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("BeeswaxException"); 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 *BeeswaxException) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("message", thrift.STRING, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:message: ", p), err) }
  if err := oprot.WriteString(string(p.Message)); err != nil {
  return thrift.PrependError(fmt.Sprintf("%T.message (1) field write error: ", p), err) }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:message: ", p), err) }
  return err
}

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

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

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

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

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

func (p *BeeswaxException) Error() string {
  return p.String()
}

type QueryNotFoundException struct {
}

func NewQueryNotFoundException() *QueryNotFoundException {
  return &QueryNotFoundException{}
}

func (p *QueryNotFoundException) 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; }
    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 *QueryNotFoundException) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("QueryNotFoundException"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
  }
  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 *QueryNotFoundException) String() string {
  if p == nil {
    return "<nil>"
  }
  return fmt.Sprintf("QueryNotFoundException(%+v)", *p)
}

func (p *QueryNotFoundException) Error() string {
  return p.String()
}

// Represents a Hadoop-style configuration variable.
// 
// Attributes:
//  - Key
//  - Value
//  - Description
type ConfigVariable struct {
  Key string `thrift:"key,1" db:"key" json:"key"`
  Value string `thrift:"value,2" db:"value" json:"value"`
  Description string `thrift:"description,3" db:"description" json:"description"`
}

func NewConfigVariable() *ConfigVariable {
  return &ConfigVariable{}
}


func (p *ConfigVariable) GetKey() string {
  return p.Key
}

func (p *ConfigVariable) GetValue() string {
  return p.Value
}

func (p *ConfigVariable) GetDescription() string {
  return p.Description
}
func (p *ConfigVariable) 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
        }
      }
    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 *ConfigVariable)  ReadField1(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadString(); err != nil {
  return thrift.PrependError("error reading field 1: ", err)
} else {
  p.Key = v
}
  return nil
}

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

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

func (p *ConfigVariable) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("ConfigVariable"); 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 *ConfigVariable) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("key", thrift.STRING, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) }
  if err := oprot.WriteString(string(p.Key)); err != nil {
  return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) }
  return err
}

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

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

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

type BeeswaxService interface {
  // Submit a query and return a handle (QueryHandle). The query runs asynchronously.
  // 
  // Parameters:
  //  - Query
  Query(ctx context.Context, query *Query) (r *QueryHandle, err error)
  // run a query synchronously and return a handle (QueryHandle).
  // 
  // Parameters:
  //  - Query
  //  - ClientCtx
  ExecuteAndWait(ctx context.Context, query *Query, clientCtx LogContextId) (r *QueryHandle, err error)
  // Get the query plan for a query.
  // 
  // Parameters:
  //  - Query
  Explain(ctx context.Context, query *Query) (r *QueryExplanation, err error)
  // Get the results of a query. This is non-blocking. Caller should check
  // Results.ready to determine if the results are in yet. The call requests
  // the batch size of fetch.
  // 
  // Parameters:
  //  - QueryID
  //  - StartOver
  //  - FetchSize
  Fetch(ctx context.Context, query_id *QueryHandle, start_over bool, fetch_size int32) (r *Results, err error)
  // Get the state of the query
  // 
  // Parameters:
  //  - Handle
  GetState(ctx context.Context, handle *QueryHandle) (r QueryState, err error)
  // Get the result metadata
  // 
  // Parameters:
  //  - Handle
  GetResultsMetadata(ctx context.Context, handle *QueryHandle) (r *ResultsMetadata, err error)
  // Used to test connection to server.  A "noop" command.
  // 
  // Parameters:
  //  - S
  Echo(ctx context.Context, s string) (r string, err error)
  // Returns a string representation of the configuration object being used.
  // Handy for debugging.
  DumpConfig(ctx context.Context) (r string, err error)
  // Get the log messages related to the given context.
  // 
  // Parameters:
  //  - Context
  GetLog(ctx context.Context, context LogContextId) (r string, err error)
  // Parameters:
  //  - IncludeHadoop
  GetDefaultConfiguration(ctx context.Context, include_hadoop bool) (r []*ConfigVariable, err error)
  // Parameters:
  //  - Handle
  Close(ctx context.Context, handle *QueryHandle) (err error)
  // Parameters:
  //  - LogContext
  Clean(ctx context.Context, log_context LogContextId) (err error)
}

type BeeswaxServiceClient struct {
  c thrift.TClient
}

func NewBeeswaxServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *BeeswaxServiceClient {
  return &BeeswaxServiceClient{
    c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
  }
}

func NewBeeswaxServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *BeeswaxServiceClient {
  return &BeeswaxServiceClient{
    c: thrift.NewTStandardClient(iprot, oprot),
  }
}

func NewBeeswaxServiceClient(c thrift.TClient) *BeeswaxServiceClient {
  return &BeeswaxServiceClient{
    c: c,
  }
}

func (p *BeeswaxServiceClient) Client_() thrift.TClient {
  return p.c
}
// Submit a query and return a handle (QueryHandle). The query runs asynchronously.
// 
// Parameters:
//  - Query
func (p *BeeswaxServiceClient) Query(ctx context.Context, query *Query) (r *QueryHandle, err error) {
  var _args3 BeeswaxServiceQueryArgs
  _args3.Query = query
  var _result4 BeeswaxServiceQueryResult
  if err = p.Client_().Call(ctx, "query", &_args3, &_result4); err != nil {
    return
  }
  switch {
  case _result4.Error!= nil:
    return r, _result4.Error
  }

  return _result4.GetSuccess(), nil
}

// run a query synchronously and return a handle (QueryHandle).
// 
// Parameters:
//  - Query
//  - ClientCtx
func (p *BeeswaxServiceClient) ExecuteAndWait(ctx context.Context, query *Query, clientCtx LogContextId) (r *QueryHandle, err error) {
  var _args5 BeeswaxServiceExecuteAndWaitArgs
  _args5.Query = query
  _args5.ClientCtx = clientCtx
  var _result6 BeeswaxServiceExecuteAndWaitResult
  if err = p.Client_().Call(ctx, "executeAndWait", &_args5, &_result6); err != nil {
    return
  }
  switch {
  case _result6.Error!= nil:
    return r, _result6.Error
  }

  return _result6.GetSuccess(), nil
}

// Get the query plan for a query.
// 
// Parameters:
//  - Query
func (p *BeeswaxServiceClient) Explain(ctx context.Context, query *Query) (r *QueryExplanation, err error) {
  var _args7 BeeswaxServiceExplainArgs
  _args7.Query = query
  var _result8 BeeswaxServiceExplainResult
  if err = p.Client_().Call(ctx, "explain", &_args7, &_result8); err != nil {
    return
  }
  switch {
  case _result8.Error!= nil:
    return r, _result8.Error
  }

  return _result8.GetSuccess(), nil
}

// Get the results of a query. This is non-blocking. Caller should check
// Results.ready to determine if the results are in yet. The call requests
// the batch size of fetch.
// 
// Parameters:
//  - QueryID
//  - StartOver
//  - FetchSize
func (p *BeeswaxServiceClient) Fetch(ctx context.Context, query_id *QueryHandle, start_over bool, fetch_size int32) (r *Results, err error) {
  var _args9 BeeswaxServiceFetchArgs
  _args9.QueryID = query_id
  _args9.StartOver = start_over
  _args9.FetchSize = fetch_size
  var _result10 BeeswaxServiceFetchResult
  if err = p.Client_().Call(ctx, "fetch", &_args9, &_result10); err != nil {
    return
  }
  switch {
  case _result10.Error!= nil:
    return r, _result10.Error
  case _result10.Error2!= nil:
    return r, _result10.Error2
  }

  return _result10.GetSuccess(), nil
}

// Get the state of the query
// 
// Parameters:
//  - Handle
func (p *BeeswaxServiceClient) GetState(ctx context.Context, handle *QueryHandle) (r QueryState, err error) {
  var _args11 BeeswaxServiceGetStateArgs
  _args11.Handle = handle
  var _result12 BeeswaxServiceGetStateResult
  if err = p.Client_().Call(ctx, "get_state", &_args11, &_result12); err != nil {
    return
  }
  switch {
  case _result12.Error!= nil:
    return r, _result12.Error
  }

  return _result12.GetSuccess(), nil
}

// Get the result metadata
// 
// Parameters:
//  - Handle
func (p *BeeswaxServiceClient) GetResultsMetadata(ctx context.Context, handle *QueryHandle) (r *ResultsMetadata, err error) {
  var _args13 BeeswaxServiceGetResultsMetadataArgs
  _args13.Handle = handle
  var _result14 BeeswaxServiceGetResultsMetadataResult
  if err = p.Client_().Call(ctx, "get_results_metadata", &_args13, &_result14); err != nil {
    return
  }
  switch {
  case _result14.Error!= nil:
    return r, _result14.Error
  }

  return _result14.GetSuccess(), nil
}

// Used to test connection to server.  A "noop" command.
// 
// Parameters:
//  - S
func (p *BeeswaxServiceClient) Echo(ctx context.Context, s string) (r string, err error) {
  var _args15 BeeswaxServiceEchoArgs
  _args15.S = s
  var _result16 BeeswaxServiceEchoResult
  if err = p.Client_().Call(ctx, "echo", &_args15, &_result16); err != nil {
    return
  }
  return _result16.GetSuccess(), nil
}

// Returns a string representation of the configuration object being used.
// Handy for debugging.
func (p *BeeswaxServiceClient) DumpConfig(ctx context.Context) (r string, err error) {
  var _args17 BeeswaxServiceDumpConfigArgs
  var _result18 BeeswaxServiceDumpConfigResult
  if err = p.Client_().Call(ctx, "dump_config", &_args17, &_result18); err != nil {
    return
  }
  return _result18.GetSuccess(), nil
}

// Get the log messages related to the given context.
// 
// Parameters:
//  - Context
func (p *BeeswaxServiceClient) GetLog(ctx context.Context, context LogContextId) (r string, err error) {
  var _args19 BeeswaxServiceGetLogArgs
  _args19.Context = context
  var _result20 BeeswaxServiceGetLogResult
  if err = p.Client_().Call(ctx, "get_log", &_args19, &_result20); err != nil {
    return
  }
  switch {
  case _result20.Error!= nil:
    return r, _result20.Error
  }

  return _result20.GetSuccess(), nil
}

// Parameters:
//  - IncludeHadoop
func (p *BeeswaxServiceClient) GetDefaultConfiguration(ctx context.Context, include_hadoop bool) (r []*ConfigVariable, err error) {
  var _args21 BeeswaxServiceGetDefaultConfigurationArgs
  _args21.IncludeHadoop = include_hadoop
  var _result22 BeeswaxServiceGetDefaultConfigurationResult
  if err = p.Client_().Call(ctx, "get_default_configuration", &_args21, &_result22); err != nil {
    return
  }
  return _result22.GetSuccess(), nil
}

// Parameters:
//  - Handle
func (p *BeeswaxServiceClient) Close(ctx context.Context, handle *QueryHandle) (err error) {
  var _args23 BeeswaxServiceCloseArgs
  _args23.Handle = handle
  var _result24 BeeswaxServiceCloseResult
  if err = p.Client_().Call(ctx, "close", &_args23, &_result24); err != nil {
    return
  }
  switch {
  case _result24.Error!= nil:
    return _result24.Error
  case _result24.Error2!= nil:
    return _result24.Error2
  }

  return nil
}

// Parameters:
//  - LogContext
func (p *BeeswaxServiceClient) Clean(ctx context.Context, log_context LogContextId) (err error) {
  var _args25 BeeswaxServiceCleanArgs
  _args25.LogContext = log_context
  var _result26 BeeswaxServiceCleanResult
  if err = p.Client_().Call(ctx, "clean", &_args25, &_result26); err != nil {
    return
  }
  return nil
}

type BeeswaxServiceProcessor struct {
  processorMap map[string]thrift.TProcessorFunction
  handler BeeswaxService
}

func (p *BeeswaxServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
  p.processorMap[key] = processor
}

func (p *BeeswaxServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
  processor, ok = p.processorMap[key]
  return processor, ok
}

func (p *BeeswaxServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
  return p.processorMap
}

func NewBeeswaxServiceProcessor(handler BeeswaxService) *BeeswaxServiceProcessor {

  self27 := &BeeswaxServiceProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}
  self27.processorMap["query"] = &beeswaxServiceProcessorQuery{handler:handler}
  self27.processorMap["executeAndWait"] = &beeswaxServiceProcessorExecuteAndWait{handler:handler}
  self27.processorMap["explain"] = &beeswaxServiceProcessorExplain{handler:handler}
  self27.processorMap["fetch"] = &beeswaxServiceProcessorFetch{handler:handler}
  self27.processorMap["get_state"] = &beeswaxServiceProcessorGetState{handler:handler}
  self27.processorMap["get_results_metadata"] = &beeswaxServiceProcessorGetResultsMetadata{handler:handler}
  self27.processorMap["echo"] = &beeswaxServiceProcessorEcho{handler:handler}
  self27.processorMap["dump_config"] = &beeswaxServiceProcessorDumpConfig{handler:handler}
  self27.processorMap["get_log"] = &beeswaxServiceProcessorGetLog{handler:handler}
  self27.processorMap["get_default_configuration"] = &beeswaxServiceProcessorGetDefaultConfiguration{handler:handler}
  self27.processorMap["close"] = &beeswaxServiceProcessorClose{handler:handler}
  self27.processorMap["clean"] = &beeswaxServiceProcessorClean{handler:handler}
return self27
}

func (p *BeeswaxServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  name, _, seqId, err := iprot.ReadMessageBegin()
  if err != nil { return false, err }
  if processor, ok := p.GetProcessorFunction(name); ok {
    return processor.Process(ctx, seqId, iprot, oprot)
  }
  iprot.Skip(thrift.STRUCT)
  iprot.ReadMessageEnd()
  x28 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name)
  oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
  x28.Write(oprot)
  oprot.WriteMessageEnd()
  oprot.Flush(ctx)
  return false, x28

}

type beeswaxServiceProcessorQuery struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorQuery) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceQueryArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("query", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceQueryResult{}
var retval *QueryHandle
  var err2 error
  if retval, err2 = p.handler.Query(ctx, args.Query); err2 != nil {
  switch v := err2.(type) {
    case *BeeswaxException:
  result.Error = v
    default:
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing query: " + err2.Error())
    oprot.WriteMessageBegin("query", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  }
  } else {
    result.Success = retval
}
  if err2 = oprot.WriteMessageBegin("query", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}

type beeswaxServiceProcessorExecuteAndWait struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorExecuteAndWait) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceExecuteAndWaitArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("executeAndWait", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceExecuteAndWaitResult{}
var retval *QueryHandle
  var err2 error
  if retval, err2 = p.handler.ExecuteAndWait(ctx, args.Query, args.ClientCtx); err2 != nil {
  switch v := err2.(type) {
    case *BeeswaxException:
  result.Error = v
    default:
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing executeAndWait: " + err2.Error())
    oprot.WriteMessageBegin("executeAndWait", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  }
  } else {
    result.Success = retval
}
  if err2 = oprot.WriteMessageBegin("executeAndWait", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}

type beeswaxServiceProcessorExplain struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorExplain) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceExplainArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("explain", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceExplainResult{}
var retval *QueryExplanation
  var err2 error
  if retval, err2 = p.handler.Explain(ctx, args.Query); err2 != nil {
  switch v := err2.(type) {
    case *BeeswaxException:
  result.Error = v
    default:
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing explain: " + err2.Error())
    oprot.WriteMessageBegin("explain", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  }
  } else {
    result.Success = retval
}
  if err2 = oprot.WriteMessageBegin("explain", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}

type beeswaxServiceProcessorFetch struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorFetch) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceFetchArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("fetch", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceFetchResult{}
var retval *Results
  var err2 error
  if retval, err2 = p.handler.Fetch(ctx, args.QueryID, args.StartOver, args.FetchSize); err2 != nil {
  switch v := err2.(type) {
    case *QueryNotFoundException:
  result.Error = v
    case *BeeswaxException:
  result.Error2 = v
    default:
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing fetch: " + err2.Error())
    oprot.WriteMessageBegin("fetch", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  }
  } else {
    result.Success = retval
}
  if err2 = oprot.WriteMessageBegin("fetch", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}

type beeswaxServiceProcessorGetState struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorGetState) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceGetStateArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("get_state", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceGetStateResult{}
var retval QueryState
  var err2 error
  if retval, err2 = p.handler.GetState(ctx, args.Handle); err2 != nil {
  switch v := err2.(type) {
    case *QueryNotFoundException:
  result.Error = v
    default:
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing get_state: " + err2.Error())
    oprot.WriteMessageBegin("get_state", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  }
  } else {
    result.Success = &retval
}
  if err2 = oprot.WriteMessageBegin("get_state", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}

type beeswaxServiceProcessorGetResultsMetadata struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorGetResultsMetadata) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceGetResultsMetadataArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("get_results_metadata", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceGetResultsMetadataResult{}
var retval *ResultsMetadata
  var err2 error
  if retval, err2 = p.handler.GetResultsMetadata(ctx, args.Handle); err2 != nil {
  switch v := err2.(type) {
    case *QueryNotFoundException:
  result.Error = v
    default:
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing get_results_metadata: " + err2.Error())
    oprot.WriteMessageBegin("get_results_metadata", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  }
  } else {
    result.Success = retval
}
  if err2 = oprot.WriteMessageBegin("get_results_metadata", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}

type beeswaxServiceProcessorEcho struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorEcho) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceEchoArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("echo", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceEchoResult{}
var retval string
  var err2 error
  if retval, err2 = p.handler.Echo(ctx, args.S); err2 != nil {
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing echo: " + err2.Error())
    oprot.WriteMessageBegin("echo", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  } else {
    result.Success = &retval
}
  if err2 = oprot.WriteMessageBegin("echo", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}

type beeswaxServiceProcessorDumpConfig struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorDumpConfig) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceDumpConfigArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("dump_config", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceDumpConfigResult{}
var retval string
  var err2 error
  if retval, err2 = p.handler.DumpConfig(ctx); err2 != nil {
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing dump_config: " + err2.Error())
    oprot.WriteMessageBegin("dump_config", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  } else {
    result.Success = &retval
}
  if err2 = oprot.WriteMessageBegin("dump_config", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}

type beeswaxServiceProcessorGetLog struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorGetLog) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceGetLogArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("get_log", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceGetLogResult{}
var retval string
  var err2 error
  if retval, err2 = p.handler.GetLog(ctx, args.Context); err2 != nil {
  switch v := err2.(type) {
    case *QueryNotFoundException:
  result.Error = v
    default:
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing get_log: " + err2.Error())
    oprot.WriteMessageBegin("get_log", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  }
  } else {
    result.Success = &retval
}
  if err2 = oprot.WriteMessageBegin("get_log", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}

type beeswaxServiceProcessorGetDefaultConfiguration struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorGetDefaultConfiguration) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceGetDefaultConfigurationArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("get_default_configuration", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceGetDefaultConfigurationResult{}
var retval []*ConfigVariable
  var err2 error
  if retval, err2 = p.handler.GetDefaultConfiguration(ctx, args.IncludeHadoop); err2 != nil {
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing get_default_configuration: " + err2.Error())
    oprot.WriteMessageBegin("get_default_configuration", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  } else {
    result.Success = retval
}
  if err2 = oprot.WriteMessageBegin("get_default_configuration", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}

type beeswaxServiceProcessorClose struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorClose) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceCloseArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("close", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceCloseResult{}
  var err2 error
  if err2 = p.handler.Close(ctx, args.Handle); err2 != nil {
  switch v := err2.(type) {
    case *QueryNotFoundException:
  result.Error = v
    case *BeeswaxException:
  result.Error2 = v
    default:
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing close: " + err2.Error())
    oprot.WriteMessageBegin("close", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  }
  }
  if err2 = oprot.WriteMessageBegin("close", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}

type beeswaxServiceProcessorClean struct {
  handler BeeswaxService
}

func (p *beeswaxServiceProcessorClean) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  args := BeeswaxServiceCleanArgs{}
  if err = args.Read(iprot); err != nil {
    iprot.ReadMessageEnd()
    x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
    oprot.WriteMessageBegin("clean", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return false, err
  }

  iprot.ReadMessageEnd()
  result := BeeswaxServiceCleanResult{}
  var err2 error
  if err2 = p.handler.Clean(ctx, args.LogContext); err2 != nil {
    x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing clean: " + err2.Error())
    oprot.WriteMessageBegin("clean", thrift.EXCEPTION, seqId)
    x.Write(oprot)
    oprot.WriteMessageEnd()
    oprot.Flush(ctx)
    return true, err2
  }
  if err2 = oprot.WriteMessageBegin("clean", thrift.REPLY, seqId); err2 != nil {
    err = err2
  }
  if err2 = result.Write(oprot); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
    err = err2
  }
  if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
    err = err2
  }
  if err != nil {
    return
  }
  return true, err
}


// HELPER FUNCTIONS AND STRUCTURES

// Attributes:
//  - Query
type BeeswaxServiceQueryArgs struct {
  Query *Query `thrift:"query,1" db:"query" json:"query"`
}

func NewBeeswaxServiceQueryArgs() *BeeswaxServiceQueryArgs {
  return &BeeswaxServiceQueryArgs{}
}

var BeeswaxServiceQueryArgs_Query_DEFAULT *Query
func (p *BeeswaxServiceQueryArgs) GetQuery() *Query {
  if !p.IsSetQuery() {
    return BeeswaxServiceQueryArgs_Query_DEFAULT
  }
return p.Query
}
func (p *BeeswaxServiceQueryArgs) IsSetQuery() bool {
  return p.Query != nil
}

func (p *BeeswaxServiceQueryArgs) 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
        }
      }
    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 *BeeswaxServiceQueryArgs)  ReadField1(iprot thrift.TProtocol) error {
  p.Query = &Query{}
  if err := p.Query.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err)
  }
  return nil
}

func (p *BeeswaxServiceQueryArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("query_args"); 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 *BeeswaxServiceQueryArgs) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) }
  if err := p.Query.Write(oprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err)
  }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) }
  return err
}

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

// Attributes:
//  - Success
//  - Error
type BeeswaxServiceQueryResult struct {
  Success *QueryHandle `thrift:"success,0" db:"success" json:"success,omitempty"`
  Error *BeeswaxException `thrift:"error,1" db:"error" json:"error,omitempty"`
}

func NewBeeswaxServiceQueryResult() *BeeswaxServiceQueryResult {
  return &BeeswaxServiceQueryResult{}
}

var BeeswaxServiceQueryResult_Success_DEFAULT *QueryHandle
func (p *BeeswaxServiceQueryResult) GetSuccess() *QueryHandle {
  if !p.IsSetSuccess() {
    return BeeswaxServiceQueryResult_Success_DEFAULT
  }
return p.Success
}
var BeeswaxServiceQueryResult_Error_DEFAULT *BeeswaxException
func (p *BeeswaxServiceQueryResult) GetError() *BeeswaxException {
  if !p.IsSetError() {
    return BeeswaxServiceQueryResult_Error_DEFAULT
  }
return p.Error
}
func (p *BeeswaxServiceQueryResult) IsSetSuccess() bool {
  return p.Success != nil
}

func (p *BeeswaxServiceQueryResult) IsSetError() bool {
  return p.Error != nil
}

func (p *BeeswaxServiceQueryResult) 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 0:
      if fieldTypeId == thrift.STRUCT {
        if err := p.ReadField0(iprot); err != nil {
          return err
        }
      } else {
        if err := iprot.Skip(fieldTypeId); err != nil {
          return err
        }
      }
    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
        }
      }
    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 *BeeswaxServiceQueryResult)  ReadField0(iprot thrift.TProtocol) error {
  p.Success = &QueryHandle{}
  if err := p.Success.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
  }
  return nil
}

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

func (p *BeeswaxServiceQueryResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("query_result"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
    if err := p.writeField0(oprot); err != nil { return err }
    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 *BeeswaxServiceQueryResult) writeField0(oprot thrift.TProtocol) (err error) {
  if p.IsSetSuccess() {
    if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
    if err := p.Success.Write(oprot); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
    }
    if err := oprot.WriteFieldEnd(); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
  }
  return err
}

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

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

// Attributes:
//  - Query
//  - ClientCtx
type BeeswaxServiceExecuteAndWaitArgs struct {
  Query *Query `thrift:"query,1" db:"query" json:"query"`
  ClientCtx LogContextId `thrift:"clientCtx,2" db:"clientCtx" json:"clientCtx"`
}

func NewBeeswaxServiceExecuteAndWaitArgs() *BeeswaxServiceExecuteAndWaitArgs {
  return &BeeswaxServiceExecuteAndWaitArgs{}
}

var BeeswaxServiceExecuteAndWaitArgs_Query_DEFAULT *Query
func (p *BeeswaxServiceExecuteAndWaitArgs) GetQuery() *Query {
  if !p.IsSetQuery() {
    return BeeswaxServiceExecuteAndWaitArgs_Query_DEFAULT
  }
return p.Query
}

func (p *BeeswaxServiceExecuteAndWaitArgs) GetClientCtx() LogContextId {
  return p.ClientCtx
}
func (p *BeeswaxServiceExecuteAndWaitArgs) IsSetQuery() bool {
  return p.Query != nil
}

func (p *BeeswaxServiceExecuteAndWaitArgs) 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 *BeeswaxServiceExecuteAndWaitArgs)  ReadField1(iprot thrift.TProtocol) error {
  p.Query = &Query{}
  if err := p.Query.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err)
  }
  return nil
}

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

func (p *BeeswaxServiceExecuteAndWaitArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("executeAndWait_args"); 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 *BeeswaxServiceExecuteAndWaitArgs) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) }
  if err := p.Query.Write(oprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err)
  }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) }
  return err
}

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

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

// Attributes:
//  - Success
//  - Error
type BeeswaxServiceExecuteAndWaitResult struct {
  Success *QueryHandle `thrift:"success,0" db:"success" json:"success,omitempty"`
  Error *BeeswaxException `thrift:"error,1" db:"error" json:"error,omitempty"`
}

func NewBeeswaxServiceExecuteAndWaitResult() *BeeswaxServiceExecuteAndWaitResult {
  return &BeeswaxServiceExecuteAndWaitResult{}
}

var BeeswaxServiceExecuteAndWaitResult_Success_DEFAULT *QueryHandle
func (p *BeeswaxServiceExecuteAndWaitResult) GetSuccess() *QueryHandle {
  if !p.IsSetSuccess() {
    return BeeswaxServiceExecuteAndWaitResult_Success_DEFAULT
  }
return p.Success
}
var BeeswaxServiceExecuteAndWaitResult_Error_DEFAULT *BeeswaxException
func (p *BeeswaxServiceExecuteAndWaitResult) GetError() *BeeswaxException {
  if !p.IsSetError() {
    return BeeswaxServiceExecuteAndWaitResult_Error_DEFAULT
  }
return p.Error
}
func (p *BeeswaxServiceExecuteAndWaitResult) IsSetSuccess() bool {
  return p.Success != nil
}

func (p *BeeswaxServiceExecuteAndWaitResult) IsSetError() bool {
  return p.Error != nil
}

func (p *BeeswaxServiceExecuteAndWaitResult) 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 0:
      if fieldTypeId == thrift.STRUCT {
        if err := p.ReadField0(iprot); err != nil {
          return err
        }
      } else {
        if err := iprot.Skip(fieldTypeId); err != nil {
          return err
        }
      }
    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
        }
      }
    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 *BeeswaxServiceExecuteAndWaitResult)  ReadField0(iprot thrift.TProtocol) error {
  p.Success = &QueryHandle{}
  if err := p.Success.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
  }
  return nil
}

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

func (p *BeeswaxServiceExecuteAndWaitResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("executeAndWait_result"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
    if err := p.writeField0(oprot); err != nil { return err }
    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 *BeeswaxServiceExecuteAndWaitResult) writeField0(oprot thrift.TProtocol) (err error) {
  if p.IsSetSuccess() {
    if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
    if err := p.Success.Write(oprot); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
    }
    if err := oprot.WriteFieldEnd(); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
  }
  return err
}

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

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

// Attributes:
//  - Query
type BeeswaxServiceExplainArgs struct {
  Query *Query `thrift:"query,1" db:"query" json:"query"`
}

func NewBeeswaxServiceExplainArgs() *BeeswaxServiceExplainArgs {
  return &BeeswaxServiceExplainArgs{}
}

var BeeswaxServiceExplainArgs_Query_DEFAULT *Query
func (p *BeeswaxServiceExplainArgs) GetQuery() *Query {
  if !p.IsSetQuery() {
    return BeeswaxServiceExplainArgs_Query_DEFAULT
  }
return p.Query
}
func (p *BeeswaxServiceExplainArgs) IsSetQuery() bool {
  return p.Query != nil
}

func (p *BeeswaxServiceExplainArgs) 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
        }
      }
    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 *BeeswaxServiceExplainArgs)  ReadField1(iprot thrift.TProtocol) error {
  p.Query = &Query{}
  if err := p.Query.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Query), err)
  }
  return nil
}

func (p *BeeswaxServiceExplainArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("explain_args"); 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 *BeeswaxServiceExplainArgs) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("query", thrift.STRUCT, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query: ", p), err) }
  if err := p.Query.Write(oprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Query), err)
  }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query: ", p), err) }
  return err
}

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

// Attributes:
//  - Success
//  - Error
type BeeswaxServiceExplainResult struct {
  Success *QueryExplanation `thrift:"success,0" db:"success" json:"success,omitempty"`
  Error *BeeswaxException `thrift:"error,1" db:"error" json:"error,omitempty"`
}

func NewBeeswaxServiceExplainResult() *BeeswaxServiceExplainResult {
  return &BeeswaxServiceExplainResult{}
}

var BeeswaxServiceExplainResult_Success_DEFAULT *QueryExplanation
func (p *BeeswaxServiceExplainResult) GetSuccess() *QueryExplanation {
  if !p.IsSetSuccess() {
    return BeeswaxServiceExplainResult_Success_DEFAULT
  }
return p.Success
}
var BeeswaxServiceExplainResult_Error_DEFAULT *BeeswaxException
func (p *BeeswaxServiceExplainResult) GetError() *BeeswaxException {
  if !p.IsSetError() {
    return BeeswaxServiceExplainResult_Error_DEFAULT
  }
return p.Error
}
func (p *BeeswaxServiceExplainResult) IsSetSuccess() bool {
  return p.Success != nil
}

func (p *BeeswaxServiceExplainResult) IsSetError() bool {
  return p.Error != nil
}

func (p *BeeswaxServiceExplainResult) 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 0:
      if fieldTypeId == thrift.STRUCT {
        if err := p.ReadField0(iprot); err != nil {
          return err
        }
      } else {
        if err := iprot.Skip(fieldTypeId); err != nil {
          return err
        }
      }
    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
        }
      }
    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 *BeeswaxServiceExplainResult)  ReadField0(iprot thrift.TProtocol) error {
  p.Success = &QueryExplanation{}
  if err := p.Success.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
  }
  return nil
}

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

func (p *BeeswaxServiceExplainResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("explain_result"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
    if err := p.writeField0(oprot); err != nil { return err }
    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 *BeeswaxServiceExplainResult) writeField0(oprot thrift.TProtocol) (err error) {
  if p.IsSetSuccess() {
    if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
    if err := p.Success.Write(oprot); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
    }
    if err := oprot.WriteFieldEnd(); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
  }
  return err
}

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

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

// Attributes:
//  - QueryID
//  - StartOver
//  - FetchSize
type BeeswaxServiceFetchArgs struct {
  QueryID *QueryHandle `thrift:"query_id,1" db:"query_id" json:"query_id"`
  StartOver bool `thrift:"start_over,2" db:"start_over" json:"start_over"`
  FetchSize int32 `thrift:"fetch_size,3" db:"fetch_size" json:"fetch_size"`
}

func NewBeeswaxServiceFetchArgs() *BeeswaxServiceFetchArgs {
  return &BeeswaxServiceFetchArgs{
FetchSize: -1,
}
}

var BeeswaxServiceFetchArgs_QueryID_DEFAULT *QueryHandle
func (p *BeeswaxServiceFetchArgs) GetQueryID() *QueryHandle {
  if !p.IsSetQueryID() {
    return BeeswaxServiceFetchArgs_QueryID_DEFAULT
  }
return p.QueryID
}

func (p *BeeswaxServiceFetchArgs) GetStartOver() bool {
  return p.StartOver
}

func (p *BeeswaxServiceFetchArgs) GetFetchSize() int32 {
  return p.FetchSize
}
func (p *BeeswaxServiceFetchArgs) IsSetQueryID() bool {
  return p.QueryID != nil
}

func (p *BeeswaxServiceFetchArgs) 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.BOOL {
        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
        }
      }
    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 *BeeswaxServiceFetchArgs)  ReadField1(iprot thrift.TProtocol) error {
  p.QueryID = &QueryHandle{}
  if err := p.QueryID.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.QueryID), err)
  }
  return nil
}

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

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

func (p *BeeswaxServiceFetchArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("fetch_args"); 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 *BeeswaxServiceFetchArgs) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("query_id", thrift.STRUCT, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:query_id: ", p), err) }
  if err := p.QueryID.Write(oprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.QueryID), err)
  }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:query_id: ", p), err) }
  return err
}

func (p *BeeswaxServiceFetchArgs) writeField2(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("start_over", thrift.BOOL, 2); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:start_over: ", p), err) }
  if err := oprot.WriteBool(bool(p.StartOver)); err != nil {
  return thrift.PrependError(fmt.Sprintf("%T.start_over (2) field write error: ", p), err) }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 2:start_over: ", p), err) }
  return err
}

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

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

// Attributes:
//  - Success
//  - Error
//  - Error2
type BeeswaxServiceFetchResult struct {
  Success *Results `thrift:"success,0" db:"success" json:"success,omitempty"`
  Error *QueryNotFoundException `thrift:"error,1" db:"error" json:"error,omitempty"`
  Error2 *BeeswaxException `thrift:"error2,2" db:"error2" json:"error2,omitempty"`
}

func NewBeeswaxServiceFetchResult() *BeeswaxServiceFetchResult {
  return &BeeswaxServiceFetchResult{}
}

var BeeswaxServiceFetchResult_Success_DEFAULT *Results
func (p *BeeswaxServiceFetchResult) GetSuccess() *Results {
  if !p.IsSetSuccess() {
    return BeeswaxServiceFetchResult_Success_DEFAULT
  }
return p.Success
}
var BeeswaxServiceFetchResult_Error_DEFAULT *QueryNotFoundException
func (p *BeeswaxServiceFetchResult) GetError() *QueryNotFoundException {
  if !p.IsSetError() {
    return BeeswaxServiceFetchResult_Error_DEFAULT
  }
return p.Error
}
var BeeswaxServiceFetchResult_Error2_DEFAULT *BeeswaxException
func (p *BeeswaxServiceFetchResult) GetError2() *BeeswaxException {
  if !p.IsSetError2() {
    return BeeswaxServiceFetchResult_Error2_DEFAULT
  }
return p.Error2
}
func (p *BeeswaxServiceFetchResult) IsSetSuccess() bool {
  return p.Success != nil
}

func (p *BeeswaxServiceFetchResult) IsSetError() bool {
  return p.Error != nil
}

func (p *BeeswaxServiceFetchResult) IsSetError2() bool {
  return p.Error2 != nil
}

func (p *BeeswaxServiceFetchResult) 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 0:
      if fieldTypeId == thrift.STRUCT {
        if err := p.ReadField0(iprot); err != nil {
          return err
        }
      } else {
        if err := iprot.Skip(fieldTypeId); err != nil {
          return err
        }
      }
    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
        }
      }
    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 *BeeswaxServiceFetchResult)  ReadField0(iprot thrift.TProtocol) error {
  p.Success = &Results{}
  if err := p.Success.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
  }
  return nil
}

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

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

func (p *BeeswaxServiceFetchResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("fetch_result"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
    if err := p.writeField0(oprot); err != nil { return err }
    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 *BeeswaxServiceFetchResult) writeField0(oprot thrift.TProtocol) (err error) {
  if p.IsSetSuccess() {
    if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
    if err := p.Success.Write(oprot); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
    }
    if err := oprot.WriteFieldEnd(); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
  }
  return err
}

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

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

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

// Attributes:
//  - Handle
type BeeswaxServiceGetStateArgs struct {
  Handle *QueryHandle `thrift:"handle,1" db:"handle" json:"handle"`
}

func NewBeeswaxServiceGetStateArgs() *BeeswaxServiceGetStateArgs {
  return &BeeswaxServiceGetStateArgs{}
}

var BeeswaxServiceGetStateArgs_Handle_DEFAULT *QueryHandle
func (p *BeeswaxServiceGetStateArgs) GetHandle() *QueryHandle {
  if !p.IsSetHandle() {
    return BeeswaxServiceGetStateArgs_Handle_DEFAULT
  }
return p.Handle
}
func (p *BeeswaxServiceGetStateArgs) IsSetHandle() bool {
  return p.Handle != nil
}

func (p *BeeswaxServiceGetStateArgs) 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
        }
      }
    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 *BeeswaxServiceGetStateArgs)  ReadField1(iprot thrift.TProtocol) error {
  p.Handle = &QueryHandle{}
  if err := p.Handle.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Handle), err)
  }
  return nil
}

func (p *BeeswaxServiceGetStateArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("get_state_args"); 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 *BeeswaxServiceGetStateArgs) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("handle", thrift.STRUCT, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:handle: ", p), err) }
  if err := p.Handle.Write(oprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Handle), err)
  }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:handle: ", p), err) }
  return err
}

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

// Attributes:
//  - Success
//  - Error
type BeeswaxServiceGetStateResult struct {
  Success *QueryState `thrift:"success,0" db:"success" json:"success,omitempty"`
  Error *QueryNotFoundException `thrift:"error,1" db:"error" json:"error,omitempty"`
}

func NewBeeswaxServiceGetStateResult() *BeeswaxServiceGetStateResult {
  return &BeeswaxServiceGetStateResult{}
}

var BeeswaxServiceGetStateResult_Success_DEFAULT QueryState
func (p *BeeswaxServiceGetStateResult) GetSuccess() QueryState {
  if !p.IsSetSuccess() {
    return BeeswaxServiceGetStateResult_Success_DEFAULT
  }
return *p.Success
}
var BeeswaxServiceGetStateResult_Error_DEFAULT *QueryNotFoundException
func (p *BeeswaxServiceGetStateResult) GetError() *QueryNotFoundException {
  if !p.IsSetError() {
    return BeeswaxServiceGetStateResult_Error_DEFAULT
  }
return p.Error
}
func (p *BeeswaxServiceGetStateResult) IsSetSuccess() bool {
  return p.Success != nil
}

func (p *BeeswaxServiceGetStateResult) IsSetError() bool {
  return p.Error != nil
}

func (p *BeeswaxServiceGetStateResult) 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 0:
      if fieldTypeId == thrift.I32 {
        if err := p.ReadField0(iprot); err != nil {
          return err
        }
      } else {
        if err := iprot.Skip(fieldTypeId); err != nil {
          return err
        }
      }
    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
        }
      }
    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 *BeeswaxServiceGetStateResult)  ReadField0(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadI32(); err != nil {
  return thrift.PrependError("error reading field 0: ", err)
} else {
  temp := QueryState(v)
  p.Success = &temp
}
  return nil
}

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

func (p *BeeswaxServiceGetStateResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("get_state_result"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
    if err := p.writeField0(oprot); err != nil { return err }
    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 *BeeswaxServiceGetStateResult) writeField0(oprot thrift.TProtocol) (err error) {
  if p.IsSetSuccess() {
    if err := oprot.WriteFieldBegin("success", thrift.I32, 0); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
    if err := oprot.WriteI32(int32(*p.Success)); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T.success (0) field write error: ", p), err) }
    if err := oprot.WriteFieldEnd(); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
  }
  return err
}

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

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

// Attributes:
//  - Handle
type BeeswaxServiceGetResultsMetadataArgs struct {
  Handle *QueryHandle `thrift:"handle,1" db:"handle" json:"handle"`
}

func NewBeeswaxServiceGetResultsMetadataArgs() *BeeswaxServiceGetResultsMetadataArgs {
  return &BeeswaxServiceGetResultsMetadataArgs{}
}

var BeeswaxServiceGetResultsMetadataArgs_Handle_DEFAULT *QueryHandle
func (p *BeeswaxServiceGetResultsMetadataArgs) GetHandle() *QueryHandle {
  if !p.IsSetHandle() {
    return BeeswaxServiceGetResultsMetadataArgs_Handle_DEFAULT
  }
return p.Handle
}
func (p *BeeswaxServiceGetResultsMetadataArgs) IsSetHandle() bool {
  return p.Handle != nil
}

func (p *BeeswaxServiceGetResultsMetadataArgs) 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
        }
      }
    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 *BeeswaxServiceGetResultsMetadataArgs)  ReadField1(iprot thrift.TProtocol) error {
  p.Handle = &QueryHandle{}
  if err := p.Handle.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Handle), err)
  }
  return nil
}

func (p *BeeswaxServiceGetResultsMetadataArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("get_results_metadata_args"); 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 *BeeswaxServiceGetResultsMetadataArgs) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("handle", thrift.STRUCT, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:handle: ", p), err) }
  if err := p.Handle.Write(oprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Handle), err)
  }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:handle: ", p), err) }
  return err
}

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

// Attributes:
//  - Success
//  - Error
type BeeswaxServiceGetResultsMetadataResult struct {
  Success *ResultsMetadata `thrift:"success,0" db:"success" json:"success,omitempty"`
  Error *QueryNotFoundException `thrift:"error,1" db:"error" json:"error,omitempty"`
}

func NewBeeswaxServiceGetResultsMetadataResult() *BeeswaxServiceGetResultsMetadataResult {
  return &BeeswaxServiceGetResultsMetadataResult{}
}

var BeeswaxServiceGetResultsMetadataResult_Success_DEFAULT *ResultsMetadata
func (p *BeeswaxServiceGetResultsMetadataResult) GetSuccess() *ResultsMetadata {
  if !p.IsSetSuccess() {
    return BeeswaxServiceGetResultsMetadataResult_Success_DEFAULT
  }
return p.Success
}
var BeeswaxServiceGetResultsMetadataResult_Error_DEFAULT *QueryNotFoundException
func (p *BeeswaxServiceGetResultsMetadataResult) GetError() *QueryNotFoundException {
  if !p.IsSetError() {
    return BeeswaxServiceGetResultsMetadataResult_Error_DEFAULT
  }
return p.Error
}
func (p *BeeswaxServiceGetResultsMetadataResult) IsSetSuccess() bool {
  return p.Success != nil
}

func (p *BeeswaxServiceGetResultsMetadataResult) IsSetError() bool {
  return p.Error != nil
}

func (p *BeeswaxServiceGetResultsMetadataResult) 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 0:
      if fieldTypeId == thrift.STRUCT {
        if err := p.ReadField0(iprot); err != nil {
          return err
        }
      } else {
        if err := iprot.Skip(fieldTypeId); err != nil {
          return err
        }
      }
    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
        }
      }
    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 *BeeswaxServiceGetResultsMetadataResult)  ReadField0(iprot thrift.TProtocol) error {
  p.Success = &ResultsMetadata{}
  if err := p.Success.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
  }
  return nil
}

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

func (p *BeeswaxServiceGetResultsMetadataResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("get_results_metadata_result"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
    if err := p.writeField0(oprot); err != nil { return err }
    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 *BeeswaxServiceGetResultsMetadataResult) writeField0(oprot thrift.TProtocol) (err error) {
  if p.IsSetSuccess() {
    if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
    if err := p.Success.Write(oprot); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
    }
    if err := oprot.WriteFieldEnd(); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
  }
  return err
}

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

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

// Attributes:
//  - S
type BeeswaxServiceEchoArgs struct {
  S string `thrift:"s,1" db:"s" json:"s"`
}

func NewBeeswaxServiceEchoArgs() *BeeswaxServiceEchoArgs {
  return &BeeswaxServiceEchoArgs{}
}


func (p *BeeswaxServiceEchoArgs) GetS() string {
  return p.S
}
func (p *BeeswaxServiceEchoArgs) 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 *BeeswaxServiceEchoArgs)  ReadField1(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadString(); err != nil {
  return thrift.PrependError("error reading field 1: ", err)
} else {
  p.S = v
}
  return nil
}

func (p *BeeswaxServiceEchoArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("echo_args"); 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 *BeeswaxServiceEchoArgs) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("s", thrift.STRING, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:s: ", p), err) }
  if err := oprot.WriteString(string(p.S)); err != nil {
  return thrift.PrependError(fmt.Sprintf("%T.s (1) field write error: ", p), err) }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:s: ", p), err) }
  return err
}

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

// Attributes:
//  - Success
type BeeswaxServiceEchoResult struct {
  Success *string `thrift:"success,0" db:"success" json:"success,omitempty"`
}

func NewBeeswaxServiceEchoResult() *BeeswaxServiceEchoResult {
  return &BeeswaxServiceEchoResult{}
}

var BeeswaxServiceEchoResult_Success_DEFAULT string
func (p *BeeswaxServiceEchoResult) GetSuccess() string {
  if !p.IsSetSuccess() {
    return BeeswaxServiceEchoResult_Success_DEFAULT
  }
return *p.Success
}
func (p *BeeswaxServiceEchoResult) IsSetSuccess() bool {
  return p.Success != nil
}

func (p *BeeswaxServiceEchoResult) 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 0:
      if fieldTypeId == thrift.STRING {
        if err := p.ReadField0(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 *BeeswaxServiceEchoResult)  ReadField0(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadString(); err != nil {
  return thrift.PrependError("error reading field 0: ", err)
} else {
  p.Success = &v
}
  return nil
}

func (p *BeeswaxServiceEchoResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("echo_result"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
    if err := p.writeField0(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 *BeeswaxServiceEchoResult) writeField0(oprot thrift.TProtocol) (err error) {
  if p.IsSetSuccess() {
    if err := oprot.WriteFieldBegin("success", thrift.STRING, 0); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
    if err := oprot.WriteString(string(*p.Success)); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T.success (0) field write error: ", p), err) }
    if err := oprot.WriteFieldEnd(); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
  }
  return err
}

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

type BeeswaxServiceDumpConfigArgs struct {
}

func NewBeeswaxServiceDumpConfigArgs() *BeeswaxServiceDumpConfigArgs {
  return &BeeswaxServiceDumpConfigArgs{}
}

func (p *BeeswaxServiceDumpConfigArgs) 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; }
    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 *BeeswaxServiceDumpConfigArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("dump_config_args"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
  }
  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 *BeeswaxServiceDumpConfigArgs) String() string {
  if p == nil {
    return "<nil>"
  }
  return fmt.Sprintf("BeeswaxServiceDumpConfigArgs(%+v)", *p)
}

// Attributes:
//  - Success
type BeeswaxServiceDumpConfigResult struct {
  Success *string `thrift:"success,0" db:"success" json:"success,omitempty"`
}

func NewBeeswaxServiceDumpConfigResult() *BeeswaxServiceDumpConfigResult {
  return &BeeswaxServiceDumpConfigResult{}
}

var BeeswaxServiceDumpConfigResult_Success_DEFAULT string
func (p *BeeswaxServiceDumpConfigResult) GetSuccess() string {
  if !p.IsSetSuccess() {
    return BeeswaxServiceDumpConfigResult_Success_DEFAULT
  }
return *p.Success
}
func (p *BeeswaxServiceDumpConfigResult) IsSetSuccess() bool {
  return p.Success != nil
}

func (p *BeeswaxServiceDumpConfigResult) 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 0:
      if fieldTypeId == thrift.STRING {
        if err := p.ReadField0(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 *BeeswaxServiceDumpConfigResult)  ReadField0(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadString(); err != nil {
  return thrift.PrependError("error reading field 0: ", err)
} else {
  p.Success = &v
}
  return nil
}

func (p *BeeswaxServiceDumpConfigResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("dump_config_result"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
    if err := p.writeField0(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 *BeeswaxServiceDumpConfigResult) writeField0(oprot thrift.TProtocol) (err error) {
  if p.IsSetSuccess() {
    if err := oprot.WriteFieldBegin("success", thrift.STRING, 0); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
    if err := oprot.WriteString(string(*p.Success)); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T.success (0) field write error: ", p), err) }
    if err := oprot.WriteFieldEnd(); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
  }
  return err
}

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

// Attributes:
//  - Context
type BeeswaxServiceGetLogArgs struct {
  Context LogContextId `thrift:"context,1" db:"context" json:"context"`
}

func NewBeeswaxServiceGetLogArgs() *BeeswaxServiceGetLogArgs {
  return &BeeswaxServiceGetLogArgs{}
}


func (p *BeeswaxServiceGetLogArgs) GetContext() LogContextId {
  return p.Context
}
func (p *BeeswaxServiceGetLogArgs) 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 *BeeswaxServiceGetLogArgs)  ReadField1(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadString(); err != nil {
  return thrift.PrependError("error reading field 1: ", err)
} else {
  temp := LogContextId(v)
  p.Context = temp
}
  return nil
}

func (p *BeeswaxServiceGetLogArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("get_log_args"); 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 *BeeswaxServiceGetLogArgs) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("context", thrift.STRING, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:context: ", p), err) }
  if err := oprot.WriteString(string(p.Context)); err != nil {
  return thrift.PrependError(fmt.Sprintf("%T.context (1) field write error: ", p), err) }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:context: ", p), err) }
  return err
}

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

// Attributes:
//  - Success
//  - Error
type BeeswaxServiceGetLogResult struct {
  Success *string `thrift:"success,0" db:"success" json:"success,omitempty"`
  Error *QueryNotFoundException `thrift:"error,1" db:"error" json:"error,omitempty"`
}

func NewBeeswaxServiceGetLogResult() *BeeswaxServiceGetLogResult {
  return &BeeswaxServiceGetLogResult{}
}

var BeeswaxServiceGetLogResult_Success_DEFAULT string
func (p *BeeswaxServiceGetLogResult) GetSuccess() string {
  if !p.IsSetSuccess() {
    return BeeswaxServiceGetLogResult_Success_DEFAULT
  }
return *p.Success
}
var BeeswaxServiceGetLogResult_Error_DEFAULT *QueryNotFoundException
func (p *BeeswaxServiceGetLogResult) GetError() *QueryNotFoundException {
  if !p.IsSetError() {
    return BeeswaxServiceGetLogResult_Error_DEFAULT
  }
return p.Error
}
func (p *BeeswaxServiceGetLogResult) IsSetSuccess() bool {
  return p.Success != nil
}

func (p *BeeswaxServiceGetLogResult) IsSetError() bool {
  return p.Error != nil
}

func (p *BeeswaxServiceGetLogResult) 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 0:
      if fieldTypeId == thrift.STRING {
        if err := p.ReadField0(iprot); err != nil {
          return err
        }
      } else {
        if err := iprot.Skip(fieldTypeId); err != nil {
          return err
        }
      }
    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
        }
      }
    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 *BeeswaxServiceGetLogResult)  ReadField0(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadString(); err != nil {
  return thrift.PrependError("error reading field 0: ", err)
} else {
  p.Success = &v
}
  return nil
}

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

func (p *BeeswaxServiceGetLogResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("get_log_result"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
    if err := p.writeField0(oprot); err != nil { return err }
    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 *BeeswaxServiceGetLogResult) writeField0(oprot thrift.TProtocol) (err error) {
  if p.IsSetSuccess() {
    if err := oprot.WriteFieldBegin("success", thrift.STRING, 0); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
    if err := oprot.WriteString(string(*p.Success)); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T.success (0) field write error: ", p), err) }
    if err := oprot.WriteFieldEnd(); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
  }
  return err
}

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

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

// Attributes:
//  - IncludeHadoop
type BeeswaxServiceGetDefaultConfigurationArgs struct {
  IncludeHadoop bool `thrift:"include_hadoop,1" db:"include_hadoop" json:"include_hadoop"`
}

func NewBeeswaxServiceGetDefaultConfigurationArgs() *BeeswaxServiceGetDefaultConfigurationArgs {
  return &BeeswaxServiceGetDefaultConfigurationArgs{}
}


func (p *BeeswaxServiceGetDefaultConfigurationArgs) GetIncludeHadoop() bool {
  return p.IncludeHadoop
}
func (p *BeeswaxServiceGetDefaultConfigurationArgs) 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.BOOL {
        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 *BeeswaxServiceGetDefaultConfigurationArgs)  ReadField1(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadBool(); err != nil {
  return thrift.PrependError("error reading field 1: ", err)
} else {
  p.IncludeHadoop = v
}
  return nil
}

func (p *BeeswaxServiceGetDefaultConfigurationArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("get_default_configuration_args"); 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 *BeeswaxServiceGetDefaultConfigurationArgs) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("include_hadoop", thrift.BOOL, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:include_hadoop: ", p), err) }
  if err := oprot.WriteBool(bool(p.IncludeHadoop)); err != nil {
  return thrift.PrependError(fmt.Sprintf("%T.include_hadoop (1) field write error: ", p), err) }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:include_hadoop: ", p), err) }
  return err
}

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

// Attributes:
//  - Success
type BeeswaxServiceGetDefaultConfigurationResult struct {
  Success []*ConfigVariable `thrift:"success,0" db:"success" json:"success,omitempty"`
}

func NewBeeswaxServiceGetDefaultConfigurationResult() *BeeswaxServiceGetDefaultConfigurationResult {
  return &BeeswaxServiceGetDefaultConfigurationResult{}
}

var BeeswaxServiceGetDefaultConfigurationResult_Success_DEFAULT []*ConfigVariable

func (p *BeeswaxServiceGetDefaultConfigurationResult) GetSuccess() []*ConfigVariable {
  return p.Success
}
func (p *BeeswaxServiceGetDefaultConfigurationResult) IsSetSuccess() bool {
  return p.Success != nil
}

func (p *BeeswaxServiceGetDefaultConfigurationResult) 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 0:
      if fieldTypeId == thrift.LIST {
        if err := p.ReadField0(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 *BeeswaxServiceGetDefaultConfigurationResult)  ReadField0(iprot thrift.TProtocol) error {
  _, size, err := iprot.ReadListBegin()
  if err != nil {
    return thrift.PrependError("error reading list begin: ", err)
  }
  tSlice := make([]*ConfigVariable, 0, size)
  p.Success =  tSlice
  for i := 0; i < size; i ++ {
    _elem29 := &ConfigVariable{}
    if err := _elem29.Read(iprot); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem29), err)
    }
    p.Success = append(p.Success, _elem29)
  }
  if err := iprot.ReadListEnd(); err != nil {
    return thrift.PrependError("error reading list end: ", err)
  }
  return nil
}

func (p *BeeswaxServiceGetDefaultConfigurationResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("get_default_configuration_result"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
    if err := p.writeField0(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 *BeeswaxServiceGetDefaultConfigurationResult) writeField0(oprot thrift.TProtocol) (err error) {
  if p.IsSetSuccess() {
    if err := oprot.WriteFieldBegin("success", thrift.LIST, 0); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
    if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Success)); err != nil {
      return thrift.PrependError("error writing list begin: ", err)
    }
    for _, v := range p.Success {
      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 0:success: ", p), err) }
  }
  return err
}

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

// Attributes:
//  - Handle
type BeeswaxServiceCloseArgs struct {
  Handle *QueryHandle `thrift:"handle,1" db:"handle" json:"handle"`
}

func NewBeeswaxServiceCloseArgs() *BeeswaxServiceCloseArgs {
  return &BeeswaxServiceCloseArgs{}
}

var BeeswaxServiceCloseArgs_Handle_DEFAULT *QueryHandle
func (p *BeeswaxServiceCloseArgs) GetHandle() *QueryHandle {
  if !p.IsSetHandle() {
    return BeeswaxServiceCloseArgs_Handle_DEFAULT
  }
return p.Handle
}
func (p *BeeswaxServiceCloseArgs) IsSetHandle() bool {
  return p.Handle != nil
}

func (p *BeeswaxServiceCloseArgs) 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
        }
      }
    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 *BeeswaxServiceCloseArgs)  ReadField1(iprot thrift.TProtocol) error {
  p.Handle = &QueryHandle{}
  if err := p.Handle.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Handle), err)
  }
  return nil
}

func (p *BeeswaxServiceCloseArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("close_args"); 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 *BeeswaxServiceCloseArgs) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("handle", thrift.STRUCT, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:handle: ", p), err) }
  if err := p.Handle.Write(oprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Handle), err)
  }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:handle: ", p), err) }
  return err
}

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

// Attributes:
//  - Error
//  - Error2
type BeeswaxServiceCloseResult struct {
  Error *QueryNotFoundException `thrift:"error,1" db:"error" json:"error,omitempty"`
  Error2 *BeeswaxException `thrift:"error2,2" db:"error2" json:"error2,omitempty"`
}

func NewBeeswaxServiceCloseResult() *BeeswaxServiceCloseResult {
  return &BeeswaxServiceCloseResult{}
}

var BeeswaxServiceCloseResult_Error_DEFAULT *QueryNotFoundException
func (p *BeeswaxServiceCloseResult) GetError() *QueryNotFoundException {
  if !p.IsSetError() {
    return BeeswaxServiceCloseResult_Error_DEFAULT
  }
return p.Error
}
var BeeswaxServiceCloseResult_Error2_DEFAULT *BeeswaxException
func (p *BeeswaxServiceCloseResult) GetError2() *BeeswaxException {
  if !p.IsSetError2() {
    return BeeswaxServiceCloseResult_Error2_DEFAULT
  }
return p.Error2
}
func (p *BeeswaxServiceCloseResult) IsSetError() bool {
  return p.Error != nil
}

func (p *BeeswaxServiceCloseResult) IsSetError2() bool {
  return p.Error2 != nil
}

func (p *BeeswaxServiceCloseResult) 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
        }
      }
    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 *BeeswaxServiceCloseResult)  ReadField1(iprot thrift.TProtocol) error {
  p.Error = &QueryNotFoundException{}
  if err := p.Error.Read(iprot); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Error), err)
  }
  return nil
}

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

func (p *BeeswaxServiceCloseResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("close_result"); 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 *BeeswaxServiceCloseResult) writeField1(oprot thrift.TProtocol) (err error) {
  if p.IsSetError() {
    if err := oprot.WriteFieldBegin("error", thrift.STRUCT, 1); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:error: ", p), err) }
    if err := p.Error.Write(oprot); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Error), err)
    }
    if err := oprot.WriteFieldEnd(); err != nil {
      return thrift.PrependError(fmt.Sprintf("%T write field end error 1:error: ", p), err) }
  }
  return err
}

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

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

// Attributes:
//  - LogContext
type BeeswaxServiceCleanArgs struct {
  LogContext LogContextId `thrift:"log_context,1" db:"log_context" json:"log_context"`
}

func NewBeeswaxServiceCleanArgs() *BeeswaxServiceCleanArgs {
  return &BeeswaxServiceCleanArgs{}
}


func (p *BeeswaxServiceCleanArgs) GetLogContext() LogContextId {
  return p.LogContext
}
func (p *BeeswaxServiceCleanArgs) 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 *BeeswaxServiceCleanArgs)  ReadField1(iprot thrift.TProtocol) error {
  if v, err := iprot.ReadString(); err != nil {
  return thrift.PrependError("error reading field 1: ", err)
} else {
  temp := LogContextId(v)
  p.LogContext = temp
}
  return nil
}

func (p *BeeswaxServiceCleanArgs) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("clean_args"); 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 *BeeswaxServiceCleanArgs) writeField1(oprot thrift.TProtocol) (err error) {
  if err := oprot.WriteFieldBegin("log_context", thrift.STRING, 1); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:log_context: ", p), err) }
  if err := oprot.WriteString(string(p.LogContext)); err != nil {
  return thrift.PrependError(fmt.Sprintf("%T.log_context (1) field write error: ", p), err) }
  if err := oprot.WriteFieldEnd(); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write field end error 1:log_context: ", p), err) }
  return err
}

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

type BeeswaxServiceCleanResult struct {
}

func NewBeeswaxServiceCleanResult() *BeeswaxServiceCleanResult {
  return &BeeswaxServiceCleanResult{}
}

func (p *BeeswaxServiceCleanResult) 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; }
    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 *BeeswaxServiceCleanResult) Write(oprot thrift.TProtocol) error {
  if err := oprot.WriteStructBegin("clean_result"); err != nil {
    return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  if p != nil {
  }
  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 *BeeswaxServiceCleanResult) String() string {
  if p == nil {
    return "<nil>"
  }
  return fmt.Sprintf("BeeswaxServiceCleanResult(%+v)", *p)
}


