<?php
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
use Thrift\Base\TBase;
use Thrift\Type\TType;
use Thrift\Type\TMessageType;
use Thrift\Exception\TException;
use Thrift\Exception\TProtocolException;
use Thrift\Protocol\TProtocol;
use Thrift\Protocol\TBinaryProtocolAccelerated;
use Thrift\Exception\TApplicationException;


final class TProtocolVersion {
  const HIVE_CLI_SERVICE_PROTOCOL_V1 = 0;
  const HIVE_CLI_SERVICE_PROTOCOL_V2 = 1;
  const HIVE_CLI_SERVICE_PROTOCOL_V3 = 2;
  const HIVE_CLI_SERVICE_PROTOCOL_V4 = 3;
  const HIVE_CLI_SERVICE_PROTOCOL_V5 = 4;
  const HIVE_CLI_SERVICE_PROTOCOL_V6 = 5;
  const HIVE_CLI_SERVICE_PROTOCOL_V7 = 6;
  const HIVE_CLI_SERVICE_PROTOCOL_V8 = 7;
  const HIVE_CLI_SERVICE_PROTOCOL_V9 = 8;
  const HIVE_CLI_SERVICE_PROTOCOL_V10 = 9;
  static public $__names = array(
    0 => 'HIVE_CLI_SERVICE_PROTOCOL_V1',
    1 => 'HIVE_CLI_SERVICE_PROTOCOL_V2',
    2 => 'HIVE_CLI_SERVICE_PROTOCOL_V3',
    3 => 'HIVE_CLI_SERVICE_PROTOCOL_V4',
    4 => 'HIVE_CLI_SERVICE_PROTOCOL_V5',
    5 => 'HIVE_CLI_SERVICE_PROTOCOL_V6',
    6 => 'HIVE_CLI_SERVICE_PROTOCOL_V7',
    7 => 'HIVE_CLI_SERVICE_PROTOCOL_V8',
    8 => 'HIVE_CLI_SERVICE_PROTOCOL_V9',
    9 => 'HIVE_CLI_SERVICE_PROTOCOL_V10',
  );
}

final class TTypeId {
  const BOOLEAN_TYPE = 0;
  const TINYINT_TYPE = 1;
  const SMALLINT_TYPE = 2;
  const INT_TYPE = 3;
  const BIGINT_TYPE = 4;
  const FLOAT_TYPE = 5;
  const DOUBLE_TYPE = 6;
  const STRING_TYPE = 7;
  const TIMESTAMP_TYPE = 8;
  const BINARY_TYPE = 9;
  const ARRAY_TYPE = 10;
  const MAP_TYPE = 11;
  const STRUCT_TYPE = 12;
  const UNION_TYPE = 13;
  const USER_DEFINED_TYPE = 14;
  const DECIMAL_TYPE = 15;
  const NULL_TYPE = 16;
  const DATE_TYPE = 17;
  const VARCHAR_TYPE = 18;
  const CHAR_TYPE = 19;
  const INTERVAL_YEAR_MONTH_TYPE = 20;
  const INTERVAL_DAY_TIME_TYPE = 21;
  static public $__names = array(
    0 => 'BOOLEAN_TYPE',
    1 => 'TINYINT_TYPE',
    2 => 'SMALLINT_TYPE',
    3 => 'INT_TYPE',
    4 => 'BIGINT_TYPE',
    5 => 'FLOAT_TYPE',
    6 => 'DOUBLE_TYPE',
    7 => 'STRING_TYPE',
    8 => 'TIMESTAMP_TYPE',
    9 => 'BINARY_TYPE',
    10 => 'ARRAY_TYPE',
    11 => 'MAP_TYPE',
    12 => 'STRUCT_TYPE',
    13 => 'UNION_TYPE',
    14 => 'USER_DEFINED_TYPE',
    15 => 'DECIMAL_TYPE',
    16 => 'NULL_TYPE',
    17 => 'DATE_TYPE',
    18 => 'VARCHAR_TYPE',
    19 => 'CHAR_TYPE',
    20 => 'INTERVAL_YEAR_MONTH_TYPE',
    21 => 'INTERVAL_DAY_TIME_TYPE',
  );
}

final class TStatusCode {
  const SUCCESS_STATUS = 0;
  const SUCCESS_WITH_INFO_STATUS = 1;
  const STILL_EXECUTING_STATUS = 2;
  const ERROR_STATUS = 3;
  const INVALID_HANDLE_STATUS = 4;
  static public $__names = array(
    0 => 'SUCCESS_STATUS',
    1 => 'SUCCESS_WITH_INFO_STATUS',
    2 => 'STILL_EXECUTING_STATUS',
    3 => 'ERROR_STATUS',
    4 => 'INVALID_HANDLE_STATUS',
  );
}

final class TOperationState {
  const INITIALIZED_STATE = 0;
  const RUNNING_STATE = 1;
  const FINISHED_STATE = 2;
  const CANCELED_STATE = 3;
  const CLOSED_STATE = 4;
  const ERROR_STATE = 5;
  const UKNOWN_STATE = 6;
  const PENDING_STATE = 7;
  const TIMEDOUT_STATE = 8;
  static public $__names = array(
    0 => 'INITIALIZED_STATE',
    1 => 'RUNNING_STATE',
    2 => 'FINISHED_STATE',
    3 => 'CANCELED_STATE',
    4 => 'CLOSED_STATE',
    5 => 'ERROR_STATE',
    6 => 'UKNOWN_STATE',
    7 => 'PENDING_STATE',
    8 => 'TIMEDOUT_STATE',
  );
}

final class TOperationType {
  const EXECUTE_STATEMENT = 0;
  const GET_TYPE_INFO = 1;
  const GET_CATALOGS = 2;
  const GET_SCHEMAS = 3;
  const GET_TABLES = 4;
  const GET_TABLE_TYPES = 5;
  const GET_COLUMNS = 6;
  const GET_FUNCTIONS = 7;
  const UNKNOWN = 8;
  static public $__names = array(
    0 => 'EXECUTE_STATEMENT',
    1 => 'GET_TYPE_INFO',
    2 => 'GET_CATALOGS',
    3 => 'GET_SCHEMAS',
    4 => 'GET_TABLES',
    5 => 'GET_TABLE_TYPES',
    6 => 'GET_COLUMNS',
    7 => 'GET_FUNCTIONS',
    8 => 'UNKNOWN',
  );
}

final class TGetInfoType {
  const CLI_MAX_DRIVER_CONNECTIONS = 0;
  const CLI_MAX_CONCURRENT_ACTIVITIES = 1;
  const CLI_DATA_SOURCE_NAME = 2;
  const CLI_FETCH_DIRECTION = 8;
  const CLI_SERVER_NAME = 13;
  const CLI_SEARCH_PATTERN_ESCAPE = 14;
  const CLI_DBMS_NAME = 17;
  const CLI_DBMS_VER = 18;
  const CLI_ACCESSIBLE_TABLES = 19;
  const CLI_ACCESSIBLE_PROCEDURES = 20;
  const CLI_CURSOR_COMMIT_BEHAVIOR = 23;
  const CLI_DATA_SOURCE_READ_ONLY = 25;
  const CLI_DEFAULT_TXN_ISOLATION = 26;
  const CLI_IDENTIFIER_CASE = 28;
  const CLI_IDENTIFIER_QUOTE_CHAR = 29;
  const CLI_MAX_COLUMN_NAME_LEN = 30;
  const CLI_MAX_CURSOR_NAME_LEN = 31;
  const CLI_MAX_SCHEMA_NAME_LEN = 32;
  const CLI_MAX_CATALOG_NAME_LEN = 34;
  const CLI_MAX_TABLE_NAME_LEN = 35;
  const CLI_SCROLL_CONCURRENCY = 43;
  const CLI_TXN_CAPABLE = 46;
  const CLI_USER_NAME = 47;
  const CLI_TXN_ISOLATION_OPTION = 72;
  const CLI_INTEGRITY = 73;
  const CLI_GETDATA_EXTENSIONS = 81;
  const CLI_NULL_COLLATION = 85;
  const CLI_ALTER_TABLE = 86;
  const CLI_ORDER_BY_COLUMNS_IN_SELECT = 90;
  const CLI_SPECIAL_CHARACTERS = 94;
  const CLI_MAX_COLUMNS_IN_GROUP_BY = 97;
  const CLI_MAX_COLUMNS_IN_INDEX = 98;
  const CLI_MAX_COLUMNS_IN_ORDER_BY = 99;
  const CLI_MAX_COLUMNS_IN_SELECT = 100;
  const CLI_MAX_COLUMNS_IN_TABLE = 101;
  const CLI_MAX_INDEX_SIZE = 102;
  const CLI_MAX_ROW_SIZE = 104;
  const CLI_MAX_STATEMENT_LEN = 105;
  const CLI_MAX_TABLES_IN_SELECT = 106;
  const CLI_MAX_USER_NAME_LEN = 107;
  const CLI_OJ_CAPABILITIES = 115;
  const CLI_XOPEN_CLI_YEAR = 10000;
  const CLI_CURSOR_SENSITIVITY = 10001;
  const CLI_DESCRIBE_PARAMETER = 10002;
  const CLI_CATALOG_NAME = 10003;
  const CLI_COLLATION_SEQ = 10004;
  const CLI_MAX_IDENTIFIER_LEN = 10005;
  static public $__names = array(
    0 => 'CLI_MAX_DRIVER_CONNECTIONS',
    1 => 'CLI_MAX_CONCURRENT_ACTIVITIES',
    2 => 'CLI_DATA_SOURCE_NAME',
    8 => 'CLI_FETCH_DIRECTION',
    13 => 'CLI_SERVER_NAME',
    14 => 'CLI_SEARCH_PATTERN_ESCAPE',
    17 => 'CLI_DBMS_NAME',
    18 => 'CLI_DBMS_VER',
    19 => 'CLI_ACCESSIBLE_TABLES',
    20 => 'CLI_ACCESSIBLE_PROCEDURES',
    23 => 'CLI_CURSOR_COMMIT_BEHAVIOR',
    25 => 'CLI_DATA_SOURCE_READ_ONLY',
    26 => 'CLI_DEFAULT_TXN_ISOLATION',
    28 => 'CLI_IDENTIFIER_CASE',
    29 => 'CLI_IDENTIFIER_QUOTE_CHAR',
    30 => 'CLI_MAX_COLUMN_NAME_LEN',
    31 => 'CLI_MAX_CURSOR_NAME_LEN',
    32 => 'CLI_MAX_SCHEMA_NAME_LEN',
    34 => 'CLI_MAX_CATALOG_NAME_LEN',
    35 => 'CLI_MAX_TABLE_NAME_LEN',
    43 => 'CLI_SCROLL_CONCURRENCY',
    46 => 'CLI_TXN_CAPABLE',
    47 => 'CLI_USER_NAME',
    72 => 'CLI_TXN_ISOLATION_OPTION',
    73 => 'CLI_INTEGRITY',
    81 => 'CLI_GETDATA_EXTENSIONS',
    85 => 'CLI_NULL_COLLATION',
    86 => 'CLI_ALTER_TABLE',
    90 => 'CLI_ORDER_BY_COLUMNS_IN_SELECT',
    94 => 'CLI_SPECIAL_CHARACTERS',
    97 => 'CLI_MAX_COLUMNS_IN_GROUP_BY',
    98 => 'CLI_MAX_COLUMNS_IN_INDEX',
    99 => 'CLI_MAX_COLUMNS_IN_ORDER_BY',
    100 => 'CLI_MAX_COLUMNS_IN_SELECT',
    101 => 'CLI_MAX_COLUMNS_IN_TABLE',
    102 => 'CLI_MAX_INDEX_SIZE',
    104 => 'CLI_MAX_ROW_SIZE',
    105 => 'CLI_MAX_STATEMENT_LEN',
    106 => 'CLI_MAX_TABLES_IN_SELECT',
    107 => 'CLI_MAX_USER_NAME_LEN',
    115 => 'CLI_OJ_CAPABILITIES',
    10000 => 'CLI_XOPEN_CLI_YEAR',
    10001 => 'CLI_CURSOR_SENSITIVITY',
    10002 => 'CLI_DESCRIBE_PARAMETER',
    10003 => 'CLI_CATALOG_NAME',
    10004 => 'CLI_COLLATION_SEQ',
    10005 => 'CLI_MAX_IDENTIFIER_LEN',
  );
}

final class TFetchOrientation {
  const FETCH_NEXT = 0;
  const FETCH_PRIOR = 1;
  const FETCH_RELATIVE = 2;
  const FETCH_ABSOLUTE = 3;
  const FETCH_FIRST = 4;
  const FETCH_LAST = 5;
  static public $__names = array(
    0 => 'FETCH_NEXT',
    1 => 'FETCH_PRIOR',
    2 => 'FETCH_RELATIVE',
    3 => 'FETCH_ABSOLUTE',
    4 => 'FETCH_FIRST',
    5 => 'FETCH_LAST',
  );
}

final class TJobExecutionStatus {
  const IN_PROGRESS = 0;
  const COMPLETE = 1;
  const NOT_AVAILABLE = 2;
  static public $__names = array(
    0 => 'IN_PROGRESS',
    1 => 'COMPLETE',
    2 => 'NOT_AVAILABLE',
  );
}

class TTypeQualifierValue {
  static $_TSPEC;

  /**
   * @var int
   */
  public $i32Value = null;
  /**
   * @var string
   */
  public $stringValue = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'i32Value',
          'type' => TType::I32,
          ),
        2 => array(
          'var' => 'stringValue',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['i32Value'])) {
        $this->i32Value = $vals['i32Value'];
      }
      if (isset($vals['stringValue'])) {
        $this->stringValue = $vals['stringValue'];
      }
    }
  }

  public function getName() {
    return 'TTypeQualifierValue';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->i32Value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->stringValue);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TTypeQualifierValue');
    if ($this->i32Value !== null) {
      $xfer += $output->writeFieldBegin('i32Value', TType::I32, 1);
      $xfer += $output->writeI32($this->i32Value);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->stringValue !== null) {
      $xfer += $output->writeFieldBegin('stringValue', TType::STRING, 2);
      $xfer += $output->writeString($this->stringValue);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TTypeQualifiers {
  static $_TSPEC;

  /**
   * @var array
   */
  public $qualifiers = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'qualifiers',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::STRUCT,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::STRUCT,
            'class' => '\TTypeQualifierValue',
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['qualifiers'])) {
        $this->qualifiers = $vals['qualifiers'];
      }
    }
  }

  public function getName() {
    return 'TTypeQualifiers';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::MAP) {
            $this->qualifiers = array();
            $_size0 = 0;
            $_ktype1 = 0;
            $_vtype2 = 0;
            $xfer += $input->readMapBegin($_ktype1, $_vtype2, $_size0);
            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
            {
              $key5 = '';
              $val6 = new \TTypeQualifierValue();
              $xfer += $input->readString($key5);
              $val6 = new \TTypeQualifierValue();
              $xfer += $val6->read($input);
              $this->qualifiers[$key5] = $val6;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TTypeQualifiers');
    if ($this->qualifiers !== null) {
      if (!is_array($this->qualifiers)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('qualifiers', TType::MAP, 1);
      {
        $output->writeMapBegin(TType::STRING, TType::STRUCT, count($this->qualifiers));
        {
          foreach ($this->qualifiers as $kiter7 => $viter8)
          {
            $xfer += $output->writeString($kiter7);
            $xfer += $viter8->write($output);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TPrimitiveTypeEntry {
  static $_TSPEC;

  /**
   * @var int
   */
  public $type = null;
  /**
   * @var \TTypeQualifiers
   */
  public $typeQualifiers = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'type',
          'type' => TType::I32,
          ),
        2 => array(
          'var' => 'typeQualifiers',
          'type' => TType::STRUCT,
          'class' => '\TTypeQualifiers',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['type'])) {
        $this->type = $vals['type'];
      }
      if (isset($vals['typeQualifiers'])) {
        $this->typeQualifiers = $vals['typeQualifiers'];
      }
    }
  }

  public function getName() {
    return 'TPrimitiveTypeEntry';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->type);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->typeQualifiers = new \TTypeQualifiers();
            $xfer += $this->typeQualifiers->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TPrimitiveTypeEntry');
    if ($this->type !== null) {
      $xfer += $output->writeFieldBegin('type', TType::I32, 1);
      $xfer += $output->writeI32($this->type);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->typeQualifiers !== null) {
      if (!is_object($this->typeQualifiers)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('typeQualifiers', TType::STRUCT, 2);
      $xfer += $this->typeQualifiers->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TArrayTypeEntry {
  static $_TSPEC;

  /**
   * @var int
   */
  public $objectTypePtr = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'objectTypePtr',
          'type' => TType::I32,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['objectTypePtr'])) {
        $this->objectTypePtr = $vals['objectTypePtr'];
      }
    }
  }

  public function getName() {
    return 'TArrayTypeEntry';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->objectTypePtr);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TArrayTypeEntry');
    if ($this->objectTypePtr !== null) {
      $xfer += $output->writeFieldBegin('objectTypePtr', TType::I32, 1);
      $xfer += $output->writeI32($this->objectTypePtr);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TMapTypeEntry {
  static $_TSPEC;

  /**
   * @var int
   */
  public $keyTypePtr = null;
  /**
   * @var int
   */
  public $valueTypePtr = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'keyTypePtr',
          'type' => TType::I32,
          ),
        2 => array(
          'var' => 'valueTypePtr',
          'type' => TType::I32,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['keyTypePtr'])) {
        $this->keyTypePtr = $vals['keyTypePtr'];
      }
      if (isset($vals['valueTypePtr'])) {
        $this->valueTypePtr = $vals['valueTypePtr'];
      }
    }
  }

  public function getName() {
    return 'TMapTypeEntry';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->keyTypePtr);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->valueTypePtr);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TMapTypeEntry');
    if ($this->keyTypePtr !== null) {
      $xfer += $output->writeFieldBegin('keyTypePtr', TType::I32, 1);
      $xfer += $output->writeI32($this->keyTypePtr);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->valueTypePtr !== null) {
      $xfer += $output->writeFieldBegin('valueTypePtr', TType::I32, 2);
      $xfer += $output->writeI32($this->valueTypePtr);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TStructTypeEntry {
  static $_TSPEC;

  /**
   * @var array
   */
  public $nameToTypePtr = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'nameToTypePtr',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::I32,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::I32,
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['nameToTypePtr'])) {
        $this->nameToTypePtr = $vals['nameToTypePtr'];
      }
    }
  }

  public function getName() {
    return 'TStructTypeEntry';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::MAP) {
            $this->nameToTypePtr = array();
            $_size9 = 0;
            $_ktype10 = 0;
            $_vtype11 = 0;
            $xfer += $input->readMapBegin($_ktype10, $_vtype11, $_size9);
            for ($_i13 = 0; $_i13 < $_size9; ++$_i13)
            {
              $key14 = '';
              $val15 = 0;
              $xfer += $input->readString($key14);
              $xfer += $input->readI32($val15);
              $this->nameToTypePtr[$key14] = $val15;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TStructTypeEntry');
    if ($this->nameToTypePtr !== null) {
      if (!is_array($this->nameToTypePtr)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('nameToTypePtr', TType::MAP, 1);
      {
        $output->writeMapBegin(TType::STRING, TType::I32, count($this->nameToTypePtr));
        {
          foreach ($this->nameToTypePtr as $kiter16 => $viter17)
          {
            $xfer += $output->writeString($kiter16);
            $xfer += $output->writeI32($viter17);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TUnionTypeEntry {
  static $_TSPEC;

  /**
   * @var array
   */
  public $nameToTypePtr = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'nameToTypePtr',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::I32,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::I32,
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['nameToTypePtr'])) {
        $this->nameToTypePtr = $vals['nameToTypePtr'];
      }
    }
  }

  public function getName() {
    return 'TUnionTypeEntry';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::MAP) {
            $this->nameToTypePtr = array();
            $_size18 = 0;
            $_ktype19 = 0;
            $_vtype20 = 0;
            $xfer += $input->readMapBegin($_ktype19, $_vtype20, $_size18);
            for ($_i22 = 0; $_i22 < $_size18; ++$_i22)
            {
              $key23 = '';
              $val24 = 0;
              $xfer += $input->readString($key23);
              $xfer += $input->readI32($val24);
              $this->nameToTypePtr[$key23] = $val24;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TUnionTypeEntry');
    if ($this->nameToTypePtr !== null) {
      if (!is_array($this->nameToTypePtr)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('nameToTypePtr', TType::MAP, 1);
      {
        $output->writeMapBegin(TType::STRING, TType::I32, count($this->nameToTypePtr));
        {
          foreach ($this->nameToTypePtr as $kiter25 => $viter26)
          {
            $xfer += $output->writeString($kiter25);
            $xfer += $output->writeI32($viter26);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TUserDefinedTypeEntry {
  static $_TSPEC;

  /**
   * @var string
   */
  public $typeClassName = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'typeClassName',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['typeClassName'])) {
        $this->typeClassName = $vals['typeClassName'];
      }
    }
  }

  public function getName() {
    return 'TUserDefinedTypeEntry';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->typeClassName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TUserDefinedTypeEntry');
    if ($this->typeClassName !== null) {
      $xfer += $output->writeFieldBegin('typeClassName', TType::STRING, 1);
      $xfer += $output->writeString($this->typeClassName);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TTypeEntry {
  static $_TSPEC;

  /**
   * @var \TPrimitiveTypeEntry
   */
  public $primitiveEntry = null;
  /**
   * @var \TArrayTypeEntry
   */
  public $arrayEntry = null;
  /**
   * @var \TMapTypeEntry
   */
  public $mapEntry = null;
  /**
   * @var \TStructTypeEntry
   */
  public $structEntry = null;
  /**
   * @var \TUnionTypeEntry
   */
  public $unionEntry = null;
  /**
   * @var \TUserDefinedTypeEntry
   */
  public $userDefinedTypeEntry = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'primitiveEntry',
          'type' => TType::STRUCT,
          'class' => '\TPrimitiveTypeEntry',
          ),
        2 => array(
          'var' => 'arrayEntry',
          'type' => TType::STRUCT,
          'class' => '\TArrayTypeEntry',
          ),
        3 => array(
          'var' => 'mapEntry',
          'type' => TType::STRUCT,
          'class' => '\TMapTypeEntry',
          ),
        4 => array(
          'var' => 'structEntry',
          'type' => TType::STRUCT,
          'class' => '\TStructTypeEntry',
          ),
        5 => array(
          'var' => 'unionEntry',
          'type' => TType::STRUCT,
          'class' => '\TUnionTypeEntry',
          ),
        6 => array(
          'var' => 'userDefinedTypeEntry',
          'type' => TType::STRUCT,
          'class' => '\TUserDefinedTypeEntry',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['primitiveEntry'])) {
        $this->primitiveEntry = $vals['primitiveEntry'];
      }
      if (isset($vals['arrayEntry'])) {
        $this->arrayEntry = $vals['arrayEntry'];
      }
      if (isset($vals['mapEntry'])) {
        $this->mapEntry = $vals['mapEntry'];
      }
      if (isset($vals['structEntry'])) {
        $this->structEntry = $vals['structEntry'];
      }
      if (isset($vals['unionEntry'])) {
        $this->unionEntry = $vals['unionEntry'];
      }
      if (isset($vals['userDefinedTypeEntry'])) {
        $this->userDefinedTypeEntry = $vals['userDefinedTypeEntry'];
      }
    }
  }

  public function getName() {
    return 'TTypeEntry';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->primitiveEntry = new \TPrimitiveTypeEntry();
            $xfer += $this->primitiveEntry->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->arrayEntry = new \TArrayTypeEntry();
            $xfer += $this->arrayEntry->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRUCT) {
            $this->mapEntry = new \TMapTypeEntry();
            $xfer += $this->mapEntry->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRUCT) {
            $this->structEntry = new \TStructTypeEntry();
            $xfer += $this->structEntry->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRUCT) {
            $this->unionEntry = new \TUnionTypeEntry();
            $xfer += $this->unionEntry->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRUCT) {
            $this->userDefinedTypeEntry = new \TUserDefinedTypeEntry();
            $xfer += $this->userDefinedTypeEntry->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TTypeEntry');
    if ($this->primitiveEntry !== null) {
      if (!is_object($this->primitiveEntry)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('primitiveEntry', TType::STRUCT, 1);
      $xfer += $this->primitiveEntry->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->arrayEntry !== null) {
      if (!is_object($this->arrayEntry)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('arrayEntry', TType::STRUCT, 2);
      $xfer += $this->arrayEntry->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->mapEntry !== null) {
      if (!is_object($this->mapEntry)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('mapEntry', TType::STRUCT, 3);
      $xfer += $this->mapEntry->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->structEntry !== null) {
      if (!is_object($this->structEntry)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('structEntry', TType::STRUCT, 4);
      $xfer += $this->structEntry->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->unionEntry !== null) {
      if (!is_object($this->unionEntry)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('unionEntry', TType::STRUCT, 5);
      $xfer += $this->unionEntry->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->userDefinedTypeEntry !== null) {
      if (!is_object($this->userDefinedTypeEntry)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('userDefinedTypeEntry', TType::STRUCT, 6);
      $xfer += $this->userDefinedTypeEntry->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TTypeDesc {
  static $_TSPEC;

  /**
   * @var \TTypeEntry[]
   */
  public $types = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'types',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\TTypeEntry',
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['types'])) {
        $this->types = $vals['types'];
      }
    }
  }

  public function getName() {
    return 'TTypeDesc';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->types = array();
            $_size27 = 0;
            $_etype30 = 0;
            $xfer += $input->readListBegin($_etype30, $_size27);
            for ($_i31 = 0; $_i31 < $_size27; ++$_i31)
            {
              $elem32 = null;
              $elem32 = new \TTypeEntry();
              $xfer += $elem32->read($input);
              $this->types []= $elem32;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TTypeDesc');
    if ($this->types !== null) {
      if (!is_array($this->types)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('types', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->types));
        {
          foreach ($this->types as $iter33)
          {
            $xfer += $iter33->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TColumnDesc {
  static $_TSPEC;

  /**
   * @var string
   */
  public $columnName = null;
  /**
   * @var \TTypeDesc
   */
  public $typeDesc = null;
  /**
   * @var int
   */
  public $position = null;
  /**
   * @var string
   */
  public $comment = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'columnName',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'typeDesc',
          'type' => TType::STRUCT,
          'class' => '\TTypeDesc',
          ),
        3 => array(
          'var' => 'position',
          'type' => TType::I32,
          ),
        4 => array(
          'var' => 'comment',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['columnName'])) {
        $this->columnName = $vals['columnName'];
      }
      if (isset($vals['typeDesc'])) {
        $this->typeDesc = $vals['typeDesc'];
      }
      if (isset($vals['position'])) {
        $this->position = $vals['position'];
      }
      if (isset($vals['comment'])) {
        $this->comment = $vals['comment'];
      }
    }
  }

  public function getName() {
    return 'TColumnDesc';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->columnName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->typeDesc = new \TTypeDesc();
            $xfer += $this->typeDesc->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->position);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->comment);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TColumnDesc');
    if ($this->columnName !== null) {
      $xfer += $output->writeFieldBegin('columnName', TType::STRING, 1);
      $xfer += $output->writeString($this->columnName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->typeDesc !== null) {
      if (!is_object($this->typeDesc)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('typeDesc', TType::STRUCT, 2);
      $xfer += $this->typeDesc->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->position !== null) {
      $xfer += $output->writeFieldBegin('position', TType::I32, 3);
      $xfer += $output->writeI32($this->position);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->comment !== null) {
      $xfer += $output->writeFieldBegin('comment', TType::STRING, 4);
      $xfer += $output->writeString($this->comment);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TTableSchema {
  static $_TSPEC;

  /**
   * @var \TColumnDesc[]
   */
  public $columns = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'columns',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\TColumnDesc',
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['columns'])) {
        $this->columns = $vals['columns'];
      }
    }
  }

  public function getName() {
    return 'TTableSchema';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->columns = array();
            $_size34 = 0;
            $_etype37 = 0;
            $xfer += $input->readListBegin($_etype37, $_size34);
            for ($_i38 = 0; $_i38 < $_size34; ++$_i38)
            {
              $elem39 = null;
              $elem39 = new \TColumnDesc();
              $xfer += $elem39->read($input);
              $this->columns []= $elem39;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TTableSchema');
    if ($this->columns !== null) {
      if (!is_array($this->columns)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('columns', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->columns));
        {
          foreach ($this->columns as $iter40)
          {
            $xfer += $iter40->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TBoolValue {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $value = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'value',
          'type' => TType::BOOL,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['value'])) {
        $this->value = $vals['value'];
      }
    }
  }

  public function getName() {
    return 'TBoolValue';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TBoolValue');
    if ($this->value !== null) {
      $xfer += $output->writeFieldBegin('value', TType::BOOL, 1);
      $xfer += $output->writeBool($this->value);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TByteValue {
  static $_TSPEC;

  /**
   * @var int
   */
  public $value = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'value',
          'type' => TType::BYTE,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['value'])) {
        $this->value = $vals['value'];
      }
    }
  }

  public function getName() {
    return 'TByteValue';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::BYTE) {
            $xfer += $input->readByte($this->value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TByteValue');
    if ($this->value !== null) {
      $xfer += $output->writeFieldBegin('value', TType::BYTE, 1);
      $xfer += $output->writeByte($this->value);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TI16Value {
  static $_TSPEC;

  /**
   * @var int
   */
  public $value = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'value',
          'type' => TType::I16,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['value'])) {
        $this->value = $vals['value'];
      }
    }
  }

  public function getName() {
    return 'TI16Value';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::I16) {
            $xfer += $input->readI16($this->value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TI16Value');
    if ($this->value !== null) {
      $xfer += $output->writeFieldBegin('value', TType::I16, 1);
      $xfer += $output->writeI16($this->value);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TI32Value {
  static $_TSPEC;

  /**
   * @var int
   */
  public $value = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'value',
          'type' => TType::I32,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['value'])) {
        $this->value = $vals['value'];
      }
    }
  }

  public function getName() {
    return 'TI32Value';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TI32Value');
    if ($this->value !== null) {
      $xfer += $output->writeFieldBegin('value', TType::I32, 1);
      $xfer += $output->writeI32($this->value);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TI64Value {
  static $_TSPEC;

  /**
   * @var int
   */
  public $value = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'value',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['value'])) {
        $this->value = $vals['value'];
      }
    }
  }

  public function getName() {
    return 'TI64Value';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TI64Value');
    if ($this->value !== null) {
      $xfer += $output->writeFieldBegin('value', TType::I64, 1);
      $xfer += $output->writeI64($this->value);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TDoubleValue {
  static $_TSPEC;

  /**
   * @var double
   */
  public $value = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'value',
          'type' => TType::DOUBLE,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['value'])) {
        $this->value = $vals['value'];
      }
    }
  }

  public function getName() {
    return 'TDoubleValue';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::DOUBLE) {
            $xfer += $input->readDouble($this->value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TDoubleValue');
    if ($this->value !== null) {
      $xfer += $output->writeFieldBegin('value', TType::DOUBLE, 1);
      $xfer += $output->writeDouble($this->value);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TStringValue {
  static $_TSPEC;

  /**
   * @var string
   */
  public $value = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'value',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['value'])) {
        $this->value = $vals['value'];
      }
    }
  }

  public function getName() {
    return 'TStringValue';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->value);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TStringValue');
    if ($this->value !== null) {
      $xfer += $output->writeFieldBegin('value', TType::STRING, 1);
      $xfer += $output->writeString($this->value);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TColumnValue {
  static $_TSPEC;

  /**
   * @var \TBoolValue
   */
  public $boolVal = null;
  /**
   * @var \TByteValue
   */
  public $byteVal = null;
  /**
   * @var \TI16Value
   */
  public $i16Val = null;
  /**
   * @var \TI32Value
   */
  public $i32Val = null;
  /**
   * @var \TI64Value
   */
  public $i64Val = null;
  /**
   * @var \TDoubleValue
   */
  public $doubleVal = null;
  /**
   * @var \TStringValue
   */
  public $stringVal = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'boolVal',
          'type' => TType::STRUCT,
          'class' => '\TBoolValue',
          ),
        2 => array(
          'var' => 'byteVal',
          'type' => TType::STRUCT,
          'class' => '\TByteValue',
          ),
        3 => array(
          'var' => 'i16Val',
          'type' => TType::STRUCT,
          'class' => '\TI16Value',
          ),
        4 => array(
          'var' => 'i32Val',
          'type' => TType::STRUCT,
          'class' => '\TI32Value',
          ),
        5 => array(
          'var' => 'i64Val',
          'type' => TType::STRUCT,
          'class' => '\TI64Value',
          ),
        6 => array(
          'var' => 'doubleVal',
          'type' => TType::STRUCT,
          'class' => '\TDoubleValue',
          ),
        7 => array(
          'var' => 'stringVal',
          'type' => TType::STRUCT,
          'class' => '\TStringValue',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['boolVal'])) {
        $this->boolVal = $vals['boolVal'];
      }
      if (isset($vals['byteVal'])) {
        $this->byteVal = $vals['byteVal'];
      }
      if (isset($vals['i16Val'])) {
        $this->i16Val = $vals['i16Val'];
      }
      if (isset($vals['i32Val'])) {
        $this->i32Val = $vals['i32Val'];
      }
      if (isset($vals['i64Val'])) {
        $this->i64Val = $vals['i64Val'];
      }
      if (isset($vals['doubleVal'])) {
        $this->doubleVal = $vals['doubleVal'];
      }
      if (isset($vals['stringVal'])) {
        $this->stringVal = $vals['stringVal'];
      }
    }
  }

  public function getName() {
    return 'TColumnValue';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->boolVal = new \TBoolValue();
            $xfer += $this->boolVal->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->byteVal = new \TByteValue();
            $xfer += $this->byteVal->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRUCT) {
            $this->i16Val = new \TI16Value();
            $xfer += $this->i16Val->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRUCT) {
            $this->i32Val = new \TI32Value();
            $xfer += $this->i32Val->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRUCT) {
            $this->i64Val = new \TI64Value();
            $xfer += $this->i64Val->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRUCT) {
            $this->doubleVal = new \TDoubleValue();
            $xfer += $this->doubleVal->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRUCT) {
            $this->stringVal = new \TStringValue();
            $xfer += $this->stringVal->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TColumnValue');
    if ($this->boolVal !== null) {
      if (!is_object($this->boolVal)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('boolVal', TType::STRUCT, 1);
      $xfer += $this->boolVal->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->byteVal !== null) {
      if (!is_object($this->byteVal)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('byteVal', TType::STRUCT, 2);
      $xfer += $this->byteVal->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->i16Val !== null) {
      if (!is_object($this->i16Val)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('i16Val', TType::STRUCT, 3);
      $xfer += $this->i16Val->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->i32Val !== null) {
      if (!is_object($this->i32Val)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('i32Val', TType::STRUCT, 4);
      $xfer += $this->i32Val->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->i64Val !== null) {
      if (!is_object($this->i64Val)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('i64Val', TType::STRUCT, 5);
      $xfer += $this->i64Val->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->doubleVal !== null) {
      if (!is_object($this->doubleVal)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('doubleVal', TType::STRUCT, 6);
      $xfer += $this->doubleVal->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->stringVal !== null) {
      if (!is_object($this->stringVal)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('stringVal', TType::STRUCT, 7);
      $xfer += $this->stringVal->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TRow {
  static $_TSPEC;

  /**
   * @var \TColumnValue[]
   */
  public $colVals = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'colVals',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\TColumnValue',
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['colVals'])) {
        $this->colVals = $vals['colVals'];
      }
    }
  }

  public function getName() {
    return 'TRow';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->colVals = array();
            $_size41 = 0;
            $_etype44 = 0;
            $xfer += $input->readListBegin($_etype44, $_size41);
            for ($_i45 = 0; $_i45 < $_size41; ++$_i45)
            {
              $elem46 = null;
              $elem46 = new \TColumnValue();
              $xfer += $elem46->read($input);
              $this->colVals []= $elem46;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TRow');
    if ($this->colVals !== null) {
      if (!is_array($this->colVals)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('colVals', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->colVals));
        {
          foreach ($this->colVals as $iter47)
          {
            $xfer += $iter47->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TBoolColumn {
  static $_TSPEC;

  /**
   * @var bool[]
   */
  public $values = null;
  /**
   * @var string
   */
  public $nulls = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'values',
          'type' => TType::LST,
          'etype' => TType::BOOL,
          'elem' => array(
            'type' => TType::BOOL,
            ),
          ),
        2 => array(
          'var' => 'nulls',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['values'])) {
        $this->values = $vals['values'];
      }
      if (isset($vals['nulls'])) {
        $this->nulls = $vals['nulls'];
      }
    }
  }

  public function getName() {
    return 'TBoolColumn';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->values = array();
            $_size48 = 0;
            $_etype51 = 0;
            $xfer += $input->readListBegin($_etype51, $_size48);
            for ($_i52 = 0; $_i52 < $_size48; ++$_i52)
            {
              $elem53 = null;
              $xfer += $input->readBool($elem53);
              $this->values []= $elem53;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->nulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TBoolColumn');
    if ($this->values !== null) {
      if (!is_array($this->values)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('values', TType::LST, 1);
      {
        $output->writeListBegin(TType::BOOL, count($this->values));
        {
          foreach ($this->values as $iter54)
          {
            $xfer += $output->writeBool($iter54);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->nulls !== null) {
      $xfer += $output->writeFieldBegin('nulls', TType::STRING, 2);
      $xfer += $output->writeString($this->nulls);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TByteColumn {
  static $_TSPEC;

  /**
   * @var int[]
   */
  public $values = null;
  /**
   * @var string
   */
  public $nulls = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'values',
          'type' => TType::LST,
          'etype' => TType::BYTE,
          'elem' => array(
            'type' => TType::BYTE,
            ),
          ),
        2 => array(
          'var' => 'nulls',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['values'])) {
        $this->values = $vals['values'];
      }
      if (isset($vals['nulls'])) {
        $this->nulls = $vals['nulls'];
      }
    }
  }

  public function getName() {
    return 'TByteColumn';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->values = array();
            $_size55 = 0;
            $_etype58 = 0;
            $xfer += $input->readListBegin($_etype58, $_size55);
            for ($_i59 = 0; $_i59 < $_size55; ++$_i59)
            {
              $elem60 = null;
              $xfer += $input->readByte($elem60);
              $this->values []= $elem60;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->nulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TByteColumn');
    if ($this->values !== null) {
      if (!is_array($this->values)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('values', TType::LST, 1);
      {
        $output->writeListBegin(TType::BYTE, count($this->values));
        {
          foreach ($this->values as $iter61)
          {
            $xfer += $output->writeByte($iter61);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->nulls !== null) {
      $xfer += $output->writeFieldBegin('nulls', TType::STRING, 2);
      $xfer += $output->writeString($this->nulls);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TI16Column {
  static $_TSPEC;

  /**
   * @var int[]
   */
  public $values = null;
  /**
   * @var string
   */
  public $nulls = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'values',
          'type' => TType::LST,
          'etype' => TType::I16,
          'elem' => array(
            'type' => TType::I16,
            ),
          ),
        2 => array(
          'var' => 'nulls',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['values'])) {
        $this->values = $vals['values'];
      }
      if (isset($vals['nulls'])) {
        $this->nulls = $vals['nulls'];
      }
    }
  }

  public function getName() {
    return 'TI16Column';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->values = array();
            $_size62 = 0;
            $_etype65 = 0;
            $xfer += $input->readListBegin($_etype65, $_size62);
            for ($_i66 = 0; $_i66 < $_size62; ++$_i66)
            {
              $elem67 = null;
              $xfer += $input->readI16($elem67);
              $this->values []= $elem67;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->nulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TI16Column');
    if ($this->values !== null) {
      if (!is_array($this->values)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('values', TType::LST, 1);
      {
        $output->writeListBegin(TType::I16, count($this->values));
        {
          foreach ($this->values as $iter68)
          {
            $xfer += $output->writeI16($iter68);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->nulls !== null) {
      $xfer += $output->writeFieldBegin('nulls', TType::STRING, 2);
      $xfer += $output->writeString($this->nulls);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TI32Column {
  static $_TSPEC;

  /**
   * @var int[]
   */
  public $values = null;
  /**
   * @var string
   */
  public $nulls = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'values',
          'type' => TType::LST,
          'etype' => TType::I32,
          'elem' => array(
            'type' => TType::I32,
            ),
          ),
        2 => array(
          'var' => 'nulls',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['values'])) {
        $this->values = $vals['values'];
      }
      if (isset($vals['nulls'])) {
        $this->nulls = $vals['nulls'];
      }
    }
  }

  public function getName() {
    return 'TI32Column';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->values = array();
            $_size69 = 0;
            $_etype72 = 0;
            $xfer += $input->readListBegin($_etype72, $_size69);
            for ($_i73 = 0; $_i73 < $_size69; ++$_i73)
            {
              $elem74 = null;
              $xfer += $input->readI32($elem74);
              $this->values []= $elem74;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->nulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TI32Column');
    if ($this->values !== null) {
      if (!is_array($this->values)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('values', TType::LST, 1);
      {
        $output->writeListBegin(TType::I32, count($this->values));
        {
          foreach ($this->values as $iter75)
          {
            $xfer += $output->writeI32($iter75);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->nulls !== null) {
      $xfer += $output->writeFieldBegin('nulls', TType::STRING, 2);
      $xfer += $output->writeString($this->nulls);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TI64Column {
  static $_TSPEC;

  /**
   * @var int[]
   */
  public $values = null;
  /**
   * @var string
   */
  public $nulls = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'values',
          'type' => TType::LST,
          'etype' => TType::I64,
          'elem' => array(
            'type' => TType::I64,
            ),
          ),
        2 => array(
          'var' => 'nulls',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['values'])) {
        $this->values = $vals['values'];
      }
      if (isset($vals['nulls'])) {
        $this->nulls = $vals['nulls'];
      }
    }
  }

  public function getName() {
    return 'TI64Column';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->values = array();
            $_size76 = 0;
            $_etype79 = 0;
            $xfer += $input->readListBegin($_etype79, $_size76);
            for ($_i80 = 0; $_i80 < $_size76; ++$_i80)
            {
              $elem81 = null;
              $xfer += $input->readI64($elem81);
              $this->values []= $elem81;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->nulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TI64Column');
    if ($this->values !== null) {
      if (!is_array($this->values)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('values', TType::LST, 1);
      {
        $output->writeListBegin(TType::I64, count($this->values));
        {
          foreach ($this->values as $iter82)
          {
            $xfer += $output->writeI64($iter82);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->nulls !== null) {
      $xfer += $output->writeFieldBegin('nulls', TType::STRING, 2);
      $xfer += $output->writeString($this->nulls);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TDoubleColumn {
  static $_TSPEC;

  /**
   * @var double[]
   */
  public $values = null;
  /**
   * @var string
   */
  public $nulls = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'values',
          'type' => TType::LST,
          'etype' => TType::DOUBLE,
          'elem' => array(
            'type' => TType::DOUBLE,
            ),
          ),
        2 => array(
          'var' => 'nulls',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['values'])) {
        $this->values = $vals['values'];
      }
      if (isset($vals['nulls'])) {
        $this->nulls = $vals['nulls'];
      }
    }
  }

  public function getName() {
    return 'TDoubleColumn';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->values = array();
            $_size83 = 0;
            $_etype86 = 0;
            $xfer += $input->readListBegin($_etype86, $_size83);
            for ($_i87 = 0; $_i87 < $_size83; ++$_i87)
            {
              $elem88 = null;
              $xfer += $input->readDouble($elem88);
              $this->values []= $elem88;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->nulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TDoubleColumn');
    if ($this->values !== null) {
      if (!is_array($this->values)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('values', TType::LST, 1);
      {
        $output->writeListBegin(TType::DOUBLE, count($this->values));
        {
          foreach ($this->values as $iter89)
          {
            $xfer += $output->writeDouble($iter89);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->nulls !== null) {
      $xfer += $output->writeFieldBegin('nulls', TType::STRING, 2);
      $xfer += $output->writeString($this->nulls);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TStringColumn {
  static $_TSPEC;

  /**
   * @var string[]
   */
  public $values = null;
  /**
   * @var string
   */
  public $nulls = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'values',
          'type' => TType::LST,
          'etype' => TType::STRING,
          'elem' => array(
            'type' => TType::STRING,
            ),
          ),
        2 => array(
          'var' => 'nulls',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['values'])) {
        $this->values = $vals['values'];
      }
      if (isset($vals['nulls'])) {
        $this->nulls = $vals['nulls'];
      }
    }
  }

  public function getName() {
    return 'TStringColumn';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->values = array();
            $_size90 = 0;
            $_etype93 = 0;
            $xfer += $input->readListBegin($_etype93, $_size90);
            for ($_i94 = 0; $_i94 < $_size90; ++$_i94)
            {
              $elem95 = null;
              $xfer += $input->readString($elem95);
              $this->values []= $elem95;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->nulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TStringColumn');
    if ($this->values !== null) {
      if (!is_array($this->values)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('values', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRING, count($this->values));
        {
          foreach ($this->values as $iter96)
          {
            $xfer += $output->writeString($iter96);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->nulls !== null) {
      $xfer += $output->writeFieldBegin('nulls', TType::STRING, 2);
      $xfer += $output->writeString($this->nulls);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TBinaryColumn {
  static $_TSPEC;

  /**
   * @var string[]
   */
  public $values = null;
  /**
   * @var string
   */
  public $nulls = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'values',
          'type' => TType::LST,
          'etype' => TType::STRING,
          'elem' => array(
            'type' => TType::STRING,
            ),
          ),
        2 => array(
          'var' => 'nulls',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['values'])) {
        $this->values = $vals['values'];
      }
      if (isset($vals['nulls'])) {
        $this->nulls = $vals['nulls'];
      }
    }
  }

  public function getName() {
    return 'TBinaryColumn';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->values = array();
            $_size97 = 0;
            $_etype100 = 0;
            $xfer += $input->readListBegin($_etype100, $_size97);
            for ($_i101 = 0; $_i101 < $_size97; ++$_i101)
            {
              $elem102 = null;
              $xfer += $input->readString($elem102);
              $this->values []= $elem102;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->nulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TBinaryColumn');
    if ($this->values !== null) {
      if (!is_array($this->values)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('values', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRING, count($this->values));
        {
          foreach ($this->values as $iter103)
          {
            $xfer += $output->writeString($iter103);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->nulls !== null) {
      $xfer += $output->writeFieldBegin('nulls', TType::STRING, 2);
      $xfer += $output->writeString($this->nulls);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TColumn {
  static $_TSPEC;

  /**
   * @var \TBoolColumn
   */
  public $boolVal = null;
  /**
   * @var \TByteColumn
   */
  public $byteVal = null;
  /**
   * @var \TI16Column
   */
  public $i16Val = null;
  /**
   * @var \TI32Column
   */
  public $i32Val = null;
  /**
   * @var \TI64Column
   */
  public $i64Val = null;
  /**
   * @var \TDoubleColumn
   */
  public $doubleVal = null;
  /**
   * @var \TStringColumn
   */
  public $stringVal = null;
  /**
   * @var \TBinaryColumn
   */
  public $binaryVal = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'boolVal',
          'type' => TType::STRUCT,
          'class' => '\TBoolColumn',
          ),
        2 => array(
          'var' => 'byteVal',
          'type' => TType::STRUCT,
          'class' => '\TByteColumn',
          ),
        3 => array(
          'var' => 'i16Val',
          'type' => TType::STRUCT,
          'class' => '\TI16Column',
          ),
        4 => array(
          'var' => 'i32Val',
          'type' => TType::STRUCT,
          'class' => '\TI32Column',
          ),
        5 => array(
          'var' => 'i64Val',
          'type' => TType::STRUCT,
          'class' => '\TI64Column',
          ),
        6 => array(
          'var' => 'doubleVal',
          'type' => TType::STRUCT,
          'class' => '\TDoubleColumn',
          ),
        7 => array(
          'var' => 'stringVal',
          'type' => TType::STRUCT,
          'class' => '\TStringColumn',
          ),
        8 => array(
          'var' => 'binaryVal',
          'type' => TType::STRUCT,
          'class' => '\TBinaryColumn',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['boolVal'])) {
        $this->boolVal = $vals['boolVal'];
      }
      if (isset($vals['byteVal'])) {
        $this->byteVal = $vals['byteVal'];
      }
      if (isset($vals['i16Val'])) {
        $this->i16Val = $vals['i16Val'];
      }
      if (isset($vals['i32Val'])) {
        $this->i32Val = $vals['i32Val'];
      }
      if (isset($vals['i64Val'])) {
        $this->i64Val = $vals['i64Val'];
      }
      if (isset($vals['doubleVal'])) {
        $this->doubleVal = $vals['doubleVal'];
      }
      if (isset($vals['stringVal'])) {
        $this->stringVal = $vals['stringVal'];
      }
      if (isset($vals['binaryVal'])) {
        $this->binaryVal = $vals['binaryVal'];
      }
    }
  }

  public function getName() {
    return 'TColumn';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->boolVal = new \TBoolColumn();
            $xfer += $this->boolVal->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->byteVal = new \TByteColumn();
            $xfer += $this->byteVal->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRUCT) {
            $this->i16Val = new \TI16Column();
            $xfer += $this->i16Val->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRUCT) {
            $this->i32Val = new \TI32Column();
            $xfer += $this->i32Val->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRUCT) {
            $this->i64Val = new \TI64Column();
            $xfer += $this->i64Val->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRUCT) {
            $this->doubleVal = new \TDoubleColumn();
            $xfer += $this->doubleVal->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRUCT) {
            $this->stringVal = new \TStringColumn();
            $xfer += $this->stringVal->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::STRUCT) {
            $this->binaryVal = new \TBinaryColumn();
            $xfer += $this->binaryVal->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TColumn');
    if ($this->boolVal !== null) {
      if (!is_object($this->boolVal)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('boolVal', TType::STRUCT, 1);
      $xfer += $this->boolVal->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->byteVal !== null) {
      if (!is_object($this->byteVal)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('byteVal', TType::STRUCT, 2);
      $xfer += $this->byteVal->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->i16Val !== null) {
      if (!is_object($this->i16Val)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('i16Val', TType::STRUCT, 3);
      $xfer += $this->i16Val->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->i32Val !== null) {
      if (!is_object($this->i32Val)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('i32Val', TType::STRUCT, 4);
      $xfer += $this->i32Val->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->i64Val !== null) {
      if (!is_object($this->i64Val)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('i64Val', TType::STRUCT, 5);
      $xfer += $this->i64Val->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->doubleVal !== null) {
      if (!is_object($this->doubleVal)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('doubleVal', TType::STRUCT, 6);
      $xfer += $this->doubleVal->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->stringVal !== null) {
      if (!is_object($this->stringVal)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('stringVal', TType::STRUCT, 7);
      $xfer += $this->stringVal->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->binaryVal !== null) {
      if (!is_object($this->binaryVal)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('binaryVal', TType::STRUCT, 8);
      $xfer += $this->binaryVal->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TRowSet {
  static $_TSPEC;

  /**
   * @var int
   */
  public $startRowOffset = null;
  /**
   * @var \TRow[]
   */
  public $rows = null;
  /**
   * @var \TColumn[]
   */
  public $columns = null;
  /**
   * @var string
   */
  public $binaryColumns = null;
  /**
   * @var int
   */
  public $columnCount = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'startRowOffset',
          'type' => TType::I64,
          ),
        2 => array(
          'var' => 'rows',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\TRow',
            ),
          ),
        3 => array(
          'var' => 'columns',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\TColumn',
            ),
          ),
        4 => array(
          'var' => 'binaryColumns',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'columnCount',
          'type' => TType::I32,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['startRowOffset'])) {
        $this->startRowOffset = $vals['startRowOffset'];
      }
      if (isset($vals['rows'])) {
        $this->rows = $vals['rows'];
      }
      if (isset($vals['columns'])) {
        $this->columns = $vals['columns'];
      }
      if (isset($vals['binaryColumns'])) {
        $this->binaryColumns = $vals['binaryColumns'];
      }
      if (isset($vals['columnCount'])) {
        $this->columnCount = $vals['columnCount'];
      }
    }
  }

  public function getName() {
    return 'TRowSet';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->startRowOffset);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::LST) {
            $this->rows = array();
            $_size104 = 0;
            $_etype107 = 0;
            $xfer += $input->readListBegin($_etype107, $_size104);
            for ($_i108 = 0; $_i108 < $_size104; ++$_i108)
            {
              $elem109 = null;
              $elem109 = new \TRow();
              $xfer += $elem109->read($input);
              $this->rows []= $elem109;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::LST) {
            $this->columns = array();
            $_size110 = 0;
            $_etype113 = 0;
            $xfer += $input->readListBegin($_etype113, $_size110);
            for ($_i114 = 0; $_i114 < $_size110; ++$_i114)
            {
              $elem115 = null;
              $elem115 = new \TColumn();
              $xfer += $elem115->read($input);
              $this->columns []= $elem115;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->binaryColumns);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->columnCount);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TRowSet');
    if ($this->startRowOffset !== null) {
      $xfer += $output->writeFieldBegin('startRowOffset', TType::I64, 1);
      $xfer += $output->writeI64($this->startRowOffset);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->rows !== null) {
      if (!is_array($this->rows)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('rows', TType::LST, 2);
      {
        $output->writeListBegin(TType::STRUCT, count($this->rows));
        {
          foreach ($this->rows as $iter116)
          {
            $xfer += $iter116->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->columns !== null) {
      if (!is_array($this->columns)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('columns', TType::LST, 3);
      {
        $output->writeListBegin(TType::STRUCT, count($this->columns));
        {
          foreach ($this->columns as $iter117)
          {
            $xfer += $iter117->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->binaryColumns !== null) {
      $xfer += $output->writeFieldBegin('binaryColumns', TType::STRING, 4);
      $xfer += $output->writeString($this->binaryColumns);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->columnCount !== null) {
      $xfer += $output->writeFieldBegin('columnCount', TType::I32, 5);
      $xfer += $output->writeI32($this->columnCount);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TStatus {
  static $_TSPEC;

  /**
   * @var int
   */
  public $statusCode = null;
  /**
   * @var string[]
   */
  public $infoMessages = null;
  /**
   * @var string
   */
  public $sqlState = null;
  /**
   * @var int
   */
  public $errorCode = null;
  /**
   * @var string
   */
  public $errorMessage = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'statusCode',
          'type' => TType::I32,
          ),
        2 => array(
          'var' => 'infoMessages',
          'type' => TType::LST,
          'etype' => TType::STRING,
          'elem' => array(
            'type' => TType::STRING,
            ),
          ),
        3 => array(
          'var' => 'sqlState',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'errorCode',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'errorMessage',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['statusCode'])) {
        $this->statusCode = $vals['statusCode'];
      }
      if (isset($vals['infoMessages'])) {
        $this->infoMessages = $vals['infoMessages'];
      }
      if (isset($vals['sqlState'])) {
        $this->sqlState = $vals['sqlState'];
      }
      if (isset($vals['errorCode'])) {
        $this->errorCode = $vals['errorCode'];
      }
      if (isset($vals['errorMessage'])) {
        $this->errorMessage = $vals['errorMessage'];
      }
    }
  }

  public function getName() {
    return 'TStatus';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->statusCode);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::LST) {
            $this->infoMessages = array();
            $_size118 = 0;
            $_etype121 = 0;
            $xfer += $input->readListBegin($_etype121, $_size118);
            for ($_i122 = 0; $_i122 < $_size118; ++$_i122)
            {
              $elem123 = null;
              $xfer += $input->readString($elem123);
              $this->infoMessages []= $elem123;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->sqlState);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->errorCode);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->errorMessage);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TStatus');
    if ($this->statusCode !== null) {
      $xfer += $output->writeFieldBegin('statusCode', TType::I32, 1);
      $xfer += $output->writeI32($this->statusCode);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->infoMessages !== null) {
      if (!is_array($this->infoMessages)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('infoMessages', TType::LST, 2);
      {
        $output->writeListBegin(TType::STRING, count($this->infoMessages));
        {
          foreach ($this->infoMessages as $iter124)
          {
            $xfer += $output->writeString($iter124);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sqlState !== null) {
      $xfer += $output->writeFieldBegin('sqlState', TType::STRING, 3);
      $xfer += $output->writeString($this->sqlState);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->errorCode !== null) {
      $xfer += $output->writeFieldBegin('errorCode', TType::I32, 4);
      $xfer += $output->writeI32($this->errorCode);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->errorMessage !== null) {
      $xfer += $output->writeFieldBegin('errorMessage', TType::STRING, 5);
      $xfer += $output->writeString($this->errorMessage);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class THandleIdentifier {
  static $_TSPEC;

  /**
   * @var string
   */
  public $guid = null;
  /**
   * @var string
   */
  public $secret = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'guid',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'secret',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['guid'])) {
        $this->guid = $vals['guid'];
      }
      if (isset($vals['secret'])) {
        $this->secret = $vals['secret'];
      }
    }
  }

  public function getName() {
    return 'THandleIdentifier';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->guid);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->secret);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('THandleIdentifier');
    if ($this->guid !== null) {
      $xfer += $output->writeFieldBegin('guid', TType::STRING, 1);
      $xfer += $output->writeString($this->guid);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->secret !== null) {
      $xfer += $output->writeFieldBegin('secret', TType::STRING, 2);
      $xfer += $output->writeString($this->secret);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TSessionHandle {
  static $_TSPEC;

  /**
   * @var \THandleIdentifier
   */
  public $sessionId = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionId',
          'type' => TType::STRUCT,
          'class' => '\THandleIdentifier',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionId'])) {
        $this->sessionId = $vals['sessionId'];
      }
    }
  }

  public function getName() {
    return 'TSessionHandle';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionId = new \THandleIdentifier();
            $xfer += $this->sessionId->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TSessionHandle');
    if ($this->sessionId !== null) {
      if (!is_object($this->sessionId)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionId', TType::STRUCT, 1);
      $xfer += $this->sessionId->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TOperationHandle {
  static $_TSPEC;

  /**
   * @var \THandleIdentifier
   */
  public $operationId = null;
  /**
   * @var int
   */
  public $operationType = null;
  /**
   * @var bool
   */
  public $hasResultSet = null;
  /**
   * @var double
   */
  public $modifiedRowCount = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'operationId',
          'type' => TType::STRUCT,
          'class' => '\THandleIdentifier',
          ),
        2 => array(
          'var' => 'operationType',
          'type' => TType::I32,
          ),
        3 => array(
          'var' => 'hasResultSet',
          'type' => TType::BOOL,
          ),
        4 => array(
          'var' => 'modifiedRowCount',
          'type' => TType::DOUBLE,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['operationId'])) {
        $this->operationId = $vals['operationId'];
      }
      if (isset($vals['operationType'])) {
        $this->operationType = $vals['operationType'];
      }
      if (isset($vals['hasResultSet'])) {
        $this->hasResultSet = $vals['hasResultSet'];
      }
      if (isset($vals['modifiedRowCount'])) {
        $this->modifiedRowCount = $vals['modifiedRowCount'];
      }
    }
  }

  public function getName() {
    return 'TOperationHandle';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->operationId = new \THandleIdentifier();
            $xfer += $this->operationId->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->operationType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->hasResultSet);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::DOUBLE) {
            $xfer += $input->readDouble($this->modifiedRowCount);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TOperationHandle');
    if ($this->operationId !== null) {
      if (!is_object($this->operationId)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationId', TType::STRUCT, 1);
      $xfer += $this->operationId->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationType !== null) {
      $xfer += $output->writeFieldBegin('operationType', TType::I32, 2);
      $xfer += $output->writeI32($this->operationType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->hasResultSet !== null) {
      $xfer += $output->writeFieldBegin('hasResultSet', TType::BOOL, 3);
      $xfer += $output->writeBool($this->hasResultSet);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->modifiedRowCount !== null) {
      $xfer += $output->writeFieldBegin('modifiedRowCount', TType::DOUBLE, 4);
      $xfer += $output->writeDouble($this->modifiedRowCount);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TOpenSessionReq {
  static $_TSPEC;

  /**
   * @var int
   */
  public $client_protocol =   9;
  /**
   * @var string
   */
  public $username = null;
  /**
   * @var string
   */
  public $password = null;
  /**
   * @var array
   */
  public $configuration = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'client_protocol',
          'type' => TType::I32,
          ),
        2 => array(
          'var' => 'username',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'password',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'configuration',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::STRING,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::STRING,
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['client_protocol'])) {
        $this->client_protocol = $vals['client_protocol'];
      }
      if (isset($vals['username'])) {
        $this->username = $vals['username'];
      }
      if (isset($vals['password'])) {
        $this->password = $vals['password'];
      }
      if (isset($vals['configuration'])) {
        $this->configuration = $vals['configuration'];
      }
    }
  }

  public function getName() {
    return 'TOpenSessionReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->client_protocol);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->username);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->password);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::MAP) {
            $this->configuration = array();
            $_size125 = 0;
            $_ktype126 = 0;
            $_vtype127 = 0;
            $xfer += $input->readMapBegin($_ktype126, $_vtype127, $_size125);
            for ($_i129 = 0; $_i129 < $_size125; ++$_i129)
            {
              $key130 = '';
              $val131 = '';
              $xfer += $input->readString($key130);
              $xfer += $input->readString($val131);
              $this->configuration[$key130] = $val131;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TOpenSessionReq');
    if ($this->client_protocol !== null) {
      $xfer += $output->writeFieldBegin('client_protocol', TType::I32, 1);
      $xfer += $output->writeI32($this->client_protocol);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->username !== null) {
      $xfer += $output->writeFieldBegin('username', TType::STRING, 2);
      $xfer += $output->writeString($this->username);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->password !== null) {
      $xfer += $output->writeFieldBegin('password', TType::STRING, 3);
      $xfer += $output->writeString($this->password);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->configuration !== null) {
      if (!is_array($this->configuration)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('configuration', TType::MAP, 4);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->configuration));
        {
          foreach ($this->configuration as $kiter132 => $viter133)
          {
            $xfer += $output->writeString($kiter132);
            $xfer += $output->writeString($viter133);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TOpenSessionResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var int
   */
  public $serverProtocolVersion =   9;
  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var array
   */
  public $configuration = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'serverProtocolVersion',
          'type' => TType::I32,
          ),
        3 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        4 => array(
          'var' => 'configuration',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::STRING,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::STRING,
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['serverProtocolVersion'])) {
        $this->serverProtocolVersion = $vals['serverProtocolVersion'];
      }
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['configuration'])) {
        $this->configuration = $vals['configuration'];
      }
    }
  }

  public function getName() {
    return 'TOpenSessionResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->serverProtocolVersion);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::MAP) {
            $this->configuration = array();
            $_size134 = 0;
            $_ktype135 = 0;
            $_vtype136 = 0;
            $xfer += $input->readMapBegin($_ktype135, $_vtype136, $_size134);
            for ($_i138 = 0; $_i138 < $_size134; ++$_i138)
            {
              $key139 = '';
              $val140 = '';
              $xfer += $input->readString($key139);
              $xfer += $input->readString($val140);
              $this->configuration[$key139] = $val140;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TOpenSessionResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->serverProtocolVersion !== null) {
      $xfer += $output->writeFieldBegin('serverProtocolVersion', TType::I32, 2);
      $xfer += $output->writeI32($this->serverProtocolVersion);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 3);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->configuration !== null) {
      if (!is_array($this->configuration)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('configuration', TType::MAP, 4);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->configuration));
        {
          foreach ($this->configuration as $kiter141 => $viter142)
          {
            $xfer += $output->writeString($kiter141);
            $xfer += $output->writeString($viter142);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TCloseSessionReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
    }
  }

  public function getName() {
    return 'TCloseSessionReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TCloseSessionReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TCloseSessionResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
    }
  }

  public function getName() {
    return 'TCloseSessionResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TCloseSessionResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetInfoValue {
  static $_TSPEC;

  /**
   * @var string
   */
  public $stringValue = null;
  /**
   * @var int
   */
  public $smallIntValue = null;
  /**
   * @var int
   */
  public $integerBitmask = null;
  /**
   * @var int
   */
  public $integerFlag = null;
  /**
   * @var int
   */
  public $binaryValue = null;
  /**
   * @var int
   */
  public $lenValue = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'stringValue',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'smallIntValue',
          'type' => TType::I16,
          ),
        3 => array(
          'var' => 'integerBitmask',
          'type' => TType::I32,
          ),
        4 => array(
          'var' => 'integerFlag',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'binaryValue',
          'type' => TType::I32,
          ),
        6 => array(
          'var' => 'lenValue',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['stringValue'])) {
        $this->stringValue = $vals['stringValue'];
      }
      if (isset($vals['smallIntValue'])) {
        $this->smallIntValue = $vals['smallIntValue'];
      }
      if (isset($vals['integerBitmask'])) {
        $this->integerBitmask = $vals['integerBitmask'];
      }
      if (isset($vals['integerFlag'])) {
        $this->integerFlag = $vals['integerFlag'];
      }
      if (isset($vals['binaryValue'])) {
        $this->binaryValue = $vals['binaryValue'];
      }
      if (isset($vals['lenValue'])) {
        $this->lenValue = $vals['lenValue'];
      }
    }
  }

  public function getName() {
    return 'TGetInfoValue';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->stringValue);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I16) {
            $xfer += $input->readI16($this->smallIntValue);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->integerBitmask);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->integerFlag);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->binaryValue);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->lenValue);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetInfoValue');
    if ($this->stringValue !== null) {
      $xfer += $output->writeFieldBegin('stringValue', TType::STRING, 1);
      $xfer += $output->writeString($this->stringValue);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->smallIntValue !== null) {
      $xfer += $output->writeFieldBegin('smallIntValue', TType::I16, 2);
      $xfer += $output->writeI16($this->smallIntValue);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->integerBitmask !== null) {
      $xfer += $output->writeFieldBegin('integerBitmask', TType::I32, 3);
      $xfer += $output->writeI32($this->integerBitmask);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->integerFlag !== null) {
      $xfer += $output->writeFieldBegin('integerFlag', TType::I32, 4);
      $xfer += $output->writeI32($this->integerFlag);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->binaryValue !== null) {
      $xfer += $output->writeFieldBegin('binaryValue', TType::I32, 5);
      $xfer += $output->writeI32($this->binaryValue);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->lenValue !== null) {
      $xfer += $output->writeFieldBegin('lenValue', TType::I64, 6);
      $xfer += $output->writeI64($this->lenValue);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetInfoReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var int
   */
  public $infoType = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        2 => array(
          'var' => 'infoType',
          'type' => TType::I32,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['infoType'])) {
        $this->infoType = $vals['infoType'];
      }
    }
  }

  public function getName() {
    return 'TGetInfoReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->infoType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetInfoReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->infoType !== null) {
      $xfer += $output->writeFieldBegin('infoType', TType::I32, 2);
      $xfer += $output->writeI32($this->infoType);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetInfoResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TGetInfoValue
   */
  public $infoValue = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'infoValue',
          'type' => TType::STRUCT,
          'class' => '\TGetInfoValue',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['infoValue'])) {
        $this->infoValue = $vals['infoValue'];
      }
    }
  }

  public function getName() {
    return 'TGetInfoResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->infoValue = new \TGetInfoValue();
            $xfer += $this->infoValue->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetInfoResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->infoValue !== null) {
      if (!is_object($this->infoValue)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('infoValue', TType::STRUCT, 2);
      $xfer += $this->infoValue->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TExecuteStatementReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var string
   */
  public $statement = null;
  /**
   * @var array
   */
  public $confOverlay = null;
  /**
   * @var bool
   */
  public $runAsync = false;
  /**
   * @var int
   */
  public $queryTimeout = 0;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        2 => array(
          'var' => 'statement',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'confOverlay',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::STRING,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::STRING,
            ),
          ),
        4 => array(
          'var' => 'runAsync',
          'type' => TType::BOOL,
          ),
        5 => array(
          'var' => 'queryTimeout',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['statement'])) {
        $this->statement = $vals['statement'];
      }
      if (isset($vals['confOverlay'])) {
        $this->confOverlay = $vals['confOverlay'];
      }
      if (isset($vals['runAsync'])) {
        $this->runAsync = $vals['runAsync'];
      }
      if (isset($vals['queryTimeout'])) {
        $this->queryTimeout = $vals['queryTimeout'];
      }
    }
  }

  public function getName() {
    return 'TExecuteStatementReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->statement);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::MAP) {
            $this->confOverlay = array();
            $_size143 = 0;
            $_ktype144 = 0;
            $_vtype145 = 0;
            $xfer += $input->readMapBegin($_ktype144, $_vtype145, $_size143);
            for ($_i147 = 0; $_i147 < $_size143; ++$_i147)
            {
              $key148 = '';
              $val149 = '';
              $xfer += $input->readString($key148);
              $xfer += $input->readString($val149);
              $this->confOverlay[$key148] = $val149;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->runAsync);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->queryTimeout);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TExecuteStatementReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->statement !== null) {
      $xfer += $output->writeFieldBegin('statement', TType::STRING, 2);
      $xfer += $output->writeString($this->statement);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->confOverlay !== null) {
      if (!is_array($this->confOverlay)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('confOverlay', TType::MAP, 3);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->confOverlay));
        {
          foreach ($this->confOverlay as $kiter150 => $viter151)
          {
            $xfer += $output->writeString($kiter150);
            $xfer += $output->writeString($viter151);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->runAsync !== null) {
      $xfer += $output->writeFieldBegin('runAsync', TType::BOOL, 4);
      $xfer += $output->writeBool($this->runAsync);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->queryTimeout !== null) {
      $xfer += $output->writeFieldBegin('queryTimeout', TType::I64, 5);
      $xfer += $output->writeI64($this->queryTimeout);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TExecuteStatementResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TExecuteStatementResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TExecuteStatementResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetTypeInfoReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetTypeInfoReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetTypeInfoReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetTypeInfoResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetTypeInfoResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetTypeInfoResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetCatalogsReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetCatalogsReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetCatalogsReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetCatalogsResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetCatalogsResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetCatalogsResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetSchemasReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var string
   */
  public $catalogName = null;
  /**
   * @var string
   */
  public $schemaName = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        2 => array(
          'var' => 'catalogName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'schemaName',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['catalogName'])) {
        $this->catalogName = $vals['catalogName'];
      }
      if (isset($vals['schemaName'])) {
        $this->schemaName = $vals['schemaName'];
      }
    }
  }

  public function getName() {
    return 'TGetSchemasReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->catalogName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->schemaName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetSchemasReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->catalogName !== null) {
      $xfer += $output->writeFieldBegin('catalogName', TType::STRING, 2);
      $xfer += $output->writeString($this->catalogName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->schemaName !== null) {
      $xfer += $output->writeFieldBegin('schemaName', TType::STRING, 3);
      $xfer += $output->writeString($this->schemaName);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetSchemasResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetSchemasResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetSchemasResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetTablesReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var string
   */
  public $catalogName = null;
  /**
   * @var string
   */
  public $schemaName = null;
  /**
   * @var string
   */
  public $tableName = null;
  /**
   * @var string[]
   */
  public $tableTypes = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        2 => array(
          'var' => 'catalogName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'schemaName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'tableName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'tableTypes',
          'type' => TType::LST,
          'etype' => TType::STRING,
          'elem' => array(
            'type' => TType::STRING,
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['catalogName'])) {
        $this->catalogName = $vals['catalogName'];
      }
      if (isset($vals['schemaName'])) {
        $this->schemaName = $vals['schemaName'];
      }
      if (isset($vals['tableName'])) {
        $this->tableName = $vals['tableName'];
      }
      if (isset($vals['tableTypes'])) {
        $this->tableTypes = $vals['tableTypes'];
      }
    }
  }

  public function getName() {
    return 'TGetTablesReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->catalogName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->schemaName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::LST) {
            $this->tableTypes = array();
            $_size152 = 0;
            $_etype155 = 0;
            $xfer += $input->readListBegin($_etype155, $_size152);
            for ($_i156 = 0; $_i156 < $_size152; ++$_i156)
            {
              $elem157 = null;
              $xfer += $input->readString($elem157);
              $this->tableTypes []= $elem157;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetTablesReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->catalogName !== null) {
      $xfer += $output->writeFieldBegin('catalogName', TType::STRING, 2);
      $xfer += $output->writeString($this->catalogName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->schemaName !== null) {
      $xfer += $output->writeFieldBegin('schemaName', TType::STRING, 3);
      $xfer += $output->writeString($this->schemaName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableName !== null) {
      $xfer += $output->writeFieldBegin('tableName', TType::STRING, 4);
      $xfer += $output->writeString($this->tableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableTypes !== null) {
      if (!is_array($this->tableTypes)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('tableTypes', TType::LST, 5);
      {
        $output->writeListBegin(TType::STRING, count($this->tableTypes));
        {
          foreach ($this->tableTypes as $iter158)
          {
            $xfer += $output->writeString($iter158);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetTablesResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetTablesResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetTablesResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetTableTypesReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetTableTypesReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetTableTypesReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetTableTypesResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetTableTypesResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetTableTypesResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetColumnsReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var string
   */
  public $catalogName = null;
  /**
   * @var string
   */
  public $schemaName = null;
  /**
   * @var string
   */
  public $tableName = null;
  /**
   * @var string
   */
  public $columnName = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        2 => array(
          'var' => 'catalogName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'schemaName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'tableName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'columnName',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['catalogName'])) {
        $this->catalogName = $vals['catalogName'];
      }
      if (isset($vals['schemaName'])) {
        $this->schemaName = $vals['schemaName'];
      }
      if (isset($vals['tableName'])) {
        $this->tableName = $vals['tableName'];
      }
      if (isset($vals['columnName'])) {
        $this->columnName = $vals['columnName'];
      }
    }
  }

  public function getName() {
    return 'TGetColumnsReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->catalogName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->schemaName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->columnName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetColumnsReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->catalogName !== null) {
      $xfer += $output->writeFieldBegin('catalogName', TType::STRING, 2);
      $xfer += $output->writeString($this->catalogName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->schemaName !== null) {
      $xfer += $output->writeFieldBegin('schemaName', TType::STRING, 3);
      $xfer += $output->writeString($this->schemaName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableName !== null) {
      $xfer += $output->writeFieldBegin('tableName', TType::STRING, 4);
      $xfer += $output->writeString($this->tableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->columnName !== null) {
      $xfer += $output->writeFieldBegin('columnName', TType::STRING, 5);
      $xfer += $output->writeString($this->columnName);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetColumnsResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetColumnsResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetColumnsResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetFunctionsReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var string
   */
  public $catalogName = null;
  /**
   * @var string
   */
  public $schemaName = null;
  /**
   * @var string
   */
  public $functionName = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        2 => array(
          'var' => 'catalogName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'schemaName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'functionName',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['catalogName'])) {
        $this->catalogName = $vals['catalogName'];
      }
      if (isset($vals['schemaName'])) {
        $this->schemaName = $vals['schemaName'];
      }
      if (isset($vals['functionName'])) {
        $this->functionName = $vals['functionName'];
      }
    }
  }

  public function getName() {
    return 'TGetFunctionsReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->catalogName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->schemaName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->functionName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetFunctionsReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->catalogName !== null) {
      $xfer += $output->writeFieldBegin('catalogName', TType::STRING, 2);
      $xfer += $output->writeString($this->catalogName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->schemaName !== null) {
      $xfer += $output->writeFieldBegin('schemaName', TType::STRING, 3);
      $xfer += $output->writeString($this->schemaName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->functionName !== null) {
      $xfer += $output->writeFieldBegin('functionName', TType::STRING, 4);
      $xfer += $output->writeString($this->functionName);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetFunctionsResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetFunctionsResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetFunctionsResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetPrimaryKeysReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var string
   */
  public $catalogName = null;
  /**
   * @var string
   */
  public $schemaName = null;
  /**
   * @var string
   */
  public $tableName = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        2 => array(
          'var' => 'catalogName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'schemaName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'tableName',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['catalogName'])) {
        $this->catalogName = $vals['catalogName'];
      }
      if (isset($vals['schemaName'])) {
        $this->schemaName = $vals['schemaName'];
      }
      if (isset($vals['tableName'])) {
        $this->tableName = $vals['tableName'];
      }
    }
  }

  public function getName() {
    return 'TGetPrimaryKeysReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->catalogName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->schemaName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetPrimaryKeysReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->catalogName !== null) {
      $xfer += $output->writeFieldBegin('catalogName', TType::STRING, 2);
      $xfer += $output->writeString($this->catalogName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->schemaName !== null) {
      $xfer += $output->writeFieldBegin('schemaName', TType::STRING, 3);
      $xfer += $output->writeString($this->schemaName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableName !== null) {
      $xfer += $output->writeFieldBegin('tableName', TType::STRING, 4);
      $xfer += $output->writeString($this->tableName);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetPrimaryKeysResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetPrimaryKeysResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetPrimaryKeysResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetCrossReferenceReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var string
   */
  public $parentCatalogName = null;
  /**
   * @var string
   */
  public $parentSchemaName = null;
  /**
   * @var string
   */
  public $parentTableName = null;
  /**
   * @var string
   */
  public $foreignCatalogName = null;
  /**
   * @var string
   */
  public $foreignSchemaName = null;
  /**
   * @var string
   */
  public $foreignTableName = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        2 => array(
          'var' => 'parentCatalogName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'parentSchemaName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'parentTableName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'foreignCatalogName',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'foreignSchemaName',
          'type' => TType::STRING,
          ),
        7 => array(
          'var' => 'foreignTableName',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['parentCatalogName'])) {
        $this->parentCatalogName = $vals['parentCatalogName'];
      }
      if (isset($vals['parentSchemaName'])) {
        $this->parentSchemaName = $vals['parentSchemaName'];
      }
      if (isset($vals['parentTableName'])) {
        $this->parentTableName = $vals['parentTableName'];
      }
      if (isset($vals['foreignCatalogName'])) {
        $this->foreignCatalogName = $vals['foreignCatalogName'];
      }
      if (isset($vals['foreignSchemaName'])) {
        $this->foreignSchemaName = $vals['foreignSchemaName'];
      }
      if (isset($vals['foreignTableName'])) {
        $this->foreignTableName = $vals['foreignTableName'];
      }
    }
  }

  public function getName() {
    return 'TGetCrossReferenceReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parentCatalogName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parentSchemaName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->parentTableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->foreignCatalogName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->foreignSchemaName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->foreignTableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetCrossReferenceReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parentCatalogName !== null) {
      $xfer += $output->writeFieldBegin('parentCatalogName', TType::STRING, 2);
      $xfer += $output->writeString($this->parentCatalogName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parentSchemaName !== null) {
      $xfer += $output->writeFieldBegin('parentSchemaName', TType::STRING, 3);
      $xfer += $output->writeString($this->parentSchemaName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parentTableName !== null) {
      $xfer += $output->writeFieldBegin('parentTableName', TType::STRING, 4);
      $xfer += $output->writeString($this->parentTableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->foreignCatalogName !== null) {
      $xfer += $output->writeFieldBegin('foreignCatalogName', TType::STRING, 5);
      $xfer += $output->writeString($this->foreignCatalogName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->foreignSchemaName !== null) {
      $xfer += $output->writeFieldBegin('foreignSchemaName', TType::STRING, 6);
      $xfer += $output->writeString($this->foreignSchemaName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->foreignTableName !== null) {
      $xfer += $output->writeFieldBegin('foreignTableName', TType::STRING, 7);
      $xfer += $output->writeString($this->foreignTableName);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetCrossReferenceResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetCrossReferenceResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetCrossReferenceResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 2);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetOperationStatusReq {
  static $_TSPEC;

  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;
  /**
   * @var bool
   */
  public $getProgressUpdate = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        2 => array(
          'var' => 'getProgressUpdate',
          'type' => TType::BOOL,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
      if (isset($vals['getProgressUpdate'])) {
        $this->getProgressUpdate = $vals['getProgressUpdate'];
      }
    }
  }

  public function getName() {
    return 'TGetOperationStatusReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->getProgressUpdate);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetOperationStatusReq');
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 1);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->getProgressUpdate !== null) {
      $xfer += $output->writeFieldBegin('getProgressUpdate', TType::BOOL, 2);
      $xfer += $output->writeBool($this->getProgressUpdate);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetOperationStatusResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var int
   */
  public $operationState = null;
  /**
   * @var string
   */
  public $sqlState = null;
  /**
   * @var int
   */
  public $errorCode = null;
  /**
   * @var string
   */
  public $errorMessage = null;
  /**
   * @var string
   */
  public $taskStatus = null;
  /**
   * @var int
   */
  public $operationStarted = null;
  /**
   * @var int
   */
  public $operationCompleted = null;
  /**
   * @var bool
   */
  public $hasResultSet = null;
  /**
   * @var \TProgressUpdateResp
   */
  public $progressUpdateResponse = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'operationState',
          'type' => TType::I32,
          ),
        3 => array(
          'var' => 'sqlState',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'errorCode',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'errorMessage',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'taskStatus',
          'type' => TType::STRING,
          ),
        7 => array(
          'var' => 'operationStarted',
          'type' => TType::I64,
          ),
        8 => array(
          'var' => 'operationCompleted',
          'type' => TType::I64,
          ),
        9 => array(
          'var' => 'hasResultSet',
          'type' => TType::BOOL,
          ),
        10 => array(
          'var' => 'progressUpdateResponse',
          'type' => TType::STRUCT,
          'class' => '\TProgressUpdateResp',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['operationState'])) {
        $this->operationState = $vals['operationState'];
      }
      if (isset($vals['sqlState'])) {
        $this->sqlState = $vals['sqlState'];
      }
      if (isset($vals['errorCode'])) {
        $this->errorCode = $vals['errorCode'];
      }
      if (isset($vals['errorMessage'])) {
        $this->errorMessage = $vals['errorMessage'];
      }
      if (isset($vals['taskStatus'])) {
        $this->taskStatus = $vals['taskStatus'];
      }
      if (isset($vals['operationStarted'])) {
        $this->operationStarted = $vals['operationStarted'];
      }
      if (isset($vals['operationCompleted'])) {
        $this->operationCompleted = $vals['operationCompleted'];
      }
      if (isset($vals['hasResultSet'])) {
        $this->hasResultSet = $vals['hasResultSet'];
      }
      if (isset($vals['progressUpdateResponse'])) {
        $this->progressUpdateResponse = $vals['progressUpdateResponse'];
      }
    }
  }

  public function getName() {
    return 'TGetOperationStatusResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->operationState);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->sqlState);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->errorCode);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->errorMessage);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->taskStatus);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->operationStarted);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->operationCompleted);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->hasResultSet);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::STRUCT) {
            $this->progressUpdateResponse = new \TProgressUpdateResp();
            $xfer += $this->progressUpdateResponse->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetOperationStatusResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationState !== null) {
      $xfer += $output->writeFieldBegin('operationState', TType::I32, 2);
      $xfer += $output->writeI32($this->operationState);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sqlState !== null) {
      $xfer += $output->writeFieldBegin('sqlState', TType::STRING, 3);
      $xfer += $output->writeString($this->sqlState);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->errorCode !== null) {
      $xfer += $output->writeFieldBegin('errorCode', TType::I32, 4);
      $xfer += $output->writeI32($this->errorCode);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->errorMessage !== null) {
      $xfer += $output->writeFieldBegin('errorMessage', TType::STRING, 5);
      $xfer += $output->writeString($this->errorMessage);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->taskStatus !== null) {
      $xfer += $output->writeFieldBegin('taskStatus', TType::STRING, 6);
      $xfer += $output->writeString($this->taskStatus);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationStarted !== null) {
      $xfer += $output->writeFieldBegin('operationStarted', TType::I64, 7);
      $xfer += $output->writeI64($this->operationStarted);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->operationCompleted !== null) {
      $xfer += $output->writeFieldBegin('operationCompleted', TType::I64, 8);
      $xfer += $output->writeI64($this->operationCompleted);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->hasResultSet !== null) {
      $xfer += $output->writeFieldBegin('hasResultSet', TType::BOOL, 9);
      $xfer += $output->writeBool($this->hasResultSet);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->progressUpdateResponse !== null) {
      if (!is_object($this->progressUpdateResponse)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('progressUpdateResponse', TType::STRUCT, 10);
      $xfer += $this->progressUpdateResponse->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TCancelOperationReq {
  static $_TSPEC;

  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TCancelOperationReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TCancelOperationReq');
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 1);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TCancelOperationResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
    }
  }

  public function getName() {
    return 'TCancelOperationResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TCancelOperationResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TCloseOperationReq {
  static $_TSPEC;

  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TCloseOperationReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TCloseOperationReq');
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 1);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TCloseOperationResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
    }
  }

  public function getName() {
    return 'TCloseOperationResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TCloseOperationResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetResultSetMetadataReq {
  static $_TSPEC;

  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
    }
  }

  public function getName() {
    return 'TGetResultSetMetadataReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetResultSetMetadataReq');
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 1);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetResultSetMetadataResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var \TTableSchema
   */
  public $schema = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'schema',
          'type' => TType::STRUCT,
          'class' => '\TTableSchema',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['schema'])) {
        $this->schema = $vals['schema'];
      }
    }
  }

  public function getName() {
    return 'TGetResultSetMetadataResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->schema = new \TTableSchema();
            $xfer += $this->schema->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetResultSetMetadataResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->schema !== null) {
      if (!is_object($this->schema)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('schema', TType::STRUCT, 2);
      $xfer += $this->schema->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TFetchResultsReq {
  static $_TSPEC;

  /**
   * @var \TOperationHandle
   */
  public $operationHandle = null;
  /**
   * @var int
   */
  public $orientation =   0;
  /**
   * @var int
   */
  public $maxRows = null;
  /**
   * @var int
   */
  public $fetchType = 0;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'operationHandle',
          'type' => TType::STRUCT,
          'class' => '\TOperationHandle',
          ),
        2 => array(
          'var' => 'orientation',
          'type' => TType::I32,
          ),
        3 => array(
          'var' => 'maxRows',
          'type' => TType::I64,
          ),
        4 => array(
          'var' => 'fetchType',
          'type' => TType::I16,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['operationHandle'])) {
        $this->operationHandle = $vals['operationHandle'];
      }
      if (isset($vals['orientation'])) {
        $this->orientation = $vals['orientation'];
      }
      if (isset($vals['maxRows'])) {
        $this->maxRows = $vals['maxRows'];
      }
      if (isset($vals['fetchType'])) {
        $this->fetchType = $vals['fetchType'];
      }
    }
  }

  public function getName() {
    return 'TFetchResultsReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->operationHandle = new \TOperationHandle();
            $xfer += $this->operationHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->orientation);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->maxRows);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I16) {
            $xfer += $input->readI16($this->fetchType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TFetchResultsReq');
    if ($this->operationHandle !== null) {
      if (!is_object($this->operationHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('operationHandle', TType::STRUCT, 1);
      $xfer += $this->operationHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->orientation !== null) {
      $xfer += $output->writeFieldBegin('orientation', TType::I32, 2);
      $xfer += $output->writeI32($this->orientation);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->maxRows !== null) {
      $xfer += $output->writeFieldBegin('maxRows', TType::I64, 3);
      $xfer += $output->writeI64($this->maxRows);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->fetchType !== null) {
      $xfer += $output->writeFieldBegin('fetchType', TType::I16, 4);
      $xfer += $output->writeI16($this->fetchType);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TFetchResultsResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var bool
   */
  public $hasMoreRows = null;
  /**
   * @var \TRowSet
   */
  public $results = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'hasMoreRows',
          'type' => TType::BOOL,
          ),
        3 => array(
          'var' => 'results',
          'type' => TType::STRUCT,
          'class' => '\TRowSet',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['hasMoreRows'])) {
        $this->hasMoreRows = $vals['hasMoreRows'];
      }
      if (isset($vals['results'])) {
        $this->results = $vals['results'];
      }
    }
  }

  public function getName() {
    return 'TFetchResultsResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->hasMoreRows);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRUCT) {
            $this->results = new \TRowSet();
            $xfer += $this->results->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TFetchResultsResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->hasMoreRows !== null) {
      $xfer += $output->writeFieldBegin('hasMoreRows', TType::BOOL, 2);
      $xfer += $output->writeBool($this->hasMoreRows);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->results !== null) {
      if (!is_object($this->results)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('results', TType::STRUCT, 3);
      $xfer += $this->results->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetDelegationTokenReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var string
   */
  public $owner = null;
  /**
   * @var string
   */
  public $renewer = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        2 => array(
          'var' => 'owner',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'renewer',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['owner'])) {
        $this->owner = $vals['owner'];
      }
      if (isset($vals['renewer'])) {
        $this->renewer = $vals['renewer'];
      }
    }
  }

  public function getName() {
    return 'TGetDelegationTokenReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->owner);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->renewer);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetDelegationTokenReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->owner !== null) {
      $xfer += $output->writeFieldBegin('owner', TType::STRING, 2);
      $xfer += $output->writeString($this->owner);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->renewer !== null) {
      $xfer += $output->writeFieldBegin('renewer', TType::STRING, 3);
      $xfer += $output->writeString($this->renewer);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TGetDelegationTokenResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;
  /**
   * @var string
   */
  public $delegationToken = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        2 => array(
          'var' => 'delegationToken',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['delegationToken'])) {
        $this->delegationToken = $vals['delegationToken'];
      }
    }
  }

  public function getName() {
    return 'TGetDelegationTokenResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->delegationToken);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TGetDelegationTokenResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->delegationToken !== null) {
      $xfer += $output->writeFieldBegin('delegationToken', TType::STRING, 2);
      $xfer += $output->writeString($this->delegationToken);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TCancelDelegationTokenReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var string
   */
  public $delegationToken = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        2 => array(
          'var' => 'delegationToken',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['delegationToken'])) {
        $this->delegationToken = $vals['delegationToken'];
      }
    }
  }

  public function getName() {
    return 'TCancelDelegationTokenReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->delegationToken);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TCancelDelegationTokenReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->delegationToken !== null) {
      $xfer += $output->writeFieldBegin('delegationToken', TType::STRING, 2);
      $xfer += $output->writeString($this->delegationToken);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TCancelDelegationTokenResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
    }
  }

  public function getName() {
    return 'TCancelDelegationTokenResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TCancelDelegationTokenResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TRenewDelegationTokenReq {
  static $_TSPEC;

  /**
   * @var \TSessionHandle
   */
  public $sessionHandle = null;
  /**
   * @var string
   */
  public $delegationToken = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'sessionHandle',
          'type' => TType::STRUCT,
          'class' => '\TSessionHandle',
          ),
        2 => array(
          'var' => 'delegationToken',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['sessionHandle'])) {
        $this->sessionHandle = $vals['sessionHandle'];
      }
      if (isset($vals['delegationToken'])) {
        $this->delegationToken = $vals['delegationToken'];
      }
    }
  }

  public function getName() {
    return 'TRenewDelegationTokenReq';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->sessionHandle = new \TSessionHandle();
            $xfer += $this->sessionHandle->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->delegationToken);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TRenewDelegationTokenReq');
    if ($this->sessionHandle !== null) {
      if (!is_object($this->sessionHandle)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sessionHandle', TType::STRUCT, 1);
      $xfer += $this->sessionHandle->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->delegationToken !== null) {
      $xfer += $output->writeFieldBegin('delegationToken', TType::STRING, 2);
      $xfer += $output->writeString($this->delegationToken);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TRenewDelegationTokenResp {
  static $_TSPEC;

  /**
   * @var \TStatus
   */
  public $status = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'status',
          'type' => TType::STRUCT,
          'class' => '\TStatus',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
    }
  }

  public function getName() {
    return 'TRenewDelegationTokenResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::STRUCT) {
            $this->status = new \TStatus();
            $xfer += $this->status->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TRenewDelegationTokenResp');
    if ($this->status !== null) {
      if (!is_object($this->status)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('status', TType::STRUCT, 1);
      $xfer += $this->status->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TProgressUpdateResp {
  static $_TSPEC;

  /**
   * @var string[]
   */
  public $headerNames = null;
  /**
   * @var (string[])[]
   */
  public $rows = null;
  /**
   * @var double
   */
  public $progressedPercentage = null;
  /**
   * @var int
   */
  public $status = null;
  /**
   * @var string
   */
  public $footerSummary = null;
  /**
   * @var int
   */
  public $startTime = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'headerNames',
          'type' => TType::LST,
          'etype' => TType::STRING,
          'elem' => array(
            'type' => TType::STRING,
            ),
          ),
        2 => array(
          'var' => 'rows',
          'type' => TType::LST,
          'etype' => TType::LST,
          'elem' => array(
            'type' => TType::LST,
            'etype' => TType::STRING,
            'elem' => array(
              'type' => TType::STRING,
              ),
            ),
          ),
        3 => array(
          'var' => 'progressedPercentage',
          'type' => TType::DOUBLE,
          ),
        4 => array(
          'var' => 'status',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'footerSummary',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'startTime',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['headerNames'])) {
        $this->headerNames = $vals['headerNames'];
      }
      if (isset($vals['rows'])) {
        $this->rows = $vals['rows'];
      }
      if (isset($vals['progressedPercentage'])) {
        $this->progressedPercentage = $vals['progressedPercentage'];
      }
      if (isset($vals['status'])) {
        $this->status = $vals['status'];
      }
      if (isset($vals['footerSummary'])) {
        $this->footerSummary = $vals['footerSummary'];
      }
      if (isset($vals['startTime'])) {
        $this->startTime = $vals['startTime'];
      }
    }
  }

  public function getName() {
    return 'TProgressUpdateResp';
  }

  public function read($input)
  {
    $xfer = 0;
    $fname = null;
    $ftype = 0;
    $fid = 0;
    $xfer += $input->readStructBegin($fname);
    while (true)
    {
      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
      if ($ftype == TType::STOP) {
        break;
      }
      switch ($fid)
      {
        case 1:
          if ($ftype == TType::LST) {
            $this->headerNames = array();
            $_size159 = 0;
            $_etype162 = 0;
            $xfer += $input->readListBegin($_etype162, $_size159);
            for ($_i163 = 0; $_i163 < $_size159; ++$_i163)
            {
              $elem164 = null;
              $xfer += $input->readString($elem164);
              $this->headerNames []= $elem164;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::LST) {
            $this->rows = array();
            $_size165 = 0;
            $_etype168 = 0;
            $xfer += $input->readListBegin($_etype168, $_size165);
            for ($_i169 = 0; $_i169 < $_size165; ++$_i169)
            {
              $elem170 = null;
              $elem170 = array();
              $_size171 = 0;
              $_etype174 = 0;
              $xfer += $input->readListBegin($_etype174, $_size171);
              for ($_i175 = 0; $_i175 < $_size171; ++$_i175)
              {
                $elem176 = null;
                $xfer += $input->readString($elem176);
                $elem170 []= $elem176;
              }
              $xfer += $input->readListEnd();
              $this->rows []= $elem170;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::DOUBLE) {
            $xfer += $input->readDouble($this->progressedPercentage);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->status);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->footerSummary);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->startTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('TProgressUpdateResp');
    if ($this->headerNames !== null) {
      if (!is_array($this->headerNames)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('headerNames', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRING, count($this->headerNames));
        {
          foreach ($this->headerNames as $iter177)
          {
            $xfer += $output->writeString($iter177);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->rows !== null) {
      if (!is_array($this->rows)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('rows', TType::LST, 2);
      {
        $output->writeListBegin(TType::LST, count($this->rows));
        {
          foreach ($this->rows as $iter178)
          {
            {
              $output->writeListBegin(TType::STRING, count($iter178));
              {
                foreach ($iter178 as $iter179)
                {
                  $xfer += $output->writeString($iter179);
                }
              }
              $output->writeListEnd();
            }
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->progressedPercentage !== null) {
      $xfer += $output->writeFieldBegin('progressedPercentage', TType::DOUBLE, 3);
      $xfer += $output->writeDouble($this->progressedPercentage);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->status !== null) {
      $xfer += $output->writeFieldBegin('status', TType::I32, 4);
      $xfer += $output->writeI32($this->status);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->footerSummary !== null) {
      $xfer += $output->writeFieldBegin('footerSummary', TType::STRING, 5);
      $xfer += $output->writeString($this->footerSummary);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->startTime !== null) {
      $xfer += $output->writeFieldBegin('startTime', TType::I64, 6);
      $xfer += $output->writeI64($this->startTime);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

final class Constant extends \Thrift\Type\TConstant {
  static protected $PRIMITIVE_TYPES;
  static protected $COMPLEX_TYPES;
  static protected $COLLECTION_TYPES;
  static protected $TYPE_NAMES;
  static protected $CHARACTER_MAXIMUM_LENGTH;
  static protected $PRECISION;
  static protected $SCALE;

  static protected function init_PRIMITIVE_TYPES() {
    return array(
            0 => true,
            1 => true,
            2 => true,
            3 => true,
            4 => true,
            5 => true,
            6 => true,
            7 => true,
            8 => true,
            9 => true,
            15 => true,
            16 => true,
            17 => true,
            18 => true,
            19 => true,
            20 => true,
            21 => true,
    );
  }

  static protected function init_COMPLEX_TYPES() {
    return array(
            10 => true,
            11 => true,
            12 => true,
            13 => true,
            14 => true,
    );
  }

  static protected function init_COLLECTION_TYPES() {
    return array(
            10 => true,
            11 => true,
    );
  }

  static protected function init_TYPE_NAMES() {
    return array(
            0 => "BOOLEAN",
            1 => "TINYINT",
            2 => "SMALLINT",
            3 => "INT",
            4 => "BIGINT",
            5 => "FLOAT",
            6 => "DOUBLE",
            7 => "STRING",
            8 => "TIMESTAMP",
            9 => "BINARY",
            10 => "ARRAY",
            11 => "MAP",
            12 => "STRUCT",
            13 => "UNIONTYPE",
            15 => "DECIMAL",
            16 => "NULL",
            17 => "DATE",
            18 => "VARCHAR",
            19 => "CHAR",
            20 => "INTERVAL_YEAR_MONTH",
            21 => "INTERVAL_DAY_TIME",
    );
  }

  static protected function init_CHARACTER_MAXIMUM_LENGTH() {
    return "characterMaximumLength";
  }

  static protected function init_PRECISION() {
    return "precision";
  }

  static protected function init_SCALE() {
    return "scale";
  }
}


