Subversion Repositories qbpwcf-lib(archive)

Rev

Rev 915 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
namespace metastore;

/**
 * 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 HiveObjectType {
  const GLOBAL = 1;
  const DATABASE = 2;
  const TABLE = 3;
  const PARTITION = 4;
  const COLUMN = 5;
  static public $__names = array(
    1 => 'GLOBAL',
    2 => 'DATABASE',
    3 => 'TABLE',
    4 => 'PARTITION',
    5 => 'COLUMN',
  );
}

final class PrincipalType {
  const USER = 1;
  const ROLE = 2;
  const GROUP = 3;
  static public $__names = array(
    1 => 'USER',
    2 => 'ROLE',
    3 => 'GROUP',
  );
}

final class PartitionEventType {
  const LOAD_DONE = 1;
  static public $__names = array(
    1 => 'LOAD_DONE',
  );
}

final class TxnState {
  const COMMITTED = 1;
  const ABORTED = 2;
  const OPEN = 3;
  static public $__names = array(
    1 => 'COMMITTED',
    2 => 'ABORTED',
    3 => 'OPEN',
  );
}

final class LockLevel {
  const DB = 1;
  const TABLE = 2;
  const PARTITION = 3;
  static public $__names = array(
    1 => 'DB',
    2 => 'TABLE',
    3 => 'PARTITION',
  );
}

final class LockState {
  const ACQUIRED = 1;
  const WAITING = 2;
  const ABORT = 3;
  const NOT_ACQUIRED = 4;
  static public $__names = array(
    1 => 'ACQUIRED',
    2 => 'WAITING',
    3 => 'ABORT',
    4 => 'NOT_ACQUIRED',
  );
}

final class LockType {
  const SHARED_READ = 1;
  const SHARED_WRITE = 2;
  const EXCLUSIVE = 3;
  static public $__names = array(
    1 => 'SHARED_READ',
    2 => 'SHARED_WRITE',
    3 => 'EXCLUSIVE',
  );
}

final class CompactionType {
  const MINOR = 1;
  const MAJOR = 2;
  static public $__names = array(
    1 => 'MINOR',
    2 => 'MAJOR',
  );
}

final class GrantRevokeType {
  const GRANT = 1;
  const REVOKE = 2;
  static public $__names = array(
    1 => 'GRANT',
    2 => 'REVOKE',
  );
}

final class EventRequestType {
  const INSERT = 1;
  const UPDATE = 2;
  const DELETE = 3;
  static public $__names = array(
    1 => 'INSERT',
    2 => 'UPDATE',
    3 => 'DELETE',
  );
}

final class FunctionType {
  const JAVA = 1;
  static public $__names = array(
    1 => 'JAVA',
  );
}

final class ResourceType {
  const JAR = 1;
  const FILE = 2;
  const ARCHIVE = 3;
  static public $__names = array(
    1 => 'JAR',
    2 => 'FILE',
    3 => 'ARCHIVE',
  );
}

final class FileMetadataExprType {
  const ORC_SARG = 1;
  static public $__names = array(
    1 => 'ORC_SARG',
  );
}

class Version {
  static $_TSPEC;

  /**
   * @var string
   */
  public $version = null;
  /**
   * @var string
   */
  public $comments = null;

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

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

  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->version);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->comments);
          } 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('Version');
    if ($this->version !== null) {
      $xfer += $output->writeFieldBegin('version', TType::STRING, 1);
      $xfer += $output->writeString($this->version);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->comments !== null) {
      $xfer += $output->writeFieldBegin('comments', TType::STRING, 2);
      $xfer += $output->writeString($this->comments);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class FieldSchema {
  static $_TSPEC;

  /**
   * @var string
   */
  public $name = null;
  /**
   * @var string
   */
  public $type = null;
  /**
   * @var string
   */
  public $comment = null;

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

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

  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->name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->type);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          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('FieldSchema');
    if ($this->name !== null) {
      $xfer += $output->writeFieldBegin('name', TType::STRING, 1);
      $xfer += $output->writeString($this->name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->type !== null) {
      $xfer += $output->writeFieldBegin('type', TType::STRING, 2);
      $xfer += $output->writeString($this->type);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->comment !== null) {
      $xfer += $output->writeFieldBegin('comment', TType::STRING, 3);
      $xfer += $output->writeString($this->comment);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Type {
  static $_TSPEC;

  /**
   * @var string
   */
  public $name = null;
  /**
   * @var string
   */
  public $type1 = null;
  /**
   * @var string
   */
  public $type2 = null;
  /**
   * @var \metastore\FieldSchema[]
   */
  public $fields = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'name',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'type1',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'type2',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'fields',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\metastore\FieldSchema',
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['name'])) {
        $this->name = $vals['name'];
      }
      if (isset($vals['type1'])) {
        $this->type1 = $vals['type1'];
      }
      if (isset($vals['type2'])) {
        $this->type2 = $vals['type2'];
      }
      if (isset($vals['fields'])) {
        $this->fields = $vals['fields'];
      }
    }
  }

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

  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->name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->type1);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->type2);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::LST) {
            $this->fields = array();
            $_size0 = 0;
            $_etype3 = 0;
            $xfer += $input->readListBegin($_etype3, $_size0);
            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
            {
              $elem5 = null;
              $elem5 = new \metastore\FieldSchema();
              $xfer += $elem5->read($input);
              $this->fields []= $elem5;
            }
            $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('Type');
    if ($this->name !== null) {
      $xfer += $output->writeFieldBegin('name', TType::STRING, 1);
      $xfer += $output->writeString($this->name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->type1 !== null) {
      $xfer += $output->writeFieldBegin('type1', TType::STRING, 2);
      $xfer += $output->writeString($this->type1);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->type2 !== null) {
      $xfer += $output->writeFieldBegin('type2', TType::STRING, 3);
      $xfer += $output->writeString($this->type2);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->fields !== null) {
      if (!is_array($this->fields)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('fields', TType::LST, 4);
      {
        $output->writeListBegin(TType::STRUCT, count($this->fields));
        {
          foreach ($this->fields as $iter6)
          {
            $xfer += $iter6->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class HiveObjectRef {
  static $_TSPEC;

  /**
   * @var int
   */
  public $objectType = null;
  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $objectName = null;
  /**
   * @var string[]
   */
  public $partValues = null;
  /**
   * @var string
   */
  public $columnName = null;

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

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

  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->objectType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->objectName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::LST) {
            $this->partValues = array();
            $_size7 = 0;
            $_etype10 = 0;
            $xfer += $input->readListBegin($_etype10, $_size7);
            for ($_i11 = 0; $_i11 < $_size7; ++$_i11)
            {
              $elem12 = null;
              $xfer += $input->readString($elem12);
              $this->partValues []= $elem12;
            }
            $xfer += $input->readListEnd();
          } 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('HiveObjectRef');
    if ($this->objectType !== null) {
      $xfer += $output->writeFieldBegin('objectType', TType::I32, 1);
      $xfer += $output->writeI32($this->objectType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 2);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->objectName !== null) {
      $xfer += $output->writeFieldBegin('objectName', TType::STRING, 3);
      $xfer += $output->writeString($this->objectName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partValues !== null) {
      if (!is_array($this->partValues)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partValues', TType::LST, 4);
      {
        $output->writeListBegin(TType::STRING, count($this->partValues));
        {
          foreach ($this->partValues as $iter13)
          {
            $xfer += $output->writeString($iter13);
          }
        }
        $output->writeListEnd();
      }
      $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 PrivilegeGrantInfo {
  static $_TSPEC;

  /**
   * @var string
   */
  public $privilege = null;
  /**
   * @var int
   */
  public $createTime = null;
  /**
   * @var string
   */
  public $grantor = null;
  /**
   * @var int
   */
  public $grantorType = null;
  /**
   * @var bool
   */
  public $grantOption = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'privilege',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'createTime',
          'type' => TType::I32,
          ),
        3 => array(
          'var' => 'grantor',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'grantorType',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'grantOption',
          'type' => TType::BOOL,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['privilege'])) {
        $this->privilege = $vals['privilege'];
      }
      if (isset($vals['createTime'])) {
        $this->createTime = $vals['createTime'];
      }
      if (isset($vals['grantor'])) {
        $this->grantor = $vals['grantor'];
      }
      if (isset($vals['grantorType'])) {
        $this->grantorType = $vals['grantorType'];
      }
      if (isset($vals['grantOption'])) {
        $this->grantOption = $vals['grantOption'];
      }
    }
  }

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

  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->privilege);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->createTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->grantor);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->grantorType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->grantOption);
          } 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('PrivilegeGrantInfo');
    if ($this->privilege !== null) {
      $xfer += $output->writeFieldBegin('privilege', TType::STRING, 1);
      $xfer += $output->writeString($this->privilege);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createTime !== null) {
      $xfer += $output->writeFieldBegin('createTime', TType::I32, 2);
      $xfer += $output->writeI32($this->createTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->grantor !== null) {
      $xfer += $output->writeFieldBegin('grantor', TType::STRING, 3);
      $xfer += $output->writeString($this->grantor);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->grantorType !== null) {
      $xfer += $output->writeFieldBegin('grantorType', TType::I32, 4);
      $xfer += $output->writeI32($this->grantorType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->grantOption !== null) {
      $xfer += $output->writeFieldBegin('grantOption', TType::BOOL, 5);
      $xfer += $output->writeBool($this->grantOption);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class HiveObjectPrivilege {
  static $_TSPEC;

  /**
   * @var \metastore\HiveObjectRef
   */
  public $hiveObject = null;
  /**
   * @var string
   */
  public $principalName = null;
  /**
   * @var int
   */
  public $principalType = null;
  /**
   * @var \metastore\PrivilegeGrantInfo
   */
  public $grantInfo = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'hiveObject',
          'type' => TType::STRUCT,
          'class' => '\metastore\HiveObjectRef',
          ),
        2 => array(
          'var' => 'principalName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'principalType',
          'type' => TType::I32,
          ),
        4 => array(
          'var' => 'grantInfo',
          'type' => TType::STRUCT,
          'class' => '\metastore\PrivilegeGrantInfo',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['hiveObject'])) {
        $this->hiveObject = $vals['hiveObject'];
      }
      if (isset($vals['principalName'])) {
        $this->principalName = $vals['principalName'];
      }
      if (isset($vals['principalType'])) {
        $this->principalType = $vals['principalType'];
      }
      if (isset($vals['grantInfo'])) {
        $this->grantInfo = $vals['grantInfo'];
      }
    }
  }

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

  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->hiveObject = new \metastore\HiveObjectRef();
            $xfer += $this->hiveObject->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->principalName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->principalType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRUCT) {
            $this->grantInfo = new \metastore\PrivilegeGrantInfo();
            $xfer += $this->grantInfo->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('HiveObjectPrivilege');
    if ($this->hiveObject !== null) {
      if (!is_object($this->hiveObject)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('hiveObject', TType::STRUCT, 1);
      $xfer += $this->hiveObject->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->principalName !== null) {
      $xfer += $output->writeFieldBegin('principalName', TType::STRING, 2);
      $xfer += $output->writeString($this->principalName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->principalType !== null) {
      $xfer += $output->writeFieldBegin('principalType', TType::I32, 3);
      $xfer += $output->writeI32($this->principalType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->grantInfo !== null) {
      if (!is_object($this->grantInfo)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('grantInfo', TType::STRUCT, 4);
      $xfer += $this->grantInfo->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PrivilegeBag {
  static $_TSPEC;

  /**
   * @var \metastore\HiveObjectPrivilege[]
   */
  public $privileges = null;

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

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

  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->privileges = array();
            $_size14 = 0;
            $_etype17 = 0;
            $xfer += $input->readListBegin($_etype17, $_size14);
            for ($_i18 = 0; $_i18 < $_size14; ++$_i18)
            {
              $elem19 = null;
              $elem19 = new \metastore\HiveObjectPrivilege();
              $xfer += $elem19->read($input);
              $this->privileges []= $elem19;
            }
            $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('PrivilegeBag');
    if ($this->privileges !== null) {
      if (!is_array($this->privileges)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('privileges', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->privileges));
        {
          foreach ($this->privileges as $iter20)
          {
            $xfer += $iter20->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PrincipalPrivilegeSet {
  static $_TSPEC;

  /**
   * @var array
   */
  public $userPrivileges = null;
  /**
   * @var array
   */
  public $groupPrivileges = null;
  /**
   * @var array
   */
  public $rolePrivileges = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'userPrivileges',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::LST,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::LST,
            'etype' => TType::STRUCT,
            'elem' => array(
              'type' => TType::STRUCT,
              'class' => '\metastore\PrivilegeGrantInfo',
              ),
            ),
          ),
        2 => array(
          'var' => 'groupPrivileges',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::LST,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::LST,
            'etype' => TType::STRUCT,
            'elem' => array(
              'type' => TType::STRUCT,
              'class' => '\metastore\PrivilegeGrantInfo',
              ),
            ),
          ),
        3 => array(
          'var' => 'rolePrivileges',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::LST,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::LST,
            'etype' => TType::STRUCT,
            'elem' => array(
              'type' => TType::STRUCT,
              'class' => '\metastore\PrivilegeGrantInfo',
              ),
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['userPrivileges'])) {
        $this->userPrivileges = $vals['userPrivileges'];
      }
      if (isset($vals['groupPrivileges'])) {
        $this->groupPrivileges = $vals['groupPrivileges'];
      }
      if (isset($vals['rolePrivileges'])) {
        $this->rolePrivileges = $vals['rolePrivileges'];
      }
    }
  }

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

  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->userPrivileges = array();
            $_size21 = 0;
            $_ktype22 = 0;
            $_vtype23 = 0;
            $xfer += $input->readMapBegin($_ktype22, $_vtype23, $_size21);
            for ($_i25 = 0; $_i25 < $_size21; ++$_i25)
            {
              $key26 = '';
              $val27 = array();
              $xfer += $input->readString($key26);
              $val27 = array();
              $_size28 = 0;
              $_etype31 = 0;
              $xfer += $input->readListBegin($_etype31, $_size28);
              for ($_i32 = 0; $_i32 < $_size28; ++$_i32)
              {
                $elem33 = null;
                $elem33 = new \metastore\PrivilegeGrantInfo();
                $xfer += $elem33->read($input);
                $val27 []= $elem33;
              }
              $xfer += $input->readListEnd();
              $this->userPrivileges[$key26] = $val27;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::MAP) {
            $this->groupPrivileges = array();
            $_size34 = 0;
            $_ktype35 = 0;
            $_vtype36 = 0;
            $xfer += $input->readMapBegin($_ktype35, $_vtype36, $_size34);
            for ($_i38 = 0; $_i38 < $_size34; ++$_i38)
            {
              $key39 = '';
              $val40 = array();
              $xfer += $input->readString($key39);
              $val40 = array();
              $_size41 = 0;
              $_etype44 = 0;
              $xfer += $input->readListBegin($_etype44, $_size41);
              for ($_i45 = 0; $_i45 < $_size41; ++$_i45)
              {
                $elem46 = null;
                $elem46 = new \metastore\PrivilegeGrantInfo();
                $xfer += $elem46->read($input);
                $val40 []= $elem46;
              }
              $xfer += $input->readListEnd();
              $this->groupPrivileges[$key39] = $val40;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::MAP) {
            $this->rolePrivileges = array();
            $_size47 = 0;
            $_ktype48 = 0;
            $_vtype49 = 0;
            $xfer += $input->readMapBegin($_ktype48, $_vtype49, $_size47);
            for ($_i51 = 0; $_i51 < $_size47; ++$_i51)
            {
              $key52 = '';
              $val53 = array();
              $xfer += $input->readString($key52);
              $val53 = array();
              $_size54 = 0;
              $_etype57 = 0;
              $xfer += $input->readListBegin($_etype57, $_size54);
              for ($_i58 = 0; $_i58 < $_size54; ++$_i58)
              {
                $elem59 = null;
                $elem59 = new \metastore\PrivilegeGrantInfo();
                $xfer += $elem59->read($input);
                $val53 []= $elem59;
              }
              $xfer += $input->readListEnd();
              $this->rolePrivileges[$key52] = $val53;
            }
            $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('PrincipalPrivilegeSet');
    if ($this->userPrivileges !== null) {
      if (!is_array($this->userPrivileges)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('userPrivileges', TType::MAP, 1);
      {
        $output->writeMapBegin(TType::STRING, TType::LST, count($this->userPrivileges));
        {
          foreach ($this->userPrivileges as $kiter60 => $viter61)
          {
            $xfer += $output->writeString($kiter60);
            {
              $output->writeListBegin(TType::STRUCT, count($viter61));
              {
                foreach ($viter61 as $iter62)
                {
                  $xfer += $iter62->write($output);
                }
              }
              $output->writeListEnd();
            }
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->groupPrivileges !== null) {
      if (!is_array($this->groupPrivileges)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('groupPrivileges', TType::MAP, 2);
      {
        $output->writeMapBegin(TType::STRING, TType::LST, count($this->groupPrivileges));
        {
          foreach ($this->groupPrivileges as $kiter63 => $viter64)
          {
            $xfer += $output->writeString($kiter63);
            {
              $output->writeListBegin(TType::STRUCT, count($viter64));
              {
                foreach ($viter64 as $iter65)
                {
                  $xfer += $iter65->write($output);
                }
              }
              $output->writeListEnd();
            }
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->rolePrivileges !== null) {
      if (!is_array($this->rolePrivileges)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('rolePrivileges', TType::MAP, 3);
      {
        $output->writeMapBegin(TType::STRING, TType::LST, count($this->rolePrivileges));
        {
          foreach ($this->rolePrivileges as $kiter66 => $viter67)
          {
            $xfer += $output->writeString($kiter66);
            {
              $output->writeListBegin(TType::STRUCT, count($viter67));
              {
                foreach ($viter67 as $iter68)
                {
                  $xfer += $iter68->write($output);
                }
              }
              $output->writeListEnd();
            }
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GrantRevokePrivilegeRequest {
  static $_TSPEC;

  /**
   * @var int
   */
  public $requestType = null;
  /**
   * @var \metastore\PrivilegeBag
   */
  public $privileges = null;
  /**
   * @var bool
   */
  public $revokeGrantOption = null;

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

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

  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->requestType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->privileges = new \metastore\PrivilegeBag();
            $xfer += $this->privileges->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->revokeGrantOption);
          } 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('GrantRevokePrivilegeRequest');
    if ($this->requestType !== null) {
      $xfer += $output->writeFieldBegin('requestType', TType::I32, 1);
      $xfer += $output->writeI32($this->requestType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->privileges !== null) {
      if (!is_object($this->privileges)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('privileges', TType::STRUCT, 2);
      $xfer += $this->privileges->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->revokeGrantOption !== null) {
      $xfer += $output->writeFieldBegin('revokeGrantOption', TType::BOOL, 3);
      $xfer += $output->writeBool($this->revokeGrantOption);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GrantRevokePrivilegeResponse {
  static $_TSPEC;

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

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

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

  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->success);
          } 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('GrantRevokePrivilegeResponse');
    if ($this->success !== null) {
      $xfer += $output->writeFieldBegin('success', TType::BOOL, 1);
      $xfer += $output->writeBool($this->success);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Role {
  static $_TSPEC;

  /**
   * @var string
   */
  public $roleName = null;
  /**
   * @var int
   */
  public $createTime = null;
  /**
   * @var string
   */
  public $ownerName = null;

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

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

  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->roleName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->createTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->ownerName);
          } 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('Role');
    if ($this->roleName !== null) {
      $xfer += $output->writeFieldBegin('roleName', TType::STRING, 1);
      $xfer += $output->writeString($this->roleName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createTime !== null) {
      $xfer += $output->writeFieldBegin('createTime', TType::I32, 2);
      $xfer += $output->writeI32($this->createTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ownerName !== null) {
      $xfer += $output->writeFieldBegin('ownerName', TType::STRING, 3);
      $xfer += $output->writeString($this->ownerName);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class RolePrincipalGrant {
  static $_TSPEC;

  /**
   * @var string
   */
  public $roleName = null;
  /**
   * @var string
   */
  public $principalName = null;
  /**
   * @var int
   */
  public $principalType = null;
  /**
   * @var bool
   */
  public $grantOption = null;
  /**
   * @var int
   */
  public $grantTime = null;
  /**
   * @var string
   */
  public $grantorName = null;
  /**
   * @var int
   */
  public $grantorPrincipalType = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'roleName',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'principalName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'principalType',
          'type' => TType::I32,
          ),
        4 => array(
          'var' => 'grantOption',
          'type' => TType::BOOL,
          ),
        5 => array(
          'var' => 'grantTime',
          'type' => TType::I32,
          ),
        6 => array(
          'var' => 'grantorName',
          'type' => TType::STRING,
          ),
        7 => array(
          'var' => 'grantorPrincipalType',
          'type' => TType::I32,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['roleName'])) {
        $this->roleName = $vals['roleName'];
      }
      if (isset($vals['principalName'])) {
        $this->principalName = $vals['principalName'];
      }
      if (isset($vals['principalType'])) {
        $this->principalType = $vals['principalType'];
      }
      if (isset($vals['grantOption'])) {
        $this->grantOption = $vals['grantOption'];
      }
      if (isset($vals['grantTime'])) {
        $this->grantTime = $vals['grantTime'];
      }
      if (isset($vals['grantorName'])) {
        $this->grantorName = $vals['grantorName'];
      }
      if (isset($vals['grantorPrincipalType'])) {
        $this->grantorPrincipalType = $vals['grantorPrincipalType'];
      }
    }
  }

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

  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->roleName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->principalName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->principalType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->grantOption);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->grantTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->grantorName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->grantorPrincipalType);
          } 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('RolePrincipalGrant');
    if ($this->roleName !== null) {
      $xfer += $output->writeFieldBegin('roleName', TType::STRING, 1);
      $xfer += $output->writeString($this->roleName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->principalName !== null) {
      $xfer += $output->writeFieldBegin('principalName', TType::STRING, 2);
      $xfer += $output->writeString($this->principalName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->principalType !== null) {
      $xfer += $output->writeFieldBegin('principalType', TType::I32, 3);
      $xfer += $output->writeI32($this->principalType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->grantOption !== null) {
      $xfer += $output->writeFieldBegin('grantOption', TType::BOOL, 4);
      $xfer += $output->writeBool($this->grantOption);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->grantTime !== null) {
      $xfer += $output->writeFieldBegin('grantTime', TType::I32, 5);
      $xfer += $output->writeI32($this->grantTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->grantorName !== null) {
      $xfer += $output->writeFieldBegin('grantorName', TType::STRING, 6);
      $xfer += $output->writeString($this->grantorName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->grantorPrincipalType !== null) {
      $xfer += $output->writeFieldBegin('grantorPrincipalType', TType::I32, 7);
      $xfer += $output->writeI32($this->grantorPrincipalType);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GetRoleGrantsForPrincipalRequest {
  static $_TSPEC;

  /**
   * @var string
   */
  public $principal_name = null;
  /**
   * @var int
   */
  public $principal_type = null;

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

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

  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->principal_name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->principal_type);
          } 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('GetRoleGrantsForPrincipalRequest');
    if ($this->principal_name !== null) {
      $xfer += $output->writeFieldBegin('principal_name', TType::STRING, 1);
      $xfer += $output->writeString($this->principal_name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->principal_type !== null) {
      $xfer += $output->writeFieldBegin('principal_type', TType::I32, 2);
      $xfer += $output->writeI32($this->principal_type);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GetRoleGrantsForPrincipalResponse {
  static $_TSPEC;

  /**
   * @var \metastore\RolePrincipalGrant[]
   */
  public $principalGrants = null;

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

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

  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->principalGrants = array();
            $_size69 = 0;
            $_etype72 = 0;
            $xfer += $input->readListBegin($_etype72, $_size69);
            for ($_i73 = 0; $_i73 < $_size69; ++$_i73)
            {
              $elem74 = null;
              $elem74 = new \metastore\RolePrincipalGrant();
              $xfer += $elem74->read($input);
              $this->principalGrants []= $elem74;
            }
            $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('GetRoleGrantsForPrincipalResponse');
    if ($this->principalGrants !== null) {
      if (!is_array($this->principalGrants)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('principalGrants', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->principalGrants));
        {
          foreach ($this->principalGrants as $iter75)
          {
            $xfer += $iter75->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GetPrincipalsInRoleRequest {
  static $_TSPEC;

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

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

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

  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->roleName);
          } 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('GetPrincipalsInRoleRequest');
    if ($this->roleName !== null) {
      $xfer += $output->writeFieldBegin('roleName', TType::STRING, 1);
      $xfer += $output->writeString($this->roleName);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GetPrincipalsInRoleResponse {
  static $_TSPEC;

  /**
   * @var \metastore\RolePrincipalGrant[]
   */
  public $principalGrants = null;

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

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

  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->principalGrants = array();
            $_size76 = 0;
            $_etype79 = 0;
            $xfer += $input->readListBegin($_etype79, $_size76);
            for ($_i80 = 0; $_i80 < $_size76; ++$_i80)
            {
              $elem81 = null;
              $elem81 = new \metastore\RolePrincipalGrant();
              $xfer += $elem81->read($input);
              $this->principalGrants []= $elem81;
            }
            $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('GetPrincipalsInRoleResponse');
    if ($this->principalGrants !== null) {
      if (!is_array($this->principalGrants)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('principalGrants', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->principalGrants));
        {
          foreach ($this->principalGrants as $iter82)
          {
            $xfer += $iter82->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GrantRevokeRoleRequest {
  static $_TSPEC;

  /**
   * @var int
   */
  public $requestType = null;
  /**
   * @var string
   */
  public $roleName = null;
  /**
   * @var string
   */
  public $principalName = null;
  /**
   * @var int
   */
  public $principalType = null;
  /**
   * @var string
   */
  public $grantor = null;
  /**
   * @var int
   */
  public $grantorType = null;
  /**
   * @var bool
   */
  public $grantOption = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'requestType',
          'type' => TType::I32,
          ),
        2 => array(
          'var' => 'roleName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'principalName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'principalType',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'grantor',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'grantorType',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'grantOption',
          'type' => TType::BOOL,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['requestType'])) {
        $this->requestType = $vals['requestType'];
      }
      if (isset($vals['roleName'])) {
        $this->roleName = $vals['roleName'];
      }
      if (isset($vals['principalName'])) {
        $this->principalName = $vals['principalName'];
      }
      if (isset($vals['principalType'])) {
        $this->principalType = $vals['principalType'];
      }
      if (isset($vals['grantor'])) {
        $this->grantor = $vals['grantor'];
      }
      if (isset($vals['grantorType'])) {
        $this->grantorType = $vals['grantorType'];
      }
      if (isset($vals['grantOption'])) {
        $this->grantOption = $vals['grantOption'];
      }
    }
  }

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

  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->requestType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->roleName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->principalName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->principalType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->grantor);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->grantorType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->grantOption);
          } 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('GrantRevokeRoleRequest');
    if ($this->requestType !== null) {
      $xfer += $output->writeFieldBegin('requestType', TType::I32, 1);
      $xfer += $output->writeI32($this->requestType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->roleName !== null) {
      $xfer += $output->writeFieldBegin('roleName', TType::STRING, 2);
      $xfer += $output->writeString($this->roleName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->principalName !== null) {
      $xfer += $output->writeFieldBegin('principalName', TType::STRING, 3);
      $xfer += $output->writeString($this->principalName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->principalType !== null) {
      $xfer += $output->writeFieldBegin('principalType', TType::I32, 4);
      $xfer += $output->writeI32($this->principalType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->grantor !== null) {
      $xfer += $output->writeFieldBegin('grantor', TType::STRING, 5);
      $xfer += $output->writeString($this->grantor);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->grantorType !== null) {
      $xfer += $output->writeFieldBegin('grantorType', TType::I32, 6);
      $xfer += $output->writeI32($this->grantorType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->grantOption !== null) {
      $xfer += $output->writeFieldBegin('grantOption', TType::BOOL, 7);
      $xfer += $output->writeBool($this->grantOption);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GrantRevokeRoleResponse {
  static $_TSPEC;

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

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

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

  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->success);
          } 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('GrantRevokeRoleResponse');
    if ($this->success !== null) {
      $xfer += $output->writeFieldBegin('success', TType::BOOL, 1);
      $xfer += $output->writeBool($this->success);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Database {
  static $_TSPEC;

  /**
   * @var string
   */
  public $name = null;
  /**
   * @var string
   */
  public $description = null;
  /**
   * @var string
   */
  public $locationUri = null;
  /**
   * @var array
   */
  public $parameters = null;
  /**
   * @var \metastore\PrincipalPrivilegeSet
   */
  public $privileges = null;
  /**
   * @var string
   */
  public $ownerName = null;
  /**
   * @var int
   */
  public $ownerType = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'name',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'description',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'locationUri',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'parameters',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::STRING,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::STRING,
            ),
          ),
        5 => array(
          'var' => 'privileges',
          'type' => TType::STRUCT,
          'class' => '\metastore\PrincipalPrivilegeSet',
          ),
        6 => array(
          'var' => 'ownerName',
          'type' => TType::STRING,
          ),
        7 => array(
          'var' => 'ownerType',
          'type' => TType::I32,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['name'])) {
        $this->name = $vals['name'];
      }
      if (isset($vals['description'])) {
        $this->description = $vals['description'];
      }
      if (isset($vals['locationUri'])) {
        $this->locationUri = $vals['locationUri'];
      }
      if (isset($vals['parameters'])) {
        $this->parameters = $vals['parameters'];
      }
      if (isset($vals['privileges'])) {
        $this->privileges = $vals['privileges'];
      }
      if (isset($vals['ownerName'])) {
        $this->ownerName = $vals['ownerName'];
      }
      if (isset($vals['ownerType'])) {
        $this->ownerType = $vals['ownerType'];
      }
    }
  }

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

  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->name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->description);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->locationUri);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::MAP) {
            $this->parameters = array();
            $_size83 = 0;
            $_ktype84 = 0;
            $_vtype85 = 0;
            $xfer += $input->readMapBegin($_ktype84, $_vtype85, $_size83);
            for ($_i87 = 0; $_i87 < $_size83; ++$_i87)
            {
              $key88 = '';
              $val89 = '';
              $xfer += $input->readString($key88);
              $xfer += $input->readString($val89);
              $this->parameters[$key88] = $val89;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRUCT) {
            $this->privileges = new \metastore\PrincipalPrivilegeSet();
            $xfer += $this->privileges->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->ownerName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->ownerType);
          } 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('Database');
    if ($this->name !== null) {
      $xfer += $output->writeFieldBegin('name', TType::STRING, 1);
      $xfer += $output->writeString($this->name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->description !== null) {
      $xfer += $output->writeFieldBegin('description', TType::STRING, 2);
      $xfer += $output->writeString($this->description);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->locationUri !== null) {
      $xfer += $output->writeFieldBegin('locationUri', TType::STRING, 3);
      $xfer += $output->writeString($this->locationUri);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parameters !== null) {
      if (!is_array($this->parameters)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('parameters', TType::MAP, 4);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->parameters));
        {
          foreach ($this->parameters as $kiter90 => $viter91)
          {
            $xfer += $output->writeString($kiter90);
            $xfer += $output->writeString($viter91);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->privileges !== null) {
      if (!is_object($this->privileges)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('privileges', TType::STRUCT, 5);
      $xfer += $this->privileges->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ownerName !== null) {
      $xfer += $output->writeFieldBegin('ownerName', TType::STRING, 6);
      $xfer += $output->writeString($this->ownerName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ownerType !== null) {
      $xfer += $output->writeFieldBegin('ownerType', TType::I32, 7);
      $xfer += $output->writeI32($this->ownerType);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class SerDeInfo {
  static $_TSPEC;

  /**
   * @var string
   */
  public $name = null;
  /**
   * @var string
   */
  public $serializationLib = null;
  /**
   * @var array
   */
  public $parameters = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'name',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'serializationLib',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'parameters',
          '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['name'])) {
        $this->name = $vals['name'];
      }
      if (isset($vals['serializationLib'])) {
        $this->serializationLib = $vals['serializationLib'];
      }
      if (isset($vals['parameters'])) {
        $this->parameters = $vals['parameters'];
      }
    }
  }

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

  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->name);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->serializationLib);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::MAP) {
            $this->parameters = array();
            $_size92 = 0;
            $_ktype93 = 0;
            $_vtype94 = 0;
            $xfer += $input->readMapBegin($_ktype93, $_vtype94, $_size92);
            for ($_i96 = 0; $_i96 < $_size92; ++$_i96)
            {
              $key97 = '';
              $val98 = '';
              $xfer += $input->readString($key97);
              $xfer += $input->readString($val98);
              $this->parameters[$key97] = $val98;
            }
            $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('SerDeInfo');
    if ($this->name !== null) {
      $xfer += $output->writeFieldBegin('name', TType::STRING, 1);
      $xfer += $output->writeString($this->name);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->serializationLib !== null) {
      $xfer += $output->writeFieldBegin('serializationLib', TType::STRING, 2);
      $xfer += $output->writeString($this->serializationLib);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parameters !== null) {
      if (!is_array($this->parameters)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('parameters', TType::MAP, 3);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->parameters));
        {
          foreach ($this->parameters as $kiter99 => $viter100)
          {
            $xfer += $output->writeString($kiter99);
            $xfer += $output->writeString($viter100);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Order {
  static $_TSPEC;

  /**
   * @var string
   */
  public $col = null;
  /**
   * @var int
   */
  public $order = null;

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

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

  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->col);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->order);
          } 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('Order');
    if ($this->col !== null) {
      $xfer += $output->writeFieldBegin('col', TType::STRING, 1);
      $xfer += $output->writeString($this->col);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->order !== null) {
      $xfer += $output->writeFieldBegin('order', TType::I32, 2);
      $xfer += $output->writeI32($this->order);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class SkewedInfo {
  static $_TSPEC;

  /**
   * @var string[]
   */
  public $skewedColNames = null;
  /**
   * @var (string[])[]
   */
  public $skewedColValues = null;
  /**
   * @var array
   */
  public $skewedColValueLocationMaps = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'skewedColNames',
          'type' => TType::LST,
          'etype' => TType::STRING,
          'elem' => array(
            'type' => TType::STRING,
            ),
          ),
        2 => array(
          'var' => 'skewedColValues',
          'type' => TType::LST,
          'etype' => TType::LST,
          'elem' => array(
            'type' => TType::LST,
            'etype' => TType::STRING,
            'elem' => array(
              'type' => TType::STRING,
              ),
            ),
          ),
        3 => array(
          'var' => 'skewedColValueLocationMaps',
          'type' => TType::MAP,
          'ktype' => TType::LST,
          'vtype' => TType::STRING,
          'key' => array(
            'type' => TType::LST,
            'etype' => TType::STRING,
            'elem' => array(
              'type' => TType::STRING,
              ),
          ),
          'val' => array(
            'type' => TType::STRING,
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['skewedColNames'])) {
        $this->skewedColNames = $vals['skewedColNames'];
      }
      if (isset($vals['skewedColValues'])) {
        $this->skewedColValues = $vals['skewedColValues'];
      }
      if (isset($vals['skewedColValueLocationMaps'])) {
        $this->skewedColValueLocationMaps = $vals['skewedColValueLocationMaps'];
      }
    }
  }

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

  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->skewedColNames = array();
            $_size101 = 0;
            $_etype104 = 0;
            $xfer += $input->readListBegin($_etype104, $_size101);
            for ($_i105 = 0; $_i105 < $_size101; ++$_i105)
            {
              $elem106 = null;
              $xfer += $input->readString($elem106);
              $this->skewedColNames []= $elem106;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::LST) {
            $this->skewedColValues = array();
            $_size107 = 0;
            $_etype110 = 0;
            $xfer += $input->readListBegin($_etype110, $_size107);
            for ($_i111 = 0; $_i111 < $_size107; ++$_i111)
            {
              $elem112 = null;
              $elem112 = array();
              $_size113 = 0;
              $_etype116 = 0;
              $xfer += $input->readListBegin($_etype116, $_size113);
              for ($_i117 = 0; $_i117 < $_size113; ++$_i117)
              {
                $elem118 = null;
                $xfer += $input->readString($elem118);
                $elem112 []= $elem118;
              }
              $xfer += $input->readListEnd();
              $this->skewedColValues []= $elem112;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::MAP) {
            $this->skewedColValueLocationMaps = array();
            $_size119 = 0;
            $_ktype120 = 0;
            $_vtype121 = 0;
            $xfer += $input->readMapBegin($_ktype120, $_vtype121, $_size119);
            for ($_i123 = 0; $_i123 < $_size119; ++$_i123)
            {
              $key124 = array();
              $val125 = '';
              $key124 = array();
              $_size126 = 0;
              $_etype129 = 0;
              $xfer += $input->readListBegin($_etype129, $_size126);
              for ($_i130 = 0; $_i130 < $_size126; ++$_i130)
              {
                $elem131 = null;
                $xfer += $input->readString($elem131);
                $key124 []= $elem131;
              }
              $xfer += $input->readListEnd();
              $xfer += $input->readString($val125);
              $this->skewedColValueLocationMaps[$key124] = $val125;
            }
            $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('SkewedInfo');
    if ($this->skewedColNames !== null) {
      if (!is_array($this->skewedColNames)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('skewedColNames', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRING, count($this->skewedColNames));
        {
          foreach ($this->skewedColNames as $iter132)
          {
            $xfer += $output->writeString($iter132);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->skewedColValues !== null) {
      if (!is_array($this->skewedColValues)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('skewedColValues', TType::LST, 2);
      {
        $output->writeListBegin(TType::LST, count($this->skewedColValues));
        {
          foreach ($this->skewedColValues as $iter133)
          {
            {
              $output->writeListBegin(TType::STRING, count($iter133));
              {
                foreach ($iter133 as $iter134)
                {
                  $xfer += $output->writeString($iter134);
                }
              }
              $output->writeListEnd();
            }
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->skewedColValueLocationMaps !== null) {
      if (!is_array($this->skewedColValueLocationMaps)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('skewedColValueLocationMaps', TType::MAP, 3);
      {
        $output->writeMapBegin(TType::LST, TType::STRING, count($this->skewedColValueLocationMaps));
        {
          foreach ($this->skewedColValueLocationMaps as $kiter135 => $viter136)
          {
            {
              $output->writeListBegin(TType::STRING, count($kiter135));
              {
                foreach ($kiter135 as $iter137)
                {
                  $xfer += $output->writeString($iter137);
                }
              }
              $output->writeListEnd();
            }
            $xfer += $output->writeString($viter136);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class StorageDescriptor {
  static $_TSPEC;

  /**
   * @var \metastore\FieldSchema[]
   */
  public $cols = null;
  /**
   * @var string
   */
  public $location = null;
  /**
   * @var string
   */
  public $inputFormat = null;
  /**
   * @var string
   */
  public $outputFormat = null;
  /**
   * @var bool
   */
  public $compressed = null;
  /**
   * @var int
   */
  public $numBuckets = null;
  /**
   * @var \metastore\SerDeInfo
   */
  public $serdeInfo = null;
  /**
   * @var string[]
   */
  public $bucketCols = null;
  /**
   * @var \metastore\Order[]
   */
  public $sortCols = null;
  /**
   * @var array
   */
  public $parameters = null;
  /**
   * @var \metastore\SkewedInfo
   */
  public $skewedInfo = null;
  /**
   * @var bool
   */
  public $storedAsSubDirectories = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'cols',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\metastore\FieldSchema',
            ),
          ),
        2 => array(
          'var' => 'location',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'inputFormat',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'outputFormat',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'compressed',
          'type' => TType::BOOL,
          ),
        6 => array(
          'var' => 'numBuckets',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'serdeInfo',
          'type' => TType::STRUCT,
          'class' => '\metastore\SerDeInfo',
          ),
        8 => array(
          'var' => 'bucketCols',
          'type' => TType::LST,
          'etype' => TType::STRING,
          'elem' => array(
            'type' => TType::STRING,
            ),
          ),
        9 => array(
          'var' => 'sortCols',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\metastore\Order',
            ),
          ),
        10 => array(
          'var' => 'parameters',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::STRING,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::STRING,
            ),
          ),
        11 => array(
          'var' => 'skewedInfo',
          'type' => TType::STRUCT,
          'class' => '\metastore\SkewedInfo',
          ),
        12 => array(
          'var' => 'storedAsSubDirectories',
          'type' => TType::BOOL,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['cols'])) {
        $this->cols = $vals['cols'];
      }
      if (isset($vals['location'])) {
        $this->location = $vals['location'];
      }
      if (isset($vals['inputFormat'])) {
        $this->inputFormat = $vals['inputFormat'];
      }
      if (isset($vals['outputFormat'])) {
        $this->outputFormat = $vals['outputFormat'];
      }
      if (isset($vals['compressed'])) {
        $this->compressed = $vals['compressed'];
      }
      if (isset($vals['numBuckets'])) {
        $this->numBuckets = $vals['numBuckets'];
      }
      if (isset($vals['serdeInfo'])) {
        $this->serdeInfo = $vals['serdeInfo'];
      }
      if (isset($vals['bucketCols'])) {
        $this->bucketCols = $vals['bucketCols'];
      }
      if (isset($vals['sortCols'])) {
        $this->sortCols = $vals['sortCols'];
      }
      if (isset($vals['parameters'])) {
        $this->parameters = $vals['parameters'];
      }
      if (isset($vals['skewedInfo'])) {
        $this->skewedInfo = $vals['skewedInfo'];
      }
      if (isset($vals['storedAsSubDirectories'])) {
        $this->storedAsSubDirectories = $vals['storedAsSubDirectories'];
      }
    }
  }

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

  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->cols = array();
            $_size138 = 0;
            $_etype141 = 0;
            $xfer += $input->readListBegin($_etype141, $_size138);
            for ($_i142 = 0; $_i142 < $_size138; ++$_i142)
            {
              $elem143 = null;
              $elem143 = new \metastore\FieldSchema();
              $xfer += $elem143->read($input);
              $this->cols []= $elem143;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->location);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->inputFormat);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->outputFormat);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->compressed);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->numBuckets);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRUCT) {
            $this->serdeInfo = new \metastore\SerDeInfo();
            $xfer += $this->serdeInfo->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::LST) {
            $this->bucketCols = array();
            $_size144 = 0;
            $_etype147 = 0;
            $xfer += $input->readListBegin($_etype147, $_size144);
            for ($_i148 = 0; $_i148 < $_size144; ++$_i148)
            {
              $elem149 = null;
              $xfer += $input->readString($elem149);
              $this->bucketCols []= $elem149;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::LST) {
            $this->sortCols = array();
            $_size150 = 0;
            $_etype153 = 0;
            $xfer += $input->readListBegin($_etype153, $_size150);
            for ($_i154 = 0; $_i154 < $_size150; ++$_i154)
            {
              $elem155 = null;
              $elem155 = new \metastore\Order();
              $xfer += $elem155->read($input);
              $this->sortCols []= $elem155;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::MAP) {
            $this->parameters = array();
            $_size156 = 0;
            $_ktype157 = 0;
            $_vtype158 = 0;
            $xfer += $input->readMapBegin($_ktype157, $_vtype158, $_size156);
            for ($_i160 = 0; $_i160 < $_size156; ++$_i160)
            {
              $key161 = '';
              $val162 = '';
              $xfer += $input->readString($key161);
              $xfer += $input->readString($val162);
              $this->parameters[$key161] = $val162;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 11:
          if ($ftype == TType::STRUCT) {
            $this->skewedInfo = new \metastore\SkewedInfo();
            $xfer += $this->skewedInfo->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 12:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->storedAsSubDirectories);
          } 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('StorageDescriptor');
    if ($this->cols !== null) {
      if (!is_array($this->cols)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('cols', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->cols));
        {
          foreach ($this->cols as $iter163)
          {
            $xfer += $iter163->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->location !== null) {
      $xfer += $output->writeFieldBegin('location', TType::STRING, 2);
      $xfer += $output->writeString($this->location);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->inputFormat !== null) {
      $xfer += $output->writeFieldBegin('inputFormat', TType::STRING, 3);
      $xfer += $output->writeString($this->inputFormat);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->outputFormat !== null) {
      $xfer += $output->writeFieldBegin('outputFormat', TType::STRING, 4);
      $xfer += $output->writeString($this->outputFormat);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->compressed !== null) {
      $xfer += $output->writeFieldBegin('compressed', TType::BOOL, 5);
      $xfer += $output->writeBool($this->compressed);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numBuckets !== null) {
      $xfer += $output->writeFieldBegin('numBuckets', TType::I32, 6);
      $xfer += $output->writeI32($this->numBuckets);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->serdeInfo !== null) {
      if (!is_object($this->serdeInfo)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('serdeInfo', TType::STRUCT, 7);
      $xfer += $this->serdeInfo->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->bucketCols !== null) {
      if (!is_array($this->bucketCols)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('bucketCols', TType::LST, 8);
      {
        $output->writeListBegin(TType::STRING, count($this->bucketCols));
        {
          foreach ($this->bucketCols as $iter164)
          {
            $xfer += $output->writeString($iter164);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sortCols !== null) {
      if (!is_array($this->sortCols)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sortCols', TType::LST, 9);
      {
        $output->writeListBegin(TType::STRUCT, count($this->sortCols));
        {
          foreach ($this->sortCols as $iter165)
          {
            $xfer += $iter165->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parameters !== null) {
      if (!is_array($this->parameters)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('parameters', TType::MAP, 10);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->parameters));
        {
          foreach ($this->parameters as $kiter166 => $viter167)
          {
            $xfer += $output->writeString($kiter166);
            $xfer += $output->writeString($viter167);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->skewedInfo !== null) {
      if (!is_object($this->skewedInfo)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('skewedInfo', TType::STRUCT, 11);
      $xfer += $this->skewedInfo->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->storedAsSubDirectories !== null) {
      $xfer += $output->writeFieldBegin('storedAsSubDirectories', TType::BOOL, 12);
      $xfer += $output->writeBool($this->storedAsSubDirectories);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Table {
  static $_TSPEC;

  /**
   * @var string
   */
  public $tableName = null;
  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $owner = null;
  /**
   * @var int
   */
  public $createTime = null;
  /**
   * @var int
   */
  public $lastAccessTime = null;
  /**
   * @var int
   */
  public $retention = null;
  /**
   * @var \metastore\StorageDescriptor
   */
  public $sd = null;
  /**
   * @var \metastore\FieldSchema[]
   */
  public $partitionKeys = null;
  /**
   * @var array
   */
  public $parameters = null;
  /**
   * @var string
   */
  public $viewOriginalText = null;
  /**
   * @var string
   */
  public $viewExpandedText = null;
  /**
   * @var string
   */
  public $tableType = null;
  /**
   * @var \metastore\PrincipalPrivilegeSet
   */
  public $privileges = null;
  /**
   * @var bool
   */
  public $temporary = false;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'tableName',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'dbName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'owner',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'createTime',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'lastAccessTime',
          'type' => TType::I32,
          ),
        6 => array(
          'var' => 'retention',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'sd',
          'type' => TType::STRUCT,
          'class' => '\metastore\StorageDescriptor',
          ),
        8 => array(
          'var' => 'partitionKeys',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\metastore\FieldSchema',
            ),
          ),
        9 => array(
          'var' => 'parameters',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::STRING,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::STRING,
            ),
          ),
        10 => array(
          'var' => 'viewOriginalText',
          'type' => TType::STRING,
          ),
        11 => array(
          'var' => 'viewExpandedText',
          'type' => TType::STRING,
          ),
        12 => array(
          'var' => 'tableType',
          'type' => TType::STRING,
          ),
        13 => array(
          'var' => 'privileges',
          'type' => TType::STRUCT,
          'class' => '\metastore\PrincipalPrivilegeSet',
          ),
        14 => array(
          'var' => 'temporary',
          'type' => TType::BOOL,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['tableName'])) {
        $this->tableName = $vals['tableName'];
      }
      if (isset($vals['dbName'])) {
        $this->dbName = $vals['dbName'];
      }
      if (isset($vals['owner'])) {
        $this->owner = $vals['owner'];
      }
      if (isset($vals['createTime'])) {
        $this->createTime = $vals['createTime'];
      }
      if (isset($vals['lastAccessTime'])) {
        $this->lastAccessTime = $vals['lastAccessTime'];
      }
      if (isset($vals['retention'])) {
        $this->retention = $vals['retention'];
      }
      if (isset($vals['sd'])) {
        $this->sd = $vals['sd'];
      }
      if (isset($vals['partitionKeys'])) {
        $this->partitionKeys = $vals['partitionKeys'];
      }
      if (isset($vals['parameters'])) {
        $this->parameters = $vals['parameters'];
      }
      if (isset($vals['viewOriginalText'])) {
        $this->viewOriginalText = $vals['viewOriginalText'];
      }
      if (isset($vals['viewExpandedText'])) {
        $this->viewExpandedText = $vals['viewExpandedText'];
      }
      if (isset($vals['tableType'])) {
        $this->tableType = $vals['tableType'];
      }
      if (isset($vals['privileges'])) {
        $this->privileges = $vals['privileges'];
      }
      if (isset($vals['temporary'])) {
        $this->temporary = $vals['temporary'];
      }
    }
  }

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

  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->tableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->owner);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->createTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->lastAccessTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->retention);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRUCT) {
            $this->sd = new \metastore\StorageDescriptor();
            $xfer += $this->sd->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::LST) {
            $this->partitionKeys = array();
            $_size168 = 0;
            $_etype171 = 0;
            $xfer += $input->readListBegin($_etype171, $_size168);
            for ($_i172 = 0; $_i172 < $_size168; ++$_i172)
            {
              $elem173 = null;
              $elem173 = new \metastore\FieldSchema();
              $xfer += $elem173->read($input);
              $this->partitionKeys []= $elem173;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::MAP) {
            $this->parameters = array();
            $_size174 = 0;
            $_ktype175 = 0;
            $_vtype176 = 0;
            $xfer += $input->readMapBegin($_ktype175, $_vtype176, $_size174);
            for ($_i178 = 0; $_i178 < $_size174; ++$_i178)
            {
              $key179 = '';
              $val180 = '';
              $xfer += $input->readString($key179);
              $xfer += $input->readString($val180);
              $this->parameters[$key179] = $val180;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->viewOriginalText);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 11:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->viewExpandedText);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 12:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tableType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 13:
          if ($ftype == TType::STRUCT) {
            $this->privileges = new \metastore\PrincipalPrivilegeSet();
            $xfer += $this->privileges->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 14:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->temporary);
          } 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('Table');
    if ($this->tableName !== null) {
      $xfer += $output->writeFieldBegin('tableName', TType::STRING, 1);
      $xfer += $output->writeString($this->tableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 2);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->owner !== null) {
      $xfer += $output->writeFieldBegin('owner', TType::STRING, 3);
      $xfer += $output->writeString($this->owner);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createTime !== null) {
      $xfer += $output->writeFieldBegin('createTime', TType::I32, 4);
      $xfer += $output->writeI32($this->createTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->lastAccessTime !== null) {
      $xfer += $output->writeFieldBegin('lastAccessTime', TType::I32, 5);
      $xfer += $output->writeI32($this->lastAccessTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->retention !== null) {
      $xfer += $output->writeFieldBegin('retention', TType::I32, 6);
      $xfer += $output->writeI32($this->retention);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sd !== null) {
      if (!is_object($this->sd)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sd', TType::STRUCT, 7);
      $xfer += $this->sd->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partitionKeys !== null) {
      if (!is_array($this->partitionKeys)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partitionKeys', TType::LST, 8);
      {
        $output->writeListBegin(TType::STRUCT, count($this->partitionKeys));
        {
          foreach ($this->partitionKeys as $iter181)
          {
            $xfer += $iter181->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parameters !== null) {
      if (!is_array($this->parameters)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('parameters', TType::MAP, 9);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->parameters));
        {
          foreach ($this->parameters as $kiter182 => $viter183)
          {
            $xfer += $output->writeString($kiter182);
            $xfer += $output->writeString($viter183);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->viewOriginalText !== null) {
      $xfer += $output->writeFieldBegin('viewOriginalText', TType::STRING, 10);
      $xfer += $output->writeString($this->viewOriginalText);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->viewExpandedText !== null) {
      $xfer += $output->writeFieldBegin('viewExpandedText', TType::STRING, 11);
      $xfer += $output->writeString($this->viewExpandedText);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableType !== null) {
      $xfer += $output->writeFieldBegin('tableType', TType::STRING, 12);
      $xfer += $output->writeString($this->tableType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->privileges !== null) {
      if (!is_object($this->privileges)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('privileges', TType::STRUCT, 13);
      $xfer += $this->privileges->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->temporary !== null) {
      $xfer += $output->writeFieldBegin('temporary', TType::BOOL, 14);
      $xfer += $output->writeBool($this->temporary);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Partition {
  static $_TSPEC;

  /**
   * @var string[]
   */
  public $values = null;
  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $tableName = null;
  /**
   * @var int
   */
  public $createTime = null;
  /**
   * @var int
   */
  public $lastAccessTime = null;
  /**
   * @var \metastore\StorageDescriptor
   */
  public $sd = null;
  /**
   * @var array
   */
  public $parameters = null;
  /**
   * @var \metastore\PrincipalPrivilegeSet
   */
  public $privileges = 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' => 'dbName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'tableName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'createTime',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'lastAccessTime',
          'type' => TType::I32,
          ),
        6 => array(
          'var' => 'sd',
          'type' => TType::STRUCT,
          'class' => '\metastore\StorageDescriptor',
          ),
        7 => array(
          'var' => 'parameters',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::STRING,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::STRING,
            ),
          ),
        8 => array(
          'var' => 'privileges',
          'type' => TType::STRUCT,
          'class' => '\metastore\PrincipalPrivilegeSet',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['values'])) {
        $this->values = $vals['values'];
      }
      if (isset($vals['dbName'])) {
        $this->dbName = $vals['dbName'];
      }
      if (isset($vals['tableName'])) {
        $this->tableName = $vals['tableName'];
      }
      if (isset($vals['createTime'])) {
        $this->createTime = $vals['createTime'];
      }
      if (isset($vals['lastAccessTime'])) {
        $this->lastAccessTime = $vals['lastAccessTime'];
      }
      if (isset($vals['sd'])) {
        $this->sd = $vals['sd'];
      }
      if (isset($vals['parameters'])) {
        $this->parameters = $vals['parameters'];
      }
      if (isset($vals['privileges'])) {
        $this->privileges = $vals['privileges'];
      }
    }
  }

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

  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();
            $_size184 = 0;
            $_etype187 = 0;
            $xfer += $input->readListBegin($_etype187, $_size184);
            for ($_i188 = 0; $_i188 < $_size184; ++$_i188)
            {
              $elem189 = null;
              $xfer += $input->readString($elem189);
              $this->values []= $elem189;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->createTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->lastAccessTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRUCT) {
            $this->sd = new \metastore\StorageDescriptor();
            $xfer += $this->sd->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::MAP) {
            $this->parameters = array();
            $_size190 = 0;
            $_ktype191 = 0;
            $_vtype192 = 0;
            $xfer += $input->readMapBegin($_ktype191, $_vtype192, $_size190);
            for ($_i194 = 0; $_i194 < $_size190; ++$_i194)
            {
              $key195 = '';
              $val196 = '';
              $xfer += $input->readString($key195);
              $xfer += $input->readString($val196);
              $this->parameters[$key195] = $val196;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::STRUCT) {
            $this->privileges = new \metastore\PrincipalPrivilegeSet();
            $xfer += $this->privileges->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('Partition');
    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 $iter197)
          {
            $xfer += $output->writeString($iter197);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 2);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableName !== null) {
      $xfer += $output->writeFieldBegin('tableName', TType::STRING, 3);
      $xfer += $output->writeString($this->tableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createTime !== null) {
      $xfer += $output->writeFieldBegin('createTime', TType::I32, 4);
      $xfer += $output->writeI32($this->createTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->lastAccessTime !== null) {
      $xfer += $output->writeFieldBegin('lastAccessTime', TType::I32, 5);
      $xfer += $output->writeI32($this->lastAccessTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sd !== null) {
      if (!is_object($this->sd)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sd', TType::STRUCT, 6);
      $xfer += $this->sd->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parameters !== null) {
      if (!is_array($this->parameters)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('parameters', TType::MAP, 7);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->parameters));
        {
          foreach ($this->parameters as $kiter198 => $viter199)
          {
            $xfer += $output->writeString($kiter198);
            $xfer += $output->writeString($viter199);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->privileges !== null) {
      if (!is_object($this->privileges)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('privileges', TType::STRUCT, 8);
      $xfer += $this->privileges->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PartitionWithoutSD {
  static $_TSPEC;

  /**
   * @var string[]
   */
  public $values = null;
  /**
   * @var int
   */
  public $createTime = null;
  /**
   * @var int
   */
  public $lastAccessTime = null;
  /**
   * @var string
   */
  public $relativePath = null;
  /**
   * @var array
   */
  public $parameters = null;
  /**
   * @var \metastore\PrincipalPrivilegeSet
   */
  public $privileges = 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' => 'createTime',
          'type' => TType::I32,
          ),
        3 => array(
          'var' => 'lastAccessTime',
          'type' => TType::I32,
          ),
        4 => array(
          'var' => 'relativePath',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'parameters',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::STRING,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::STRING,
            ),
          ),
        6 => array(
          'var' => 'privileges',
          'type' => TType::STRUCT,
          'class' => '\metastore\PrincipalPrivilegeSet',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['values'])) {
        $this->values = $vals['values'];
      }
      if (isset($vals['createTime'])) {
        $this->createTime = $vals['createTime'];
      }
      if (isset($vals['lastAccessTime'])) {
        $this->lastAccessTime = $vals['lastAccessTime'];
      }
      if (isset($vals['relativePath'])) {
        $this->relativePath = $vals['relativePath'];
      }
      if (isset($vals['parameters'])) {
        $this->parameters = $vals['parameters'];
      }
      if (isset($vals['privileges'])) {
        $this->privileges = $vals['privileges'];
      }
    }
  }

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

  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();
            $_size200 = 0;
            $_etype203 = 0;
            $xfer += $input->readListBegin($_etype203, $_size200);
            for ($_i204 = 0; $_i204 < $_size200; ++$_i204)
            {
              $elem205 = null;
              $xfer += $input->readString($elem205);
              $this->values []= $elem205;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->createTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->lastAccessTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->relativePath);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::MAP) {
            $this->parameters = array();
            $_size206 = 0;
            $_ktype207 = 0;
            $_vtype208 = 0;
            $xfer += $input->readMapBegin($_ktype207, $_vtype208, $_size206);
            for ($_i210 = 0; $_i210 < $_size206; ++$_i210)
            {
              $key211 = '';
              $val212 = '';
              $xfer += $input->readString($key211);
              $xfer += $input->readString($val212);
              $this->parameters[$key211] = $val212;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRUCT) {
            $this->privileges = new \metastore\PrincipalPrivilegeSet();
            $xfer += $this->privileges->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('PartitionWithoutSD');
    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 $iter213)
          {
            $xfer += $output->writeString($iter213);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createTime !== null) {
      $xfer += $output->writeFieldBegin('createTime', TType::I32, 2);
      $xfer += $output->writeI32($this->createTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->lastAccessTime !== null) {
      $xfer += $output->writeFieldBegin('lastAccessTime', TType::I32, 3);
      $xfer += $output->writeI32($this->lastAccessTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->relativePath !== null) {
      $xfer += $output->writeFieldBegin('relativePath', TType::STRING, 4);
      $xfer += $output->writeString($this->relativePath);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parameters !== null) {
      if (!is_array($this->parameters)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('parameters', TType::MAP, 5);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->parameters));
        {
          foreach ($this->parameters as $kiter214 => $viter215)
          {
            $xfer += $output->writeString($kiter214);
            $xfer += $output->writeString($viter215);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->privileges !== null) {
      if (!is_object($this->privileges)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('privileges', TType::STRUCT, 6);
      $xfer += $this->privileges->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PartitionSpecWithSharedSD {
  static $_TSPEC;

  /**
   * @var \metastore\PartitionWithoutSD[]
   */
  public $partitions = null;
  /**
   * @var \metastore\StorageDescriptor
   */
  public $sd = null;

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

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

  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->partitions = array();
            $_size216 = 0;
            $_etype219 = 0;
            $xfer += $input->readListBegin($_etype219, $_size216);
            for ($_i220 = 0; $_i220 < $_size216; ++$_i220)
            {
              $elem221 = null;
              $elem221 = new \metastore\PartitionWithoutSD();
              $xfer += $elem221->read($input);
              $this->partitions []= $elem221;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->sd = new \metastore\StorageDescriptor();
            $xfer += $this->sd->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('PartitionSpecWithSharedSD');
    if ($this->partitions !== null) {
      if (!is_array($this->partitions)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partitions', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->partitions));
        {
          foreach ($this->partitions as $iter222)
          {
            $xfer += $iter222->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sd !== null) {
      if (!is_object($this->sd)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sd', TType::STRUCT, 2);
      $xfer += $this->sd->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PartitionListComposingSpec {
  static $_TSPEC;

  /**
   * @var \metastore\Partition[]
   */
  public $partitions = null;

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

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

  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->partitions = array();
            $_size223 = 0;
            $_etype226 = 0;
            $xfer += $input->readListBegin($_etype226, $_size223);
            for ($_i227 = 0; $_i227 < $_size223; ++$_i227)
            {
              $elem228 = null;
              $elem228 = new \metastore\Partition();
              $xfer += $elem228->read($input);
              $this->partitions []= $elem228;
            }
            $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('PartitionListComposingSpec');
    if ($this->partitions !== null) {
      if (!is_array($this->partitions)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partitions', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->partitions));
        {
          foreach ($this->partitions as $iter229)
          {
            $xfer += $iter229->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PartitionSpec {
  static $_TSPEC;

  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $tableName = null;
  /**
   * @var string
   */
  public $rootPath = null;
  /**
   * @var \metastore\PartitionSpecWithSharedSD
   */
  public $sharedSDPartitionSpec = null;
  /**
   * @var \metastore\PartitionListComposingSpec
   */
  public $partitionList = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'dbName',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'tableName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'rootPath',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'sharedSDPartitionSpec',
          'type' => TType::STRUCT,
          'class' => '\metastore\PartitionSpecWithSharedSD',
          ),
        5 => array(
          'var' => 'partitionList',
          'type' => TType::STRUCT,
          'class' => '\metastore\PartitionListComposingSpec',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['dbName'])) {
        $this->dbName = $vals['dbName'];
      }
      if (isset($vals['tableName'])) {
        $this->tableName = $vals['tableName'];
      }
      if (isset($vals['rootPath'])) {
        $this->rootPath = $vals['rootPath'];
      }
      if (isset($vals['sharedSDPartitionSpec'])) {
        $this->sharedSDPartitionSpec = $vals['sharedSDPartitionSpec'];
      }
      if (isset($vals['partitionList'])) {
        $this->partitionList = $vals['partitionList'];
      }
    }
  }

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

  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->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->rootPath);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRUCT) {
            $this->sharedSDPartitionSpec = new \metastore\PartitionSpecWithSharedSD();
            $xfer += $this->sharedSDPartitionSpec->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRUCT) {
            $this->partitionList = new \metastore\PartitionListComposingSpec();
            $xfer += $this->partitionList->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('PartitionSpec');
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 1);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableName !== null) {
      $xfer += $output->writeFieldBegin('tableName', TType::STRING, 2);
      $xfer += $output->writeString($this->tableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->rootPath !== null) {
      $xfer += $output->writeFieldBegin('rootPath', TType::STRING, 3);
      $xfer += $output->writeString($this->rootPath);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sharedSDPartitionSpec !== null) {
      if (!is_object($this->sharedSDPartitionSpec)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sharedSDPartitionSpec', TType::STRUCT, 4);
      $xfer += $this->sharedSDPartitionSpec->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partitionList !== null) {
      if (!is_object($this->partitionList)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partitionList', TType::STRUCT, 5);
      $xfer += $this->partitionList->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Index {
  static $_TSPEC;

  /**
   * @var string
   */
  public $indexName = null;
  /**
   * @var string
   */
  public $indexHandlerClass = null;
  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $origTableName = null;
  /**
   * @var int
   */
  public $createTime = null;
  /**
   * @var int
   */
  public $lastAccessTime = null;
  /**
   * @var string
   */
  public $indexTableName = null;
  /**
   * @var \metastore\StorageDescriptor
   */
  public $sd = null;
  /**
   * @var array
   */
  public $parameters = null;
  /**
   * @var bool
   */
  public $deferredRebuild = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'indexName',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'indexHandlerClass',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'dbName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'origTableName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'createTime',
          'type' => TType::I32,
          ),
        6 => array(
          'var' => 'lastAccessTime',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'indexTableName',
          'type' => TType::STRING,
          ),
        8 => array(
          'var' => 'sd',
          'type' => TType::STRUCT,
          'class' => '\metastore\StorageDescriptor',
          ),
        9 => array(
          'var' => 'parameters',
          'type' => TType::MAP,
          'ktype' => TType::STRING,
          'vtype' => TType::STRING,
          'key' => array(
            'type' => TType::STRING,
          ),
          'val' => array(
            'type' => TType::STRING,
            ),
          ),
        10 => array(
          'var' => 'deferredRebuild',
          'type' => TType::BOOL,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['indexName'])) {
        $this->indexName = $vals['indexName'];
      }
      if (isset($vals['indexHandlerClass'])) {
        $this->indexHandlerClass = $vals['indexHandlerClass'];
      }
      if (isset($vals['dbName'])) {
        $this->dbName = $vals['dbName'];
      }
      if (isset($vals['origTableName'])) {
        $this->origTableName = $vals['origTableName'];
      }
      if (isset($vals['createTime'])) {
        $this->createTime = $vals['createTime'];
      }
      if (isset($vals['lastAccessTime'])) {
        $this->lastAccessTime = $vals['lastAccessTime'];
      }
      if (isset($vals['indexTableName'])) {
        $this->indexTableName = $vals['indexTableName'];
      }
      if (isset($vals['sd'])) {
        $this->sd = $vals['sd'];
      }
      if (isset($vals['parameters'])) {
        $this->parameters = $vals['parameters'];
      }
      if (isset($vals['deferredRebuild'])) {
        $this->deferredRebuild = $vals['deferredRebuild'];
      }
    }
  }

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

  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->indexName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->indexHandlerClass);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->origTableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->createTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->lastAccessTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->indexTableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::STRUCT) {
            $this->sd = new \metastore\StorageDescriptor();
            $xfer += $this->sd->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::MAP) {
            $this->parameters = array();
            $_size230 = 0;
            $_ktype231 = 0;
            $_vtype232 = 0;
            $xfer += $input->readMapBegin($_ktype231, $_vtype232, $_size230);
            for ($_i234 = 0; $_i234 < $_size230; ++$_i234)
            {
              $key235 = '';
              $val236 = '';
              $xfer += $input->readString($key235);
              $xfer += $input->readString($val236);
              $this->parameters[$key235] = $val236;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->deferredRebuild);
          } 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('Index');
    if ($this->indexName !== null) {
      $xfer += $output->writeFieldBegin('indexName', TType::STRING, 1);
      $xfer += $output->writeString($this->indexName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->indexHandlerClass !== null) {
      $xfer += $output->writeFieldBegin('indexHandlerClass', TType::STRING, 2);
      $xfer += $output->writeString($this->indexHandlerClass);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 3);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->origTableName !== null) {
      $xfer += $output->writeFieldBegin('origTableName', TType::STRING, 4);
      $xfer += $output->writeString($this->origTableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createTime !== null) {
      $xfer += $output->writeFieldBegin('createTime', TType::I32, 5);
      $xfer += $output->writeI32($this->createTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->lastAccessTime !== null) {
      $xfer += $output->writeFieldBegin('lastAccessTime', TType::I32, 6);
      $xfer += $output->writeI32($this->lastAccessTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->indexTableName !== null) {
      $xfer += $output->writeFieldBegin('indexTableName', TType::STRING, 7);
      $xfer += $output->writeString($this->indexTableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->sd !== null) {
      if (!is_object($this->sd)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('sd', TType::STRUCT, 8);
      $xfer += $this->sd->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parameters !== null) {
      if (!is_array($this->parameters)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('parameters', TType::MAP, 9);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->parameters));
        {
          foreach ($this->parameters as $kiter237 => $viter238)
          {
            $xfer += $output->writeString($kiter237);
            $xfer += $output->writeString($viter238);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->deferredRebuild !== null) {
      $xfer += $output->writeFieldBegin('deferredRebuild', TType::BOOL, 10);
      $xfer += $output->writeBool($this->deferredRebuild);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class BooleanColumnStatsData {
  static $_TSPEC;

  /**
   * @var int
   */
  public $numTrues = null;
  /**
   * @var int
   */
  public $numFalses = null;
  /**
   * @var int
   */
  public $numNulls = null;

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

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

  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->numTrues);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numFalses);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numNulls);
          } 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('BooleanColumnStatsData');
    if ($this->numTrues !== null) {
      $xfer += $output->writeFieldBegin('numTrues', TType::I64, 1);
      $xfer += $output->writeI64($this->numTrues);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numFalses !== null) {
      $xfer += $output->writeFieldBegin('numFalses', TType::I64, 2);
      $xfer += $output->writeI64($this->numFalses);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numNulls !== null) {
      $xfer += $output->writeFieldBegin('numNulls', TType::I64, 3);
      $xfer += $output->writeI64($this->numNulls);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class DoubleColumnStatsData {
  static $_TSPEC;

  /**
   * @var double
   */
  public $lowValue = null;
  /**
   * @var double
   */
  public $highValue = null;
  /**
   * @var int
   */
  public $numNulls = null;
  /**
   * @var int
   */
  public $numDVs = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'lowValue',
          'type' => TType::DOUBLE,
          ),
        2 => array(
          'var' => 'highValue',
          'type' => TType::DOUBLE,
          ),
        3 => array(
          'var' => 'numNulls',
          'type' => TType::I64,
          ),
        4 => array(
          'var' => 'numDVs',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['lowValue'])) {
        $this->lowValue = $vals['lowValue'];
      }
      if (isset($vals['highValue'])) {
        $this->highValue = $vals['highValue'];
      }
      if (isset($vals['numNulls'])) {
        $this->numNulls = $vals['numNulls'];
      }
      if (isset($vals['numDVs'])) {
        $this->numDVs = $vals['numDVs'];
      }
    }
  }

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

  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->lowValue);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::DOUBLE) {
            $xfer += $input->readDouble($this->highValue);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numNulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numDVs);
          } 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('DoubleColumnStatsData');
    if ($this->lowValue !== null) {
      $xfer += $output->writeFieldBegin('lowValue', TType::DOUBLE, 1);
      $xfer += $output->writeDouble($this->lowValue);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->highValue !== null) {
      $xfer += $output->writeFieldBegin('highValue', TType::DOUBLE, 2);
      $xfer += $output->writeDouble($this->highValue);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numNulls !== null) {
      $xfer += $output->writeFieldBegin('numNulls', TType::I64, 3);
      $xfer += $output->writeI64($this->numNulls);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numDVs !== null) {
      $xfer += $output->writeFieldBegin('numDVs', TType::I64, 4);
      $xfer += $output->writeI64($this->numDVs);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class LongColumnStatsData {
  static $_TSPEC;

  /**
   * @var int
   */
  public $lowValue = null;
  /**
   * @var int
   */
  public $highValue = null;
  /**
   * @var int
   */
  public $numNulls = null;
  /**
   * @var int
   */
  public $numDVs = null;

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

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

  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->lowValue);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->highValue);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numNulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numDVs);
          } 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('LongColumnStatsData');
    if ($this->lowValue !== null) {
      $xfer += $output->writeFieldBegin('lowValue', TType::I64, 1);
      $xfer += $output->writeI64($this->lowValue);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->highValue !== null) {
      $xfer += $output->writeFieldBegin('highValue', TType::I64, 2);
      $xfer += $output->writeI64($this->highValue);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numNulls !== null) {
      $xfer += $output->writeFieldBegin('numNulls', TType::I64, 3);
      $xfer += $output->writeI64($this->numNulls);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numDVs !== null) {
      $xfer += $output->writeFieldBegin('numDVs', TType::I64, 4);
      $xfer += $output->writeI64($this->numDVs);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class StringColumnStatsData {
  static $_TSPEC;

  /**
   * @var int
   */
  public $maxColLen = null;
  /**
   * @var double
   */
  public $avgColLen = null;
  /**
   * @var int
   */
  public $numNulls = null;
  /**
   * @var int
   */
  public $numDVs = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'maxColLen',
          'type' => TType::I64,
          ),
        2 => array(
          'var' => 'avgColLen',
          'type' => TType::DOUBLE,
          ),
        3 => array(
          'var' => 'numNulls',
          'type' => TType::I64,
          ),
        4 => array(
          'var' => 'numDVs',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['maxColLen'])) {
        $this->maxColLen = $vals['maxColLen'];
      }
      if (isset($vals['avgColLen'])) {
        $this->avgColLen = $vals['avgColLen'];
      }
      if (isset($vals['numNulls'])) {
        $this->numNulls = $vals['numNulls'];
      }
      if (isset($vals['numDVs'])) {
        $this->numDVs = $vals['numDVs'];
      }
    }
  }

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

  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->maxColLen);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::DOUBLE) {
            $xfer += $input->readDouble($this->avgColLen);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numNulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numDVs);
          } 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('StringColumnStatsData');
    if ($this->maxColLen !== null) {
      $xfer += $output->writeFieldBegin('maxColLen', TType::I64, 1);
      $xfer += $output->writeI64($this->maxColLen);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->avgColLen !== null) {
      $xfer += $output->writeFieldBegin('avgColLen', TType::DOUBLE, 2);
      $xfer += $output->writeDouble($this->avgColLen);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numNulls !== null) {
      $xfer += $output->writeFieldBegin('numNulls', TType::I64, 3);
      $xfer += $output->writeI64($this->numNulls);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numDVs !== null) {
      $xfer += $output->writeFieldBegin('numDVs', TType::I64, 4);
      $xfer += $output->writeI64($this->numDVs);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class BinaryColumnStatsData {
  static $_TSPEC;

  /**
   * @var int
   */
  public $maxColLen = null;
  /**
   * @var double
   */
  public $avgColLen = null;
  /**
   * @var int
   */
  public $numNulls = null;

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

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

  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->maxColLen);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::DOUBLE) {
            $xfer += $input->readDouble($this->avgColLen);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numNulls);
          } 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('BinaryColumnStatsData');
    if ($this->maxColLen !== null) {
      $xfer += $output->writeFieldBegin('maxColLen', TType::I64, 1);
      $xfer += $output->writeI64($this->maxColLen);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->avgColLen !== null) {
      $xfer += $output->writeFieldBegin('avgColLen', TType::DOUBLE, 2);
      $xfer += $output->writeDouble($this->avgColLen);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numNulls !== null) {
      $xfer += $output->writeFieldBegin('numNulls', TType::I64, 3);
      $xfer += $output->writeI64($this->numNulls);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Decimal {
  static $_TSPEC;

  /**
   * @var string
   */
  public $unscaled = null;
  /**
   * @var int
   */
  public $scale = null;

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

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

  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->unscaled);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I16) {
            $xfer += $input->readI16($this->scale);
          } 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('Decimal');
    if ($this->unscaled !== null) {
      $xfer += $output->writeFieldBegin('unscaled', TType::STRING, 1);
      $xfer += $output->writeString($this->unscaled);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->scale !== null) {
      $xfer += $output->writeFieldBegin('scale', TType::I16, 3);
      $xfer += $output->writeI16($this->scale);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class DecimalColumnStatsData {
  static $_TSPEC;

  /**
   * @var \metastore\Decimal
   */
  public $lowValue = null;
  /**
   * @var \metastore\Decimal
   */
  public $highValue = null;
  /**
   * @var int
   */
  public $numNulls = null;
  /**
   * @var int
   */
  public $numDVs = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'lowValue',
          'type' => TType::STRUCT,
          'class' => '\metastore\Decimal',
          ),
        2 => array(
          'var' => 'highValue',
          'type' => TType::STRUCT,
          'class' => '\metastore\Decimal',
          ),
        3 => array(
          'var' => 'numNulls',
          'type' => TType::I64,
          ),
        4 => array(
          'var' => 'numDVs',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['lowValue'])) {
        $this->lowValue = $vals['lowValue'];
      }
      if (isset($vals['highValue'])) {
        $this->highValue = $vals['highValue'];
      }
      if (isset($vals['numNulls'])) {
        $this->numNulls = $vals['numNulls'];
      }
      if (isset($vals['numDVs'])) {
        $this->numDVs = $vals['numDVs'];
      }
    }
  }

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

  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->lowValue = new \metastore\Decimal();
            $xfer += $this->lowValue->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->highValue = new \metastore\Decimal();
            $xfer += $this->highValue->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numNulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numDVs);
          } 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('DecimalColumnStatsData');
    if ($this->lowValue !== null) {
      if (!is_object($this->lowValue)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('lowValue', TType::STRUCT, 1);
      $xfer += $this->lowValue->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->highValue !== null) {
      if (!is_object($this->highValue)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('highValue', TType::STRUCT, 2);
      $xfer += $this->highValue->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numNulls !== null) {
      $xfer += $output->writeFieldBegin('numNulls', TType::I64, 3);
      $xfer += $output->writeI64($this->numNulls);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numDVs !== null) {
      $xfer += $output->writeFieldBegin('numDVs', TType::I64, 4);
      $xfer += $output->writeI64($this->numDVs);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Date {
  static $_TSPEC;

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

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

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

  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->daysSinceEpoch);
          } 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('Date');
    if ($this->daysSinceEpoch !== null) {
      $xfer += $output->writeFieldBegin('daysSinceEpoch', TType::I64, 1);
      $xfer += $output->writeI64($this->daysSinceEpoch);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class DateColumnStatsData {
  static $_TSPEC;

  /**
   * @var \metastore\Date
   */
  public $lowValue = null;
  /**
   * @var \metastore\Date
   */
  public $highValue = null;
  /**
   * @var int
   */
  public $numNulls = null;
  /**
   * @var int
   */
  public $numDVs = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'lowValue',
          'type' => TType::STRUCT,
          'class' => '\metastore\Date',
          ),
        2 => array(
          'var' => 'highValue',
          'type' => TType::STRUCT,
          'class' => '\metastore\Date',
          ),
        3 => array(
          'var' => 'numNulls',
          'type' => TType::I64,
          ),
        4 => array(
          'var' => 'numDVs',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['lowValue'])) {
        $this->lowValue = $vals['lowValue'];
      }
      if (isset($vals['highValue'])) {
        $this->highValue = $vals['highValue'];
      }
      if (isset($vals['numNulls'])) {
        $this->numNulls = $vals['numNulls'];
      }
      if (isset($vals['numDVs'])) {
        $this->numDVs = $vals['numDVs'];
      }
    }
  }

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

  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->lowValue = new \metastore\Date();
            $xfer += $this->lowValue->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->highValue = new \metastore\Date();
            $xfer += $this->highValue->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numNulls);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->numDVs);
          } 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('DateColumnStatsData');
    if ($this->lowValue !== null) {
      if (!is_object($this->lowValue)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('lowValue', TType::STRUCT, 1);
      $xfer += $this->lowValue->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->highValue !== null) {
      if (!is_object($this->highValue)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('highValue', TType::STRUCT, 2);
      $xfer += $this->highValue->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numNulls !== null) {
      $xfer += $output->writeFieldBegin('numNulls', TType::I64, 3);
      $xfer += $output->writeI64($this->numNulls);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->numDVs !== null) {
      $xfer += $output->writeFieldBegin('numDVs', TType::I64, 4);
      $xfer += $output->writeI64($this->numDVs);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ColumnStatisticsData {
  static $_TSPEC;

  /**
   * @var \metastore\BooleanColumnStatsData
   */
  public $booleanStats = null;
  /**
   * @var \metastore\LongColumnStatsData
   */
  public $longStats = null;
  /**
   * @var \metastore\DoubleColumnStatsData
   */
  public $doubleStats = null;
  /**
   * @var \metastore\StringColumnStatsData
   */
  public $stringStats = null;
  /**
   * @var \metastore\BinaryColumnStatsData
   */
  public $binaryStats = null;
  /**
   * @var \metastore\DecimalColumnStatsData
   */
  public $decimalStats = null;
  /**
   * @var \metastore\DateColumnStatsData
   */
  public $dateStats = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'booleanStats',
          'type' => TType::STRUCT,
          'class' => '\metastore\BooleanColumnStatsData',
          ),
        2 => array(
          'var' => 'longStats',
          'type' => TType::STRUCT,
          'class' => '\metastore\LongColumnStatsData',
          ),
        3 => array(
          'var' => 'doubleStats',
          'type' => TType::STRUCT,
          'class' => '\metastore\DoubleColumnStatsData',
          ),
        4 => array(
          'var' => 'stringStats',
          'type' => TType::STRUCT,
          'class' => '\metastore\StringColumnStatsData',
          ),
        5 => array(
          'var' => 'binaryStats',
          'type' => TType::STRUCT,
          'class' => '\metastore\BinaryColumnStatsData',
          ),
        6 => array(
          'var' => 'decimalStats',
          'type' => TType::STRUCT,
          'class' => '\metastore\DecimalColumnStatsData',
          ),
        7 => array(
          'var' => 'dateStats',
          'type' => TType::STRUCT,
          'class' => '\metastore\DateColumnStatsData',
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['booleanStats'])) {
        $this->booleanStats = $vals['booleanStats'];
      }
      if (isset($vals['longStats'])) {
        $this->longStats = $vals['longStats'];
      }
      if (isset($vals['doubleStats'])) {
        $this->doubleStats = $vals['doubleStats'];
      }
      if (isset($vals['stringStats'])) {
        $this->stringStats = $vals['stringStats'];
      }
      if (isset($vals['binaryStats'])) {
        $this->binaryStats = $vals['binaryStats'];
      }
      if (isset($vals['decimalStats'])) {
        $this->decimalStats = $vals['decimalStats'];
      }
      if (isset($vals['dateStats'])) {
        $this->dateStats = $vals['dateStats'];
      }
    }
  }

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

  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->booleanStats = new \metastore\BooleanColumnStatsData();
            $xfer += $this->booleanStats->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->longStats = new \metastore\LongColumnStatsData();
            $xfer += $this->longStats->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRUCT) {
            $this->doubleStats = new \metastore\DoubleColumnStatsData();
            $xfer += $this->doubleStats->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRUCT) {
            $this->stringStats = new \metastore\StringColumnStatsData();
            $xfer += $this->stringStats->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRUCT) {
            $this->binaryStats = new \metastore\BinaryColumnStatsData();
            $xfer += $this->binaryStats->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRUCT) {
            $this->decimalStats = new \metastore\DecimalColumnStatsData();
            $xfer += $this->decimalStats->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRUCT) {
            $this->dateStats = new \metastore\DateColumnStatsData();
            $xfer += $this->dateStats->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('ColumnStatisticsData');
    if ($this->booleanStats !== null) {
      if (!is_object($this->booleanStats)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('booleanStats', TType::STRUCT, 1);
      $xfer += $this->booleanStats->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->longStats !== null) {
      if (!is_object($this->longStats)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('longStats', TType::STRUCT, 2);
      $xfer += $this->longStats->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->doubleStats !== null) {
      if (!is_object($this->doubleStats)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('doubleStats', TType::STRUCT, 3);
      $xfer += $this->doubleStats->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->stringStats !== null) {
      if (!is_object($this->stringStats)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('stringStats', TType::STRUCT, 4);
      $xfer += $this->stringStats->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->binaryStats !== null) {
      if (!is_object($this->binaryStats)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('binaryStats', TType::STRUCT, 5);
      $xfer += $this->binaryStats->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->decimalStats !== null) {
      if (!is_object($this->decimalStats)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('decimalStats', TType::STRUCT, 6);
      $xfer += $this->decimalStats->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dateStats !== null) {
      if (!is_object($this->dateStats)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('dateStats', TType::STRUCT, 7);
      $xfer += $this->dateStats->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ColumnStatisticsObj {
  static $_TSPEC;

  /**
   * @var string
   */
  public $colName = null;
  /**
   * @var string
   */
  public $colType = null;
  /**
   * @var \metastore\ColumnStatisticsData
   */
  public $statsData = null;

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

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

  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->colName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->colType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRUCT) {
            $this->statsData = new \metastore\ColumnStatisticsData();
            $xfer += $this->statsData->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('ColumnStatisticsObj');
    if ($this->colName !== null) {
      $xfer += $output->writeFieldBegin('colName', TType::STRING, 1);
      $xfer += $output->writeString($this->colName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->colType !== null) {
      $xfer += $output->writeFieldBegin('colType', TType::STRING, 2);
      $xfer += $output->writeString($this->colType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->statsData !== null) {
      if (!is_object($this->statsData)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('statsData', TType::STRUCT, 3);
      $xfer += $this->statsData->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ColumnStatisticsDesc {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $isTblLevel = null;
  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $tableName = null;
  /**
   * @var string
   */
  public $partName = null;
  /**
   * @var int
   */
  public $lastAnalyzed = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'isTblLevel',
          'type' => TType::BOOL,
          ),
        2 => array(
          'var' => 'dbName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'tableName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'partName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'lastAnalyzed',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['isTblLevel'])) {
        $this->isTblLevel = $vals['isTblLevel'];
      }
      if (isset($vals['dbName'])) {
        $this->dbName = $vals['dbName'];
      }
      if (isset($vals['tableName'])) {
        $this->tableName = $vals['tableName'];
      }
      if (isset($vals['partName'])) {
        $this->partName = $vals['partName'];
      }
      if (isset($vals['lastAnalyzed'])) {
        $this->lastAnalyzed = $vals['lastAnalyzed'];
      }
    }
  }

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

  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->isTblLevel);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->partName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->lastAnalyzed);
          } 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('ColumnStatisticsDesc');
    if ($this->isTblLevel !== null) {
      $xfer += $output->writeFieldBegin('isTblLevel', TType::BOOL, 1);
      $xfer += $output->writeBool($this->isTblLevel);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 2);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableName !== null) {
      $xfer += $output->writeFieldBegin('tableName', TType::STRING, 3);
      $xfer += $output->writeString($this->tableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partName !== null) {
      $xfer += $output->writeFieldBegin('partName', TType::STRING, 4);
      $xfer += $output->writeString($this->partName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->lastAnalyzed !== null) {
      $xfer += $output->writeFieldBegin('lastAnalyzed', TType::I64, 5);
      $xfer += $output->writeI64($this->lastAnalyzed);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ColumnStatistics {
  static $_TSPEC;

  /**
   * @var \metastore\ColumnStatisticsDesc
   */
  public $statsDesc = null;
  /**
   * @var \metastore\ColumnStatisticsObj[]
   */
  public $statsObj = null;

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

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

  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->statsDesc = new \metastore\ColumnStatisticsDesc();
            $xfer += $this->statsDesc->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::LST) {
            $this->statsObj = array();
            $_size239 = 0;
            $_etype242 = 0;
            $xfer += $input->readListBegin($_etype242, $_size239);
            for ($_i243 = 0; $_i243 < $_size239; ++$_i243)
            {
              $elem244 = null;
              $elem244 = new \metastore\ColumnStatisticsObj();
              $xfer += $elem244->read($input);
              $this->statsObj []= $elem244;
            }
            $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('ColumnStatistics');
    if ($this->statsDesc !== null) {
      if (!is_object($this->statsDesc)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('statsDesc', TType::STRUCT, 1);
      $xfer += $this->statsDesc->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->statsObj !== null) {
      if (!is_array($this->statsObj)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('statsObj', TType::LST, 2);
      {
        $output->writeListBegin(TType::STRUCT, count($this->statsObj));
        {
          foreach ($this->statsObj as $iter245)
          {
            $xfer += $iter245->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class AggrStats {
  static $_TSPEC;

  /**
   * @var \metastore\ColumnStatisticsObj[]
   */
  public $colStats = null;
  /**
   * @var int
   */
  public $partsFound = null;

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

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

  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->colStats = array();
            $_size246 = 0;
            $_etype249 = 0;
            $xfer += $input->readListBegin($_etype249, $_size246);
            for ($_i250 = 0; $_i250 < $_size246; ++$_i250)
            {
              $elem251 = null;
              $elem251 = new \metastore\ColumnStatisticsObj();
              $xfer += $elem251->read($input);
              $this->colStats []= $elem251;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->partsFound);
          } 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('AggrStats');
    if ($this->colStats !== null) {
      if (!is_array($this->colStats)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('colStats', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->colStats));
        {
          foreach ($this->colStats as $iter252)
          {
            $xfer += $iter252->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partsFound !== null) {
      $xfer += $output->writeFieldBegin('partsFound', TType::I64, 2);
      $xfer += $output->writeI64($this->partsFound);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class SetPartitionsStatsRequest {
  static $_TSPEC;

  /**
   * @var \metastore\ColumnStatistics[]
   */
  public $colStats = null;

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

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

  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->colStats = array();
            $_size253 = 0;
            $_etype256 = 0;
            $xfer += $input->readListBegin($_etype256, $_size253);
            for ($_i257 = 0; $_i257 < $_size253; ++$_i257)
            {
              $elem258 = null;
              $elem258 = new \metastore\ColumnStatistics();
              $xfer += $elem258->read($input);
              $this->colStats []= $elem258;
            }
            $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('SetPartitionsStatsRequest');
    if ($this->colStats !== null) {
      if (!is_array($this->colStats)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('colStats', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->colStats));
        {
          foreach ($this->colStats as $iter259)
          {
            $xfer += $iter259->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Schema {
  static $_TSPEC;

  /**
   * @var \metastore\FieldSchema[]
   */
  public $fieldSchemas = null;
  /**
   * @var array
   */
  public $properties = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'fieldSchemas',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\metastore\FieldSchema',
            ),
          ),
        2 => array(
          'var' => 'properties',
          '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['fieldSchemas'])) {
        $this->fieldSchemas = $vals['fieldSchemas'];
      }
      if (isset($vals['properties'])) {
        $this->properties = $vals['properties'];
      }
    }
  }

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

  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->fieldSchemas = array();
            $_size260 = 0;
            $_etype263 = 0;
            $xfer += $input->readListBegin($_etype263, $_size260);
            for ($_i264 = 0; $_i264 < $_size260; ++$_i264)
            {
              $elem265 = null;
              $elem265 = new \metastore\FieldSchema();
              $xfer += $elem265->read($input);
              $this->fieldSchemas []= $elem265;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::MAP) {
            $this->properties = array();
            $_size266 = 0;
            $_ktype267 = 0;
            $_vtype268 = 0;
            $xfer += $input->readMapBegin($_ktype267, $_vtype268, $_size266);
            for ($_i270 = 0; $_i270 < $_size266; ++$_i270)
            {
              $key271 = '';
              $val272 = '';
              $xfer += $input->readString($key271);
              $xfer += $input->readString($val272);
              $this->properties[$key271] = $val272;
            }
            $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('Schema');
    if ($this->fieldSchemas !== null) {
      if (!is_array($this->fieldSchemas)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('fieldSchemas', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->fieldSchemas));
        {
          foreach ($this->fieldSchemas as $iter273)
          {
            $xfer += $iter273->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->properties !== null) {
      if (!is_array($this->properties)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('properties', TType::MAP, 2);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->properties));
        {
          foreach ($this->properties as $kiter274 => $viter275)
          {
            $xfer += $output->writeString($kiter274);
            $xfer += $output->writeString($viter275);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class EnvironmentContext {
  static $_TSPEC;

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

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'properties',
          '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['properties'])) {
        $this->properties = $vals['properties'];
      }
    }
  }

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

  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->properties = array();
            $_size276 = 0;
            $_ktype277 = 0;
            $_vtype278 = 0;
            $xfer += $input->readMapBegin($_ktype277, $_vtype278, $_size276);
            for ($_i280 = 0; $_i280 < $_size276; ++$_i280)
            {
              $key281 = '';
              $val282 = '';
              $xfer += $input->readString($key281);
              $xfer += $input->readString($val282);
              $this->properties[$key281] = $val282;
            }
            $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('EnvironmentContext');
    if ($this->properties !== null) {
      if (!is_array($this->properties)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('properties', TType::MAP, 1);
      {
        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->properties));
        {
          foreach ($this->properties as $kiter283 => $viter284)
          {
            $xfer += $output->writeString($kiter283);
            $xfer += $output->writeString($viter284);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PartitionsByExprResult {
  static $_TSPEC;

  /**
   * @var \metastore\Partition[]
   */
  public $partitions = null;
  /**
   * @var bool
   */
  public $hasUnknownPartitions = null;

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

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

  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->partitions = array();
            $_size285 = 0;
            $_etype288 = 0;
            $xfer += $input->readListBegin($_etype288, $_size285);
            for ($_i289 = 0; $_i289 < $_size285; ++$_i289)
            {
              $elem290 = null;
              $elem290 = new \metastore\Partition();
              $xfer += $elem290->read($input);
              $this->partitions []= $elem290;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->hasUnknownPartitions);
          } 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('PartitionsByExprResult');
    if ($this->partitions !== null) {
      if (!is_array($this->partitions)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partitions', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->partitions));
        {
          foreach ($this->partitions as $iter291)
          {
            $xfer += $iter291->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->hasUnknownPartitions !== null) {
      $xfer += $output->writeFieldBegin('hasUnknownPartitions', TType::BOOL, 2);
      $xfer += $output->writeBool($this->hasUnknownPartitions);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PartitionsByExprRequest {
  static $_TSPEC;

  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $tblName = null;
  /**
   * @var string
   */
  public $expr = null;
  /**
   * @var string
   */
  public $defaultPartitionName = null;
  /**
   * @var int
   */
  public $maxParts = -1;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'dbName',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'tblName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'expr',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'defaultPartitionName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'maxParts',
          'type' => TType::I16,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['dbName'])) {
        $this->dbName = $vals['dbName'];
      }
      if (isset($vals['tblName'])) {
        $this->tblName = $vals['tblName'];
      }
      if (isset($vals['expr'])) {
        $this->expr = $vals['expr'];
      }
      if (isset($vals['defaultPartitionName'])) {
        $this->defaultPartitionName = $vals['defaultPartitionName'];
      }
      if (isset($vals['maxParts'])) {
        $this->maxParts = $vals['maxParts'];
      }
    }
  }

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

  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->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tblName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->expr);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->defaultPartitionName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I16) {
            $xfer += $input->readI16($this->maxParts);
          } 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('PartitionsByExprRequest');
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 1);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tblName !== null) {
      $xfer += $output->writeFieldBegin('tblName', TType::STRING, 2);
      $xfer += $output->writeString($this->tblName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->expr !== null) {
      $xfer += $output->writeFieldBegin('expr', TType::STRING, 3);
      $xfer += $output->writeString($this->expr);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->defaultPartitionName !== null) {
      $xfer += $output->writeFieldBegin('defaultPartitionName', TType::STRING, 4);
      $xfer += $output->writeString($this->defaultPartitionName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->maxParts !== null) {
      $xfer += $output->writeFieldBegin('maxParts', TType::I16, 5);
      $xfer += $output->writeI16($this->maxParts);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TableStatsResult {
  static $_TSPEC;

  /**
   * @var \metastore\ColumnStatisticsObj[]
   */
  public $tableStats = null;

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

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

  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->tableStats = array();
            $_size292 = 0;
            $_etype295 = 0;
            $xfer += $input->readListBegin($_etype295, $_size292);
            for ($_i296 = 0; $_i296 < $_size292; ++$_i296)
            {
              $elem297 = null;
              $elem297 = new \metastore\ColumnStatisticsObj();
              $xfer += $elem297->read($input);
              $this->tableStats []= $elem297;
            }
            $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('TableStatsResult');
    if ($this->tableStats !== null) {
      if (!is_array($this->tableStats)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('tableStats', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->tableStats));
        {
          foreach ($this->tableStats as $iter298)
          {
            $xfer += $iter298->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PartitionsStatsResult {
  static $_TSPEC;

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

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

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

  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->partStats = array();
            $_size299 = 0;
            $_ktype300 = 0;
            $_vtype301 = 0;
            $xfer += $input->readMapBegin($_ktype300, $_vtype301, $_size299);
            for ($_i303 = 0; $_i303 < $_size299; ++$_i303)
            {
              $key304 = '';
              $val305 = array();
              $xfer += $input->readString($key304);
              $val305 = array();
              $_size306 = 0;
              $_etype309 = 0;
              $xfer += $input->readListBegin($_etype309, $_size306);
              for ($_i310 = 0; $_i310 < $_size306; ++$_i310)
              {
                $elem311 = null;
                $elem311 = new \metastore\ColumnStatisticsObj();
                $xfer += $elem311->read($input);
                $val305 []= $elem311;
              }
              $xfer += $input->readListEnd();
              $this->partStats[$key304] = $val305;
            }
            $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('PartitionsStatsResult');
    if ($this->partStats !== null) {
      if (!is_array($this->partStats)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partStats', TType::MAP, 1);
      {
        $output->writeMapBegin(TType::STRING, TType::LST, count($this->partStats));
        {
          foreach ($this->partStats as $kiter312 => $viter313)
          {
            $xfer += $output->writeString($kiter312);
            {
              $output->writeListBegin(TType::STRUCT, count($viter313));
              {
                foreach ($viter313 as $iter314)
                {
                  $xfer += $iter314->write($output);
                }
              }
              $output->writeListEnd();
            }
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TableStatsRequest {
  static $_TSPEC;

  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $tblName = null;
  /**
   * @var string[]
   */
  public $colNames = null;

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

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

  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->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tblName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::LST) {
            $this->colNames = array();
            $_size315 = 0;
            $_etype318 = 0;
            $xfer += $input->readListBegin($_etype318, $_size315);
            for ($_i319 = 0; $_i319 < $_size315; ++$_i319)
            {
              $elem320 = null;
              $xfer += $input->readString($elem320);
              $this->colNames []= $elem320;
            }
            $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('TableStatsRequest');
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 1);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tblName !== null) {
      $xfer += $output->writeFieldBegin('tblName', TType::STRING, 2);
      $xfer += $output->writeString($this->tblName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->colNames !== null) {
      if (!is_array($this->colNames)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('colNames', TType::LST, 3);
      {
        $output->writeListBegin(TType::STRING, count($this->colNames));
        {
          foreach ($this->colNames as $iter321)
          {
            $xfer += $output->writeString($iter321);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PartitionsStatsRequest {
  static $_TSPEC;

  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $tblName = null;
  /**
   * @var string[]
   */
  public $colNames = null;
  /**
   * @var string[]
   */
  public $partNames = null;

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

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

  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->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tblName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::LST) {
            $this->colNames = array();
            $_size322 = 0;
            $_etype325 = 0;
            $xfer += $input->readListBegin($_etype325, $_size322);
            for ($_i326 = 0; $_i326 < $_size322; ++$_i326)
            {
              $elem327 = null;
              $xfer += $input->readString($elem327);
              $this->colNames []= $elem327;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::LST) {
            $this->partNames = array();
            $_size328 = 0;
            $_etype331 = 0;
            $xfer += $input->readListBegin($_etype331, $_size328);
            for ($_i332 = 0; $_i332 < $_size328; ++$_i332)
            {
              $elem333 = null;
              $xfer += $input->readString($elem333);
              $this->partNames []= $elem333;
            }
            $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('PartitionsStatsRequest');
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 1);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tblName !== null) {
      $xfer += $output->writeFieldBegin('tblName', TType::STRING, 2);
      $xfer += $output->writeString($this->tblName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->colNames !== null) {
      if (!is_array($this->colNames)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('colNames', TType::LST, 3);
      {
        $output->writeListBegin(TType::STRING, count($this->colNames));
        {
          foreach ($this->colNames as $iter334)
          {
            $xfer += $output->writeString($iter334);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partNames !== null) {
      if (!is_array($this->partNames)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partNames', TType::LST, 4);
      {
        $output->writeListBegin(TType::STRING, count($this->partNames));
        {
          foreach ($this->partNames as $iter335)
          {
            $xfer += $output->writeString($iter335);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class AddPartitionsResult {
  static $_TSPEC;

  /**
   * @var \metastore\Partition[]
   */
  public $partitions = null;

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

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

  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->partitions = array();
            $_size336 = 0;
            $_etype339 = 0;
            $xfer += $input->readListBegin($_etype339, $_size336);
            for ($_i340 = 0; $_i340 < $_size336; ++$_i340)
            {
              $elem341 = null;
              $elem341 = new \metastore\Partition();
              $xfer += $elem341->read($input);
              $this->partitions []= $elem341;
            }
            $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('AddPartitionsResult');
    if ($this->partitions !== null) {
      if (!is_array($this->partitions)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partitions', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->partitions));
        {
          foreach ($this->partitions as $iter342)
          {
            $xfer += $iter342->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class AddPartitionsRequest {
  static $_TSPEC;

  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $tblName = null;
  /**
   * @var \metastore\Partition[]
   */
  public $parts = null;
  /**
   * @var bool
   */
  public $ifNotExists = null;
  /**
   * @var bool
   */
  public $needResult = true;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'dbName',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'tblName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'parts',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\metastore\Partition',
            ),
          ),
        4 => array(
          'var' => 'ifNotExists',
          'type' => TType::BOOL,
          ),
        5 => array(
          'var' => 'needResult',
          'type' => TType::BOOL,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['dbName'])) {
        $this->dbName = $vals['dbName'];
      }
      if (isset($vals['tblName'])) {
        $this->tblName = $vals['tblName'];
      }
      if (isset($vals['parts'])) {
        $this->parts = $vals['parts'];
      }
      if (isset($vals['ifNotExists'])) {
        $this->ifNotExists = $vals['ifNotExists'];
      }
      if (isset($vals['needResult'])) {
        $this->needResult = $vals['needResult'];
      }
    }
  }

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

  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->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tblName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::LST) {
            $this->parts = array();
            $_size343 = 0;
            $_etype346 = 0;
            $xfer += $input->readListBegin($_etype346, $_size343);
            for ($_i347 = 0; $_i347 < $_size343; ++$_i347)
            {
              $elem348 = null;
              $elem348 = new \metastore\Partition();
              $xfer += $elem348->read($input);
              $this->parts []= $elem348;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->ifNotExists);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->needResult);
          } 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('AddPartitionsRequest');
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 1);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tblName !== null) {
      $xfer += $output->writeFieldBegin('tblName', TType::STRING, 2);
      $xfer += $output->writeString($this->tblName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parts !== null) {
      if (!is_array($this->parts)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('parts', TType::LST, 3);
      {
        $output->writeListBegin(TType::STRUCT, count($this->parts));
        {
          foreach ($this->parts as $iter349)
          {
            $xfer += $iter349->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ifNotExists !== null) {
      $xfer += $output->writeFieldBegin('ifNotExists', TType::BOOL, 4);
      $xfer += $output->writeBool($this->ifNotExists);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->needResult !== null) {
      $xfer += $output->writeFieldBegin('needResult', TType::BOOL, 5);
      $xfer += $output->writeBool($this->needResult);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class DropPartitionsResult {
  static $_TSPEC;

  /**
   * @var \metastore\Partition[]
   */
  public $partitions = null;

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

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

  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->partitions = array();
            $_size350 = 0;
            $_etype353 = 0;
            $xfer += $input->readListBegin($_etype353, $_size350);
            for ($_i354 = 0; $_i354 < $_size350; ++$_i354)
            {
              $elem355 = null;
              $elem355 = new \metastore\Partition();
              $xfer += $elem355->read($input);
              $this->partitions []= $elem355;
            }
            $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('DropPartitionsResult');
    if ($this->partitions !== null) {
      if (!is_array($this->partitions)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partitions', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->partitions));
        {
          foreach ($this->partitions as $iter356)
          {
            $xfer += $iter356->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class DropPartitionsExpr {
  static $_TSPEC;

  /**
   * @var string
   */
  public $expr = null;
  /**
   * @var int
   */
  public $partArchiveLevel = null;

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

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

  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->expr);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->partArchiveLevel);
          } 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('DropPartitionsExpr');
    if ($this->expr !== null) {
      $xfer += $output->writeFieldBegin('expr', TType::STRING, 1);
      $xfer += $output->writeString($this->expr);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partArchiveLevel !== null) {
      $xfer += $output->writeFieldBegin('partArchiveLevel', TType::I32, 2);
      $xfer += $output->writeI32($this->partArchiveLevel);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class RequestPartsSpec {
  static $_TSPEC;

  /**
   * @var string[]
   */
  public $names = null;
  /**
   * @var \metastore\DropPartitionsExpr[]
   */
  public $exprs = null;

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

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

  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->names = array();
            $_size357 = 0;
            $_etype360 = 0;
            $xfer += $input->readListBegin($_etype360, $_size357);
            for ($_i361 = 0; $_i361 < $_size357; ++$_i361)
            {
              $elem362 = null;
              $xfer += $input->readString($elem362);
              $this->names []= $elem362;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::LST) {
            $this->exprs = array();
            $_size363 = 0;
            $_etype366 = 0;
            $xfer += $input->readListBegin($_etype366, $_size363);
            for ($_i367 = 0; $_i367 < $_size363; ++$_i367)
            {
              $elem368 = null;
              $elem368 = new \metastore\DropPartitionsExpr();
              $xfer += $elem368->read($input);
              $this->exprs []= $elem368;
            }
            $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('RequestPartsSpec');
    if ($this->names !== null) {
      if (!is_array($this->names)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('names', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRING, count($this->names));
        {
          foreach ($this->names as $iter369)
          {
            $xfer += $output->writeString($iter369);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->exprs !== null) {
      if (!is_array($this->exprs)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('exprs', TType::LST, 2);
      {
        $output->writeListBegin(TType::STRUCT, count($this->exprs));
        {
          foreach ($this->exprs as $iter370)
          {
            $xfer += $iter370->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class DropPartitionsRequest {
  static $_TSPEC;

  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $tblName = null;
  /**
   * @var \metastore\RequestPartsSpec
   */
  public $parts = null;
  /**
   * @var bool
   */
  public $deleteData = null;
  /**
   * @var bool
   */
  public $ifExists = true;
  /**
   * @var bool
   */
  public $ignoreProtection = null;
  /**
   * @var \metastore\EnvironmentContext
   */
  public $environmentContext = null;
  /**
   * @var bool
   */
  public $needResult = true;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'dbName',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'tblName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'parts',
          'type' => TType::STRUCT,
          'class' => '\metastore\RequestPartsSpec',
          ),
        4 => array(
          'var' => 'deleteData',
          'type' => TType::BOOL,
          ),
        5 => array(
          'var' => 'ifExists',
          'type' => TType::BOOL,
          ),
        6 => array(
          'var' => 'ignoreProtection',
          'type' => TType::BOOL,
          ),
        7 => array(
          'var' => 'environmentContext',
          'type' => TType::STRUCT,
          'class' => '\metastore\EnvironmentContext',
          ),
        8 => array(
          'var' => 'needResult',
          'type' => TType::BOOL,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['dbName'])) {
        $this->dbName = $vals['dbName'];
      }
      if (isset($vals['tblName'])) {
        $this->tblName = $vals['tblName'];
      }
      if (isset($vals['parts'])) {
        $this->parts = $vals['parts'];
      }
      if (isset($vals['deleteData'])) {
        $this->deleteData = $vals['deleteData'];
      }
      if (isset($vals['ifExists'])) {
        $this->ifExists = $vals['ifExists'];
      }
      if (isset($vals['ignoreProtection'])) {
        $this->ignoreProtection = $vals['ignoreProtection'];
      }
      if (isset($vals['environmentContext'])) {
        $this->environmentContext = $vals['environmentContext'];
      }
      if (isset($vals['needResult'])) {
        $this->needResult = $vals['needResult'];
      }
    }
  }

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

  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->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tblName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRUCT) {
            $this->parts = new \metastore\RequestPartsSpec();
            $xfer += $this->parts->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->deleteData);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->ifExists);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->ignoreProtection);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRUCT) {
            $this->environmentContext = new \metastore\EnvironmentContext();
            $xfer += $this->environmentContext->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->needResult);
          } 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('DropPartitionsRequest');
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 1);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tblName !== null) {
      $xfer += $output->writeFieldBegin('tblName', TType::STRING, 2);
      $xfer += $output->writeString($this->tblName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->parts !== null) {
      if (!is_object($this->parts)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('parts', TType::STRUCT, 3);
      $xfer += $this->parts->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->deleteData !== null) {
      $xfer += $output->writeFieldBegin('deleteData', TType::BOOL, 4);
      $xfer += $output->writeBool($this->deleteData);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ifExists !== null) {
      $xfer += $output->writeFieldBegin('ifExists', TType::BOOL, 5);
      $xfer += $output->writeBool($this->ifExists);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ignoreProtection !== null) {
      $xfer += $output->writeFieldBegin('ignoreProtection', TType::BOOL, 6);
      $xfer += $output->writeBool($this->ignoreProtection);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->environmentContext !== null) {
      if (!is_object($this->environmentContext)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('environmentContext', TType::STRUCT, 7);
      $xfer += $this->environmentContext->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->needResult !== null) {
      $xfer += $output->writeFieldBegin('needResult', TType::BOOL, 8);
      $xfer += $output->writeBool($this->needResult);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ResourceUri {
  static $_TSPEC;

  /**
   * @var int
   */
  public $resourceType = null;
  /**
   * @var string
   */
  public $uri = null;

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

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

  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->resourceType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->uri);
          } 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('ResourceUri');
    if ($this->resourceType !== null) {
      $xfer += $output->writeFieldBegin('resourceType', TType::I32, 1);
      $xfer += $output->writeI32($this->resourceType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->uri !== null) {
      $xfer += $output->writeFieldBegin('uri', TType::STRING, 2);
      $xfer += $output->writeString($this->uri);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class Function {
  static $_TSPEC;

  /**
   * @var string
   */
  public $functionName = null;
  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $className = null;
  /**
   * @var string
   */
  public $ownerName = null;
  /**
   * @var int
   */
  public $ownerType = null;
  /**
   * @var int
   */
  public $createTime = null;
  /**
   * @var int
   */
  public $functionType = null;
  /**
   * @var \metastore\ResourceUri[]
   */
  public $resourceUris = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'functionName',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'dbName',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'className',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'ownerName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'ownerType',
          'type' => TType::I32,
          ),
        6 => array(
          'var' => 'createTime',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'functionType',
          'type' => TType::I32,
          ),
        8 => array(
          'var' => 'resourceUris',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\metastore\ResourceUri',
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['functionName'])) {
        $this->functionName = $vals['functionName'];
      }
      if (isset($vals['dbName'])) {
        $this->dbName = $vals['dbName'];
      }
      if (isset($vals['className'])) {
        $this->className = $vals['className'];
      }
      if (isset($vals['ownerName'])) {
        $this->ownerName = $vals['ownerName'];
      }
      if (isset($vals['ownerType'])) {
        $this->ownerType = $vals['ownerType'];
      }
      if (isset($vals['createTime'])) {
        $this->createTime = $vals['createTime'];
      }
      if (isset($vals['functionType'])) {
        $this->functionType = $vals['functionType'];
      }
      if (isset($vals['resourceUris'])) {
        $this->resourceUris = $vals['resourceUris'];
      }
    }
  }

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

  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->functionName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->className);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->ownerName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->ownerType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->createTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->functionType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::LST) {
            $this->resourceUris = array();
            $_size371 = 0;
            $_etype374 = 0;
            $xfer += $input->readListBegin($_etype374, $_size371);
            for ($_i375 = 0; $_i375 < $_size371; ++$_i375)
            {
              $elem376 = null;
              $elem376 = new \metastore\ResourceUri();
              $xfer += $elem376->read($input);
              $this->resourceUris []= $elem376;
            }
            $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('Function');
    if ($this->functionName !== null) {
      $xfer += $output->writeFieldBegin('functionName', TType::STRING, 1);
      $xfer += $output->writeString($this->functionName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 2);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->className !== null) {
      $xfer += $output->writeFieldBegin('className', TType::STRING, 3);
      $xfer += $output->writeString($this->className);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ownerName !== null) {
      $xfer += $output->writeFieldBegin('ownerName', TType::STRING, 4);
      $xfer += $output->writeString($this->ownerName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->ownerType !== null) {
      $xfer += $output->writeFieldBegin('ownerType', TType::I32, 5);
      $xfer += $output->writeI32($this->ownerType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->createTime !== null) {
      $xfer += $output->writeFieldBegin('createTime', TType::I32, 6);
      $xfer += $output->writeI32($this->createTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->functionType !== null) {
      $xfer += $output->writeFieldBegin('functionType', TType::I32, 7);
      $xfer += $output->writeI32($this->functionType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->resourceUris !== null) {
      if (!is_array($this->resourceUris)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('resourceUris', TType::LST, 8);
      {
        $output->writeListBegin(TType::STRUCT, count($this->resourceUris));
        {
          foreach ($this->resourceUris as $iter377)
          {
            $xfer += $iter377->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TxnInfo {
  static $_TSPEC;

  /**
   * @var int
   */
  public $id = null;
  /**
   * @var int
   */
  public $state = null;
  /**
   * @var string
   */
  public $user = null;
  /**
   * @var string
   */
  public $hostname = null;
  /**
   * @var string
   */
  public $agentInfo = "Unknown";
  /**
   * @var int
   */
  public $heartbeatCount = 0;
  /**
   * @var string
   */
  public $metaInfo = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'id',
          'type' => TType::I64,
          ),
        2 => array(
          'var' => 'state',
          'type' => TType::I32,
          ),
        3 => array(
          'var' => 'user',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'hostname',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'agentInfo',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'heartbeatCount',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'metaInfo',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['id'])) {
        $this->id = $vals['id'];
      }
      if (isset($vals['state'])) {
        $this->state = $vals['state'];
      }
      if (isset($vals['user'])) {
        $this->user = $vals['user'];
      }
      if (isset($vals['hostname'])) {
        $this->hostname = $vals['hostname'];
      }
      if (isset($vals['agentInfo'])) {
        $this->agentInfo = $vals['agentInfo'];
      }
      if (isset($vals['heartbeatCount'])) {
        $this->heartbeatCount = $vals['heartbeatCount'];
      }
      if (isset($vals['metaInfo'])) {
        $this->metaInfo = $vals['metaInfo'];
      }
    }
  }

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

  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->id);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->state);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->user);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->hostname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->agentInfo);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->heartbeatCount);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->metaInfo);
          } 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('TxnInfo');
    if ($this->id !== null) {
      $xfer += $output->writeFieldBegin('id', TType::I64, 1);
      $xfer += $output->writeI64($this->id);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->state !== null) {
      $xfer += $output->writeFieldBegin('state', TType::I32, 2);
      $xfer += $output->writeI32($this->state);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->user !== null) {
      $xfer += $output->writeFieldBegin('user', TType::STRING, 3);
      $xfer += $output->writeString($this->user);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->hostname !== null) {
      $xfer += $output->writeFieldBegin('hostname', TType::STRING, 4);
      $xfer += $output->writeString($this->hostname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->agentInfo !== null) {
      $xfer += $output->writeFieldBegin('agentInfo', TType::STRING, 5);
      $xfer += $output->writeString($this->agentInfo);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->heartbeatCount !== null) {
      $xfer += $output->writeFieldBegin('heartbeatCount', TType::I32, 6);
      $xfer += $output->writeI32($this->heartbeatCount);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->metaInfo !== null) {
      $xfer += $output->writeFieldBegin('metaInfo', TType::STRING, 7);
      $xfer += $output->writeString($this->metaInfo);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GetOpenTxnsInfoResponse {
  static $_TSPEC;

  /**
   * @var int
   */
  public $txn_high_water_mark = null;
  /**
   * @var \metastore\TxnInfo[]
   */
  public $open_txns = null;

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

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

  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->txn_high_water_mark);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::LST) {
            $this->open_txns = array();
            $_size378 = 0;
            $_etype381 = 0;
            $xfer += $input->readListBegin($_etype381, $_size378);
            for ($_i382 = 0; $_i382 < $_size378; ++$_i382)
            {
              $elem383 = null;
              $elem383 = new \metastore\TxnInfo();
              $xfer += $elem383->read($input);
              $this->open_txns []= $elem383;
            }
            $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('GetOpenTxnsInfoResponse');
    if ($this->txn_high_water_mark !== null) {
      $xfer += $output->writeFieldBegin('txn_high_water_mark', TType::I64, 1);
      $xfer += $output->writeI64($this->txn_high_water_mark);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->open_txns !== null) {
      if (!is_array($this->open_txns)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('open_txns', TType::LST, 2);
      {
        $output->writeListBegin(TType::STRUCT, count($this->open_txns));
        {
          foreach ($this->open_txns as $iter384)
          {
            $xfer += $iter384->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GetOpenTxnsResponse {
  static $_TSPEC;

  /**
   * @var int
   */
  public $txn_high_water_mark = null;
  /**
   * @var int[]
   */
  public $open_txns = null;

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

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

  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->txn_high_water_mark);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::SET) {
            $this->open_txns = array();
            $_size385 = 0;
            $_etype388 = 0;
            $xfer += $input->readSetBegin($_etype388, $_size385);
            for ($_i389 = 0; $_i389 < $_size385; ++$_i389)
            {
              $elem390 = null;
              $xfer += $input->readI64($elem390);
              if (is_scalar($elem390)) {
                $this->open_txns[$elem390] = true;
              } else {
                $this->open_txns []= $elem390;
              }
            }
            $xfer += $input->readSetEnd();
          } 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('GetOpenTxnsResponse');
    if ($this->txn_high_water_mark !== null) {
      $xfer += $output->writeFieldBegin('txn_high_water_mark', TType::I64, 1);
      $xfer += $output->writeI64($this->txn_high_water_mark);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->open_txns !== null) {
      if (!is_array($this->open_txns)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('open_txns', TType::SET, 2);
      {
        $output->writeSetBegin(TType::I64, count($this->open_txns));
        {
          foreach ($this->open_txns as $iter391 => $iter392)
          {
            if (is_scalar($iter392)) {
            $xfer += $output->writeI64($iter391);
            } else {
            $xfer += $output->writeI64($iter392);
            }
          }
        }
        $output->writeSetEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class OpenTxnRequest {
  static $_TSPEC;

  /**
   * @var int
   */
  public $num_txns = null;
  /**
   * @var string
   */
  public $user = null;
  /**
   * @var string
   */
  public $hostname = null;
  /**
   * @var string
   */
  public $agentInfo = "Unknown";

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

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

  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->num_txns);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->user);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->hostname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->agentInfo);
          } 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('OpenTxnRequest');
    if ($this->num_txns !== null) {
      $xfer += $output->writeFieldBegin('num_txns', TType::I32, 1);
      $xfer += $output->writeI32($this->num_txns);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->user !== null) {
      $xfer += $output->writeFieldBegin('user', TType::STRING, 2);
      $xfer += $output->writeString($this->user);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->hostname !== null) {
      $xfer += $output->writeFieldBegin('hostname', TType::STRING, 3);
      $xfer += $output->writeString($this->hostname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->agentInfo !== null) {
      $xfer += $output->writeFieldBegin('agentInfo', TType::STRING, 4);
      $xfer += $output->writeString($this->agentInfo);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class OpenTxnsResponse {
  static $_TSPEC;

  /**
   * @var int[]
   */
  public $txn_ids = null;

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

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

  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->txn_ids = array();
            $_size393 = 0;
            $_etype396 = 0;
            $xfer += $input->readListBegin($_etype396, $_size393);
            for ($_i397 = 0; $_i397 < $_size393; ++$_i397)
            {
              $elem398 = null;
              $xfer += $input->readI64($elem398);
              $this->txn_ids []= $elem398;
            }
            $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('OpenTxnsResponse');
    if ($this->txn_ids !== null) {
      if (!is_array($this->txn_ids)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('txn_ids', TType::LST, 1);
      {
        $output->writeListBegin(TType::I64, count($this->txn_ids));
        {
          foreach ($this->txn_ids as $iter399)
          {
            $xfer += $output->writeI64($iter399);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class AbortTxnRequest {
  static $_TSPEC;

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

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

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

  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->txnid);
          } 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('AbortTxnRequest');
    if ($this->txnid !== null) {
      $xfer += $output->writeFieldBegin('txnid', TType::I64, 1);
      $xfer += $output->writeI64($this->txnid);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class CommitTxnRequest {
  static $_TSPEC;

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

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

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

  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->txnid);
          } 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('CommitTxnRequest');
    if ($this->txnid !== null) {
      $xfer += $output->writeFieldBegin('txnid', TType::I64, 1);
      $xfer += $output->writeI64($this->txnid);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class LockComponent {
  static $_TSPEC;

  /**
   * @var int
   */
  public $type = null;
  /**
   * @var int
   */
  public $level = null;
  /**
   * @var string
   */
  public $dbname = null;
  /**
   * @var string
   */
  public $tablename = null;
  /**
   * @var string
   */
  public $partitionname = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'type',
          'type' => TType::I32,
          ),
        2 => array(
          'var' => 'level',
          'type' => TType::I32,
          ),
        3 => array(
          'var' => 'dbname',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'tablename',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'partitionname',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['type'])) {
        $this->type = $vals['type'];
      }
      if (isset($vals['level'])) {
        $this->level = $vals['level'];
      }
      if (isset($vals['dbname'])) {
        $this->dbname = $vals['dbname'];
      }
      if (isset($vals['tablename'])) {
        $this->tablename = $vals['tablename'];
      }
      if (isset($vals['partitionname'])) {
        $this->partitionname = $vals['partitionname'];
      }
    }
  }

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

  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::I32) {
            $xfer += $input->readI32($this->level);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->dbname);
          } 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->partitionname);
          } 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('LockComponent');
    if ($this->type !== null) {
      $xfer += $output->writeFieldBegin('type', TType::I32, 1);
      $xfer += $output->writeI32($this->type);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->level !== null) {
      $xfer += $output->writeFieldBegin('level', TType::I32, 2);
      $xfer += $output->writeI32($this->level);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dbname !== null) {
      $xfer += $output->writeFieldBegin('dbname', TType::STRING, 3);
      $xfer += $output->writeString($this->dbname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tablename !== null) {
      $xfer += $output->writeFieldBegin('tablename', TType::STRING, 4);
      $xfer += $output->writeString($this->tablename);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partitionname !== null) {
      $xfer += $output->writeFieldBegin('partitionname', TType::STRING, 5);
      $xfer += $output->writeString($this->partitionname);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class LockRequest {
  static $_TSPEC;

  /**
   * @var \metastore\LockComponent[]
   */
  public $component = null;
  /**
   * @var int
   */
  public $txnid = null;
  /**
   * @var string
   */
  public $user = null;
  /**
   * @var string
   */
  public $hostname = null;
  /**
   * @var string
   */
  public $agentInfo = "Unknown";

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'component',
          'type' => TType::LST,
          'etype' => TType::STRUCT,
          'elem' => array(
            'type' => TType::STRUCT,
            'class' => '\metastore\LockComponent',
            ),
          ),
        2 => array(
          'var' => 'txnid',
          'type' => TType::I64,
          ),
        3 => array(
          'var' => 'user',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'hostname',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'agentInfo',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['component'])) {
        $this->component = $vals['component'];
      }
      if (isset($vals['txnid'])) {
        $this->txnid = $vals['txnid'];
      }
      if (isset($vals['user'])) {
        $this->user = $vals['user'];
      }
      if (isset($vals['hostname'])) {
        $this->hostname = $vals['hostname'];
      }
      if (isset($vals['agentInfo'])) {
        $this->agentInfo = $vals['agentInfo'];
      }
    }
  }

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

  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->component = array();
            $_size400 = 0;
            $_etype403 = 0;
            $xfer += $input->readListBegin($_etype403, $_size400);
            for ($_i404 = 0; $_i404 < $_size400; ++$_i404)
            {
              $elem405 = null;
              $elem405 = new \metastore\LockComponent();
              $xfer += $elem405->read($input);
              $this->component []= $elem405;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->txnid);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->user);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->hostname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->agentInfo);
          } 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('LockRequest');
    if ($this->component !== null) {
      if (!is_array($this->component)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('component', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->component));
        {
          foreach ($this->component as $iter406)
          {
            $xfer += $iter406->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->txnid !== null) {
      $xfer += $output->writeFieldBegin('txnid', TType::I64, 2);
      $xfer += $output->writeI64($this->txnid);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->user !== null) {
      $xfer += $output->writeFieldBegin('user', TType::STRING, 3);
      $xfer += $output->writeString($this->user);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->hostname !== null) {
      $xfer += $output->writeFieldBegin('hostname', TType::STRING, 4);
      $xfer += $output->writeString($this->hostname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->agentInfo !== null) {
      $xfer += $output->writeFieldBegin('agentInfo', TType::STRING, 5);
      $xfer += $output->writeString($this->agentInfo);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class LockResponse {
  static $_TSPEC;

  /**
   * @var int
   */
  public $lockid = null;
  /**
   * @var int
   */
  public $state = null;

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

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

  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->lockid);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->state);
          } 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('LockResponse');
    if ($this->lockid !== null) {
      $xfer += $output->writeFieldBegin('lockid', TType::I64, 1);
      $xfer += $output->writeI64($this->lockid);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->state !== null) {
      $xfer += $output->writeFieldBegin('state', TType::I32, 2);
      $xfer += $output->writeI32($this->state);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class CheckLockRequest {
  static $_TSPEC;

  /**
   * @var int
   */
  public $lockid = null;
  /**
   * @var int
   */
  public $txnid = null;
  /**
   * @var int
   */
  public $elapsed_ms = null;

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

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

  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->lockid);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->txnid);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->elapsed_ms);
          } 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('CheckLockRequest');
    if ($this->lockid !== null) {
      $xfer += $output->writeFieldBegin('lockid', TType::I64, 1);
      $xfer += $output->writeI64($this->lockid);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->txnid !== null) {
      $xfer += $output->writeFieldBegin('txnid', TType::I64, 2);
      $xfer += $output->writeI64($this->txnid);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->elapsed_ms !== null) {
      $xfer += $output->writeFieldBegin('elapsed_ms', TType::I64, 3);
      $xfer += $output->writeI64($this->elapsed_ms);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class UnlockRequest {
  static $_TSPEC;

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

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

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

  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->lockid);
          } 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('UnlockRequest');
    if ($this->lockid !== null) {
      $xfer += $output->writeFieldBegin('lockid', TType::I64, 1);
      $xfer += $output->writeI64($this->lockid);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ShowLocksRequest {
  static $_TSPEC;

  /**
   * @var string
   */
  public $dbname = null;
  /**
   * @var string
   */
  public $tablename = null;
  /**
   * @var string
   */
  public $partname = null;
  /**
   * @var bool
   */
  public $isExtended = false;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'dbname',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'tablename',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'partname',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'isExtended',
          'type' => TType::BOOL,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['dbname'])) {
        $this->dbname = $vals['dbname'];
      }
      if (isset($vals['tablename'])) {
        $this->tablename = $vals['tablename'];
      }
      if (isset($vals['partname'])) {
        $this->partname = $vals['partname'];
      }
      if (isset($vals['isExtended'])) {
        $this->isExtended = $vals['isExtended'];
      }
    }
  }

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

  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->dbname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tablename);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->partname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->isExtended);
          } 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('ShowLocksRequest');
    if ($this->dbname !== null) {
      $xfer += $output->writeFieldBegin('dbname', TType::STRING, 1);
      $xfer += $output->writeString($this->dbname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tablename !== null) {
      $xfer += $output->writeFieldBegin('tablename', TType::STRING, 2);
      $xfer += $output->writeString($this->tablename);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partname !== null) {
      $xfer += $output->writeFieldBegin('partname', TType::STRING, 3);
      $xfer += $output->writeString($this->partname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->isExtended !== null) {
      $xfer += $output->writeFieldBegin('isExtended', TType::BOOL, 4);
      $xfer += $output->writeBool($this->isExtended);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ShowLocksResponseElement {
  static $_TSPEC;

  /**
   * @var int
   */
  public $lockid = null;
  /**
   * @var string
   */
  public $dbname = null;
  /**
   * @var string
   */
  public $tablename = null;
  /**
   * @var string
   */
  public $partname = null;
  /**
   * @var int
   */
  public $state = null;
  /**
   * @var int
   */
  public $type = null;
  /**
   * @var int
   */
  public $txnid = null;
  /**
   * @var int
   */
  public $lastheartbeat = null;
  /**
   * @var int
   */
  public $acquiredat = null;
  /**
   * @var string
   */
  public $user = null;
  /**
   * @var string
   */
  public $hostname = null;
  /**
   * @var int
   */
  public $heartbeatCount = 0;
  /**
   * @var string
   */
  public $agentInfo = null;
  /**
   * @var int
   */
  public $blockedByExtId = null;
  /**
   * @var int
   */
  public $blockedByIntId = null;
  /**
   * @var int
   */
  public $lockIdInternal = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'lockid',
          'type' => TType::I64,
          ),
        2 => array(
          'var' => 'dbname',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'tablename',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'partname',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'state',
          'type' => TType::I32,
          ),
        6 => array(
          'var' => 'type',
          'type' => TType::I32,
          ),
        7 => array(
          'var' => 'txnid',
          'type' => TType::I64,
          ),
        8 => array(
          'var' => 'lastheartbeat',
          'type' => TType::I64,
          ),
        9 => array(
          'var' => 'acquiredat',
          'type' => TType::I64,
          ),
        10 => array(
          'var' => 'user',
          'type' => TType::STRING,
          ),
        11 => array(
          'var' => 'hostname',
          'type' => TType::STRING,
          ),
        12 => array(
          'var' => 'heartbeatCount',
          'type' => TType::I32,
          ),
        13 => array(
          'var' => 'agentInfo',
          'type' => TType::STRING,
          ),
        14 => array(
          'var' => 'blockedByExtId',
          'type' => TType::I64,
          ),
        15 => array(
          'var' => 'blockedByIntId',
          'type' => TType::I64,
          ),
        16 => array(
          'var' => 'lockIdInternal',
          'type' => TType::I64,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['lockid'])) {
        $this->lockid = $vals['lockid'];
      }
      if (isset($vals['dbname'])) {
        $this->dbname = $vals['dbname'];
      }
      if (isset($vals['tablename'])) {
        $this->tablename = $vals['tablename'];
      }
      if (isset($vals['partname'])) {
        $this->partname = $vals['partname'];
      }
      if (isset($vals['state'])) {
        $this->state = $vals['state'];
      }
      if (isset($vals['type'])) {
        $this->type = $vals['type'];
      }
      if (isset($vals['txnid'])) {
        $this->txnid = $vals['txnid'];
      }
      if (isset($vals['lastheartbeat'])) {
        $this->lastheartbeat = $vals['lastheartbeat'];
      }
      if (isset($vals['acquiredat'])) {
        $this->acquiredat = $vals['acquiredat'];
      }
      if (isset($vals['user'])) {
        $this->user = $vals['user'];
      }
      if (isset($vals['hostname'])) {
        $this->hostname = $vals['hostname'];
      }
      if (isset($vals['heartbeatCount'])) {
        $this->heartbeatCount = $vals['heartbeatCount'];
      }
      if (isset($vals['agentInfo'])) {
        $this->agentInfo = $vals['agentInfo'];
      }
      if (isset($vals['blockedByExtId'])) {
        $this->blockedByExtId = $vals['blockedByExtId'];
      }
      if (isset($vals['blockedByIntId'])) {
        $this->blockedByIntId = $vals['blockedByIntId'];
      }
      if (isset($vals['lockIdInternal'])) {
        $this->lockIdInternal = $vals['lockIdInternal'];
      }
    }
  }

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

  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->lockid);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->dbname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tablename);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->partname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->state);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->type);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->txnid);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->lastheartbeat);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->acquiredat);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->user);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 11:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->hostname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 12:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->heartbeatCount);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 13:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->agentInfo);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 14:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->blockedByExtId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 15:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->blockedByIntId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 16:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->lockIdInternal);
          } 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('ShowLocksResponseElement');
    if ($this->lockid !== null) {
      $xfer += $output->writeFieldBegin('lockid', TType::I64, 1);
      $xfer += $output->writeI64($this->lockid);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dbname !== null) {
      $xfer += $output->writeFieldBegin('dbname', TType::STRING, 2);
      $xfer += $output->writeString($this->dbname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tablename !== null) {
      $xfer += $output->writeFieldBegin('tablename', TType::STRING, 3);
      $xfer += $output->writeString($this->tablename);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partname !== null) {
      $xfer += $output->writeFieldBegin('partname', TType::STRING, 4);
      $xfer += $output->writeString($this->partname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->state !== null) {
      $xfer += $output->writeFieldBegin('state', TType::I32, 5);
      $xfer += $output->writeI32($this->state);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->type !== null) {
      $xfer += $output->writeFieldBegin('type', TType::I32, 6);
      $xfer += $output->writeI32($this->type);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->txnid !== null) {
      $xfer += $output->writeFieldBegin('txnid', TType::I64, 7);
      $xfer += $output->writeI64($this->txnid);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->lastheartbeat !== null) {
      $xfer += $output->writeFieldBegin('lastheartbeat', TType::I64, 8);
      $xfer += $output->writeI64($this->lastheartbeat);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->acquiredat !== null) {
      $xfer += $output->writeFieldBegin('acquiredat', TType::I64, 9);
      $xfer += $output->writeI64($this->acquiredat);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->user !== null) {
      $xfer += $output->writeFieldBegin('user', TType::STRING, 10);
      $xfer += $output->writeString($this->user);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->hostname !== null) {
      $xfer += $output->writeFieldBegin('hostname', TType::STRING, 11);
      $xfer += $output->writeString($this->hostname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->heartbeatCount !== null) {
      $xfer += $output->writeFieldBegin('heartbeatCount', TType::I32, 12);
      $xfer += $output->writeI32($this->heartbeatCount);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->agentInfo !== null) {
      $xfer += $output->writeFieldBegin('agentInfo', TType::STRING, 13);
      $xfer += $output->writeString($this->agentInfo);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->blockedByExtId !== null) {
      $xfer += $output->writeFieldBegin('blockedByExtId', TType::I64, 14);
      $xfer += $output->writeI64($this->blockedByExtId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->blockedByIntId !== null) {
      $xfer += $output->writeFieldBegin('blockedByIntId', TType::I64, 15);
      $xfer += $output->writeI64($this->blockedByIntId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->lockIdInternal !== null) {
      $xfer += $output->writeFieldBegin('lockIdInternal', TType::I64, 16);
      $xfer += $output->writeI64($this->lockIdInternal);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ShowLocksResponse {
  static $_TSPEC;

  /**
   * @var \metastore\ShowLocksResponseElement[]
   */
  public $locks = null;

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

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

  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->locks = array();
            $_size407 = 0;
            $_etype410 = 0;
            $xfer += $input->readListBegin($_etype410, $_size407);
            for ($_i411 = 0; $_i411 < $_size407; ++$_i411)
            {
              $elem412 = null;
              $elem412 = new \metastore\ShowLocksResponseElement();
              $xfer += $elem412->read($input);
              $this->locks []= $elem412;
            }
            $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('ShowLocksResponse');
    if ($this->locks !== null) {
      if (!is_array($this->locks)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('locks', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->locks));
        {
          foreach ($this->locks as $iter413)
          {
            $xfer += $iter413->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class HeartbeatRequest {
  static $_TSPEC;

  /**
   * @var int
   */
  public $lockid = null;
  /**
   * @var int
   */
  public $txnid = null;

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

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

  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->lockid);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->txnid);
          } 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('HeartbeatRequest');
    if ($this->lockid !== null) {
      $xfer += $output->writeFieldBegin('lockid', TType::I64, 1);
      $xfer += $output->writeI64($this->lockid);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->txnid !== null) {
      $xfer += $output->writeFieldBegin('txnid', TType::I64, 2);
      $xfer += $output->writeI64($this->txnid);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class HeartbeatTxnRangeRequest {
  static $_TSPEC;

  /**
   * @var int
   */
  public $min = null;
  /**
   * @var int
   */
  public $max = null;

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

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

  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->min);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->max);
          } 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('HeartbeatTxnRangeRequest');
    if ($this->min !== null) {
      $xfer += $output->writeFieldBegin('min', TType::I64, 1);
      $xfer += $output->writeI64($this->min);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->max !== null) {
      $xfer += $output->writeFieldBegin('max', TType::I64, 2);
      $xfer += $output->writeI64($this->max);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class HeartbeatTxnRangeResponse {
  static $_TSPEC;

  /**
   * @var int[]
   */
  public $aborted = null;
  /**
   * @var int[]
   */
  public $nosuch = null;

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

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

  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::SET) {
            $this->aborted = array();
            $_size414 = 0;
            $_etype417 = 0;
            $xfer += $input->readSetBegin($_etype417, $_size414);
            for ($_i418 = 0; $_i418 < $_size414; ++$_i418)
            {
              $elem419 = null;
              $xfer += $input->readI64($elem419);
              if (is_scalar($elem419)) {
                $this->aborted[$elem419] = true;
              } else {
                $this->aborted []= $elem419;
              }
            }
            $xfer += $input->readSetEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::SET) {
            $this->nosuch = array();
            $_size420 = 0;
            $_etype423 = 0;
            $xfer += $input->readSetBegin($_etype423, $_size420);
            for ($_i424 = 0; $_i424 < $_size420; ++$_i424)
            {
              $elem425 = null;
              $xfer += $input->readI64($elem425);
              if (is_scalar($elem425)) {
                $this->nosuch[$elem425] = true;
              } else {
                $this->nosuch []= $elem425;
              }
            }
            $xfer += $input->readSetEnd();
          } 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('HeartbeatTxnRangeResponse');
    if ($this->aborted !== null) {
      if (!is_array($this->aborted)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('aborted', TType::SET, 1);
      {
        $output->writeSetBegin(TType::I64, count($this->aborted));
        {
          foreach ($this->aborted as $iter426 => $iter427)
          {
            if (is_scalar($iter427)) {
            $xfer += $output->writeI64($iter426);
            } else {
            $xfer += $output->writeI64($iter427);
            }
          }
        }
        $output->writeSetEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->nosuch !== null) {
      if (!is_array($this->nosuch)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('nosuch', TType::SET, 2);
      {
        $output->writeSetBegin(TType::I64, count($this->nosuch));
        {
          foreach ($this->nosuch as $iter428 => $iter429)
          {
            if (is_scalar($iter429)) {
            $xfer += $output->writeI64($iter428);
            } else {
            $xfer += $output->writeI64($iter429);
            }
          }
        }
        $output->writeSetEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class CompactionRequest {
  static $_TSPEC;

  /**
   * @var string
   */
  public $dbname = null;
  /**
   * @var string
   */
  public $tablename = null;
  /**
   * @var string
   */
  public $partitionname = null;
  /**
   * @var int
   */
  public $type = null;
  /**
   * @var string
   */
  public $runas = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'dbname',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'tablename',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'partitionname',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'type',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'runas',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['dbname'])) {
        $this->dbname = $vals['dbname'];
      }
      if (isset($vals['tablename'])) {
        $this->tablename = $vals['tablename'];
      }
      if (isset($vals['partitionname'])) {
        $this->partitionname = $vals['partitionname'];
      }
      if (isset($vals['type'])) {
        $this->type = $vals['type'];
      }
      if (isset($vals['runas'])) {
        $this->runas = $vals['runas'];
      }
    }
  }

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

  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->dbname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tablename);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->partitionname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->type);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->runas);
          } 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('CompactionRequest');
    if ($this->dbname !== null) {
      $xfer += $output->writeFieldBegin('dbname', TType::STRING, 1);
      $xfer += $output->writeString($this->dbname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tablename !== null) {
      $xfer += $output->writeFieldBegin('tablename', TType::STRING, 2);
      $xfer += $output->writeString($this->tablename);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partitionname !== null) {
      $xfer += $output->writeFieldBegin('partitionname', TType::STRING, 3);
      $xfer += $output->writeString($this->partitionname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->type !== null) {
      $xfer += $output->writeFieldBegin('type', TType::I32, 4);
      $xfer += $output->writeI32($this->type);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->runas !== null) {
      $xfer += $output->writeFieldBegin('runas', TType::STRING, 5);
      $xfer += $output->writeString($this->runas);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ShowCompactRequest {
  static $_TSPEC;


  public function __construct() {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        );
    }
  }

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

  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)
      {
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('ShowCompactRequest');
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ShowCompactResponseElement {
  static $_TSPEC;

  /**
   * @var string
   */
  public $dbname = null;
  /**
   * @var string
   */
  public $tablename = null;
  /**
   * @var string
   */
  public $partitionname = null;
  /**
   * @var int
   */
  public $type = null;
  /**
   * @var string
   */
  public $state = null;
  /**
   * @var string
   */
  public $workerid = null;
  /**
   * @var int
   */
  public $start = null;
  /**
   * @var string
   */
  public $runAs = null;
  /**
   * @var int
   */
  public $hightestTxnId = null;
  /**
   * @var string
   */
  public $metaInfo = null;
  /**
   * @var int
   */
  public $endTime = null;
  /**
   * @var string
   */
  public $hadoopJobId = "None";

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'dbname',
          'type' => TType::STRING,
          ),
        2 => array(
          'var' => 'tablename',
          'type' => TType::STRING,
          ),
        3 => array(
          'var' => 'partitionname',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'type',
          'type' => TType::I32,
          ),
        5 => array(
          'var' => 'state',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'workerid',
          'type' => TType::STRING,
          ),
        7 => array(
          'var' => 'start',
          'type' => TType::I64,
          ),
        8 => array(
          'var' => 'runAs',
          'type' => TType::STRING,
          ),
        9 => array(
          'var' => 'hightestTxnId',
          'type' => TType::I64,
          ),
        10 => array(
          'var' => 'metaInfo',
          'type' => TType::STRING,
          ),
        11 => array(
          'var' => 'endTime',
          'type' => TType::I64,
          ),
        12 => array(
          'var' => 'hadoopJobId',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['dbname'])) {
        $this->dbname = $vals['dbname'];
      }
      if (isset($vals['tablename'])) {
        $this->tablename = $vals['tablename'];
      }
      if (isset($vals['partitionname'])) {
        $this->partitionname = $vals['partitionname'];
      }
      if (isset($vals['type'])) {
        $this->type = $vals['type'];
      }
      if (isset($vals['state'])) {
        $this->state = $vals['state'];
      }
      if (isset($vals['workerid'])) {
        $this->workerid = $vals['workerid'];
      }
      if (isset($vals['start'])) {
        $this->start = $vals['start'];
      }
      if (isset($vals['runAs'])) {
        $this->runAs = $vals['runAs'];
      }
      if (isset($vals['hightestTxnId'])) {
        $this->hightestTxnId = $vals['hightestTxnId'];
      }
      if (isset($vals['metaInfo'])) {
        $this->metaInfo = $vals['metaInfo'];
      }
      if (isset($vals['endTime'])) {
        $this->endTime = $vals['endTime'];
      }
      if (isset($vals['hadoopJobId'])) {
        $this->hadoopJobId = $vals['hadoopJobId'];
      }
    }
  }

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

  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->dbname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tablename);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->partitionname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->type);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->state);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->workerid);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 7:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->start);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 8:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->runAs);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 9:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->hightestTxnId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 10:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->metaInfo);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 11:
          if ($ftype == TType::I64) {
            $xfer += $input->readI64($this->endTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 12:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->hadoopJobId);
          } 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('ShowCompactResponseElement');
    if ($this->dbname !== null) {
      $xfer += $output->writeFieldBegin('dbname', TType::STRING, 1);
      $xfer += $output->writeString($this->dbname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tablename !== null) {
      $xfer += $output->writeFieldBegin('tablename', TType::STRING, 2);
      $xfer += $output->writeString($this->tablename);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partitionname !== null) {
      $xfer += $output->writeFieldBegin('partitionname', TType::STRING, 3);
      $xfer += $output->writeString($this->partitionname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->type !== null) {
      $xfer += $output->writeFieldBegin('type', TType::I32, 4);
      $xfer += $output->writeI32($this->type);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->state !== null) {
      $xfer += $output->writeFieldBegin('state', TType::STRING, 5);
      $xfer += $output->writeString($this->state);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->workerid !== null) {
      $xfer += $output->writeFieldBegin('workerid', TType::STRING, 6);
      $xfer += $output->writeString($this->workerid);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->start !== null) {
      $xfer += $output->writeFieldBegin('start', TType::I64, 7);
      $xfer += $output->writeI64($this->start);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->runAs !== null) {
      $xfer += $output->writeFieldBegin('runAs', TType::STRING, 8);
      $xfer += $output->writeString($this->runAs);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->hightestTxnId !== null) {
      $xfer += $output->writeFieldBegin('hightestTxnId', TType::I64, 9);
      $xfer += $output->writeI64($this->hightestTxnId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->metaInfo !== null) {
      $xfer += $output->writeFieldBegin('metaInfo', TType::STRING, 10);
      $xfer += $output->writeString($this->metaInfo);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->endTime !== null) {
      $xfer += $output->writeFieldBegin('endTime', TType::I64, 11);
      $xfer += $output->writeI64($this->endTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->hadoopJobId !== null) {
      $xfer += $output->writeFieldBegin('hadoopJobId', TType::STRING, 12);
      $xfer += $output->writeString($this->hadoopJobId);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ShowCompactResponse {
  static $_TSPEC;

  /**
   * @var \metastore\ShowCompactResponseElement[]
   */
  public $compacts = null;

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

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

  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->compacts = array();
            $_size430 = 0;
            $_etype433 = 0;
            $xfer += $input->readListBegin($_etype433, $_size430);
            for ($_i434 = 0; $_i434 < $_size430; ++$_i434)
            {
              $elem435 = null;
              $elem435 = new \metastore\ShowCompactResponseElement();
              $xfer += $elem435->read($input);
              $this->compacts []= $elem435;
            }
            $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('ShowCompactResponse');
    if ($this->compacts !== null) {
      if (!is_array($this->compacts)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('compacts', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->compacts));
        {
          foreach ($this->compacts as $iter436)
          {
            $xfer += $iter436->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class AddDynamicPartitions {
  static $_TSPEC;

  /**
   * @var int
   */
  public $txnid = null;
  /**
   * @var string
   */
  public $dbname = null;
  /**
   * @var string
   */
  public $tablename = null;
  /**
   * @var string[]
   */
  public $partitionnames = null;

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

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

  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->txnid);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->dbname);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tablename);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::LST) {
            $this->partitionnames = array();
            $_size437 = 0;
            $_etype440 = 0;
            $xfer += $input->readListBegin($_etype440, $_size437);
            for ($_i441 = 0; $_i441 < $_size437; ++$_i441)
            {
              $elem442 = null;
              $xfer += $input->readString($elem442);
              $this->partitionnames []= $elem442;
            }
            $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('AddDynamicPartitions');
    if ($this->txnid !== null) {
      $xfer += $output->writeFieldBegin('txnid', TType::I64, 1);
      $xfer += $output->writeI64($this->txnid);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dbname !== null) {
      $xfer += $output->writeFieldBegin('dbname', TType::STRING, 2);
      $xfer += $output->writeString($this->dbname);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tablename !== null) {
      $xfer += $output->writeFieldBegin('tablename', TType::STRING, 3);
      $xfer += $output->writeString($this->tablename);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partitionnames !== null) {
      if (!is_array($this->partitionnames)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partitionnames', TType::LST, 4);
      {
        $output->writeListBegin(TType::STRING, count($this->partitionnames));
        {
          foreach ($this->partitionnames as $iter443)
          {
            $xfer += $output->writeString($iter443);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class NotificationEventRequest {
  static $_TSPEC;

  /**
   * @var int
   */
  public $lastEvent = null;
  /**
   * @var int
   */
  public $maxEvents = null;

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

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

  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->lastEvent);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->maxEvents);
          } 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('NotificationEventRequest');
    if ($this->lastEvent !== null) {
      $xfer += $output->writeFieldBegin('lastEvent', TType::I64, 1);
      $xfer += $output->writeI64($this->lastEvent);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->maxEvents !== null) {
      $xfer += $output->writeFieldBegin('maxEvents', TType::I32, 2);
      $xfer += $output->writeI32($this->maxEvents);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class NotificationEvent {
  static $_TSPEC;

  /**
   * @var int
   */
  public $eventId = null;
  /**
   * @var int
   */
  public $eventTime = null;
  /**
   * @var string
   */
  public $eventType = null;
  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $tableName = null;
  /**
   * @var string
   */
  public $message = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'eventId',
          'type' => TType::I64,
          ),
        2 => array(
          'var' => 'eventTime',
          'type' => TType::I32,
          ),
        3 => array(
          'var' => 'eventType',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'dbName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'tableName',
          'type' => TType::STRING,
          ),
        6 => array(
          'var' => 'message',
          'type' => TType::STRING,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['eventId'])) {
        $this->eventId = $vals['eventId'];
      }
      if (isset($vals['eventTime'])) {
        $this->eventTime = $vals['eventTime'];
      }
      if (isset($vals['eventType'])) {
        $this->eventType = $vals['eventType'];
      }
      if (isset($vals['dbName'])) {
        $this->dbName = $vals['dbName'];
      }
      if (isset($vals['tableName'])) {
        $this->tableName = $vals['tableName'];
      }
      if (isset($vals['message'])) {
        $this->message = $vals['message'];
      }
    }
  }

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

  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->eventId);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->eventTime);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->eventType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 5:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 6:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->message);
          } 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('NotificationEvent');
    if ($this->eventId !== null) {
      $xfer += $output->writeFieldBegin('eventId', TType::I64, 1);
      $xfer += $output->writeI64($this->eventId);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->eventTime !== null) {
      $xfer += $output->writeFieldBegin('eventTime', TType::I32, 2);
      $xfer += $output->writeI32($this->eventTime);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->eventType !== null) {
      $xfer += $output->writeFieldBegin('eventType', TType::STRING, 3);
      $xfer += $output->writeString($this->eventType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 4);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableName !== null) {
      $xfer += $output->writeFieldBegin('tableName', TType::STRING, 5);
      $xfer += $output->writeString($this->tableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 6);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class NotificationEventResponse {
  static $_TSPEC;

  /**
   * @var \metastore\NotificationEvent[]
   */
  public $events = null;

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

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

  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->events = array();
            $_size444 = 0;
            $_etype447 = 0;
            $xfer += $input->readListBegin($_etype447, $_size444);
            for ($_i448 = 0; $_i448 < $_size444; ++$_i448)
            {
              $elem449 = null;
              $elem449 = new \metastore\NotificationEvent();
              $xfer += $elem449->read($input);
              $this->events []= $elem449;
            }
            $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('NotificationEventResponse');
    if ($this->events !== null) {
      if (!is_array($this->events)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('events', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->events));
        {
          foreach ($this->events as $iter450)
          {
            $xfer += $iter450->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class CurrentNotificationEventId {
  static $_TSPEC;

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

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

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

  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->eventId);
          } 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('CurrentNotificationEventId');
    if ($this->eventId !== null) {
      $xfer += $output->writeFieldBegin('eventId', TType::I64, 1);
      $xfer += $output->writeI64($this->eventId);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class InsertEventRequestData {
  static $_TSPEC;

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

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

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

  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->filesAdded = array();
            $_size451 = 0;
            $_etype454 = 0;
            $xfer += $input->readListBegin($_etype454, $_size451);
            for ($_i455 = 0; $_i455 < $_size451; ++$_i455)
            {
              $elem456 = null;
              $xfer += $input->readString($elem456);
              $this->filesAdded []= $elem456;
            }
            $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('InsertEventRequestData');
    if ($this->filesAdded !== null) {
      if (!is_array($this->filesAdded)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('filesAdded', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRING, count($this->filesAdded));
        {
          foreach ($this->filesAdded as $iter457)
          {
            $xfer += $output->writeString($iter457);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class FireEventRequestData {
  static $_TSPEC;

  /**
   * @var \metastore\InsertEventRequestData
   */
  public $insertData = null;

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

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

  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->insertData = new \metastore\InsertEventRequestData();
            $xfer += $this->insertData->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('FireEventRequestData');
    if ($this->insertData !== null) {
      if (!is_object($this->insertData)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('insertData', TType::STRUCT, 1);
      $xfer += $this->insertData->write($output);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class FireEventRequest {
  static $_TSPEC;

  /**
   * @var bool
   */
  public $successful = null;
  /**
   * @var \metastore\FireEventRequestData
   */
  public $data = null;
  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $tableName = null;
  /**
   * @var string[]
   */
  public $partitionVals = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'successful',
          'type' => TType::BOOL,
          ),
        2 => array(
          'var' => 'data',
          'type' => TType::STRUCT,
          'class' => '\metastore\FireEventRequestData',
          ),
        3 => array(
          'var' => 'dbName',
          'type' => TType::STRING,
          ),
        4 => array(
          'var' => 'tableName',
          'type' => TType::STRING,
          ),
        5 => array(
          'var' => 'partitionVals',
          'type' => TType::LST,
          'etype' => TType::STRING,
          'elem' => array(
            'type' => TType::STRING,
            ),
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['successful'])) {
        $this->successful = $vals['successful'];
      }
      if (isset($vals['data'])) {
        $this->data = $vals['data'];
      }
      if (isset($vals['dbName'])) {
        $this->dbName = $vals['dbName'];
      }
      if (isset($vals['tableName'])) {
        $this->tableName = $vals['tableName'];
      }
      if (isset($vals['partitionVals'])) {
        $this->partitionVals = $vals['partitionVals'];
      }
    }
  }

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

  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->successful);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRUCT) {
            $this->data = new \metastore\FireEventRequestData();
            $xfer += $this->data->read($input);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->dbName);
          } 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->partitionVals = array();
            $_size458 = 0;
            $_etype461 = 0;
            $xfer += $input->readListBegin($_etype461, $_size458);
            for ($_i462 = 0; $_i462 < $_size458; ++$_i462)
            {
              $elem463 = null;
              $xfer += $input->readString($elem463);
              $this->partitionVals []= $elem463;
            }
            $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('FireEventRequest');
    if ($this->successful !== null) {
      $xfer += $output->writeFieldBegin('successful', TType::BOOL, 1);
      $xfer += $output->writeBool($this->successful);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->data !== null) {
      if (!is_object($this->data)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('data', TType::STRUCT, 2);
      $xfer += $this->data->write($output);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 3);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableName !== null) {
      $xfer += $output->writeFieldBegin('tableName', TType::STRING, 4);
      $xfer += $output->writeString($this->tableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->partitionVals !== null) {
      if (!is_array($this->partitionVals)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('partitionVals', TType::LST, 5);
      {
        $output->writeListBegin(TType::STRING, count($this->partitionVals));
        {
          foreach ($this->partitionVals as $iter464)
          {
            $xfer += $output->writeString($iter464);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class FireEventResponse {
  static $_TSPEC;


  public function __construct() {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        );
    }
  }

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

  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)
      {
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('FireEventResponse');
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class MetadataPpdResult {
  static $_TSPEC;

  /**
   * @var string
   */
  public $metadata = null;
  /**
   * @var string
   */
  public $includeBitset = null;

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

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

  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->metadata);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->includeBitset);
          } 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('MetadataPpdResult');
    if ($this->metadata !== null) {
      $xfer += $output->writeFieldBegin('metadata', TType::STRING, 1);
      $xfer += $output->writeString($this->metadata);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->includeBitset !== null) {
      $xfer += $output->writeFieldBegin('includeBitset', TType::STRING, 2);
      $xfer += $output->writeString($this->includeBitset);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GetFileMetadataByExprResult {
  static $_TSPEC;

  /**
   * @var array
   */
  public $metadata = null;
  /**
   * @var bool
   */
  public $isSupported = null;

  public function __construct($vals=null) {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        1 => array(
          'var' => 'metadata',
          'type' => TType::MAP,
          'ktype' => TType::I64,
          'vtype' => TType::STRUCT,
          'key' => array(
            'type' => TType::I64,
          ),
          'val' => array(
            'type' => TType::STRUCT,
            'class' => '\metastore\MetadataPpdResult',
            ),
          ),
        2 => array(
          'var' => 'isSupported',
          'type' => TType::BOOL,
          ),
        );
    }
    if (is_array($vals)) {
      if (isset($vals['metadata'])) {
        $this->metadata = $vals['metadata'];
      }
      if (isset($vals['isSupported'])) {
        $this->isSupported = $vals['isSupported'];
      }
    }
  }

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

  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->metadata = array();
            $_size465 = 0;
            $_ktype466 = 0;
            $_vtype467 = 0;
            $xfer += $input->readMapBegin($_ktype466, $_vtype467, $_size465);
            for ($_i469 = 0; $_i469 < $_size465; ++$_i469)
            {
              $key470 = 0;
              $val471 = new \metastore\MetadataPpdResult();
              $xfer += $input->readI64($key470);
              $val471 = new \metastore\MetadataPpdResult();
              $xfer += $val471->read($input);
              $this->metadata[$key470] = $val471;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->isSupported);
          } 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('GetFileMetadataByExprResult');
    if ($this->metadata !== null) {
      if (!is_array($this->metadata)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('metadata', TType::MAP, 1);
      {
        $output->writeMapBegin(TType::I64, TType::STRUCT, count($this->metadata));
        {
          foreach ($this->metadata as $kiter472 => $viter473)
          {
            $xfer += $output->writeI64($kiter472);
            $xfer += $viter473->write($output);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->isSupported !== null) {
      $xfer += $output->writeFieldBegin('isSupported', TType::BOOL, 2);
      $xfer += $output->writeBool($this->isSupported);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GetFileMetadataByExprRequest {
  static $_TSPEC;

  /**
   * @var int[]
   */
  public $fileIds = null;
  /**
   * @var string
   */
  public $expr = null;
  /**
   * @var bool
   */
  public $doGetFooters = null;
  /**
   * @var int
   */
  public $type = null;

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

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

  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->fileIds = array();
            $_size474 = 0;
            $_etype477 = 0;
            $xfer += $input->readListBegin($_etype477, $_size474);
            for ($_i478 = 0; $_i478 < $_size474; ++$_i478)
            {
              $elem479 = null;
              $xfer += $input->readI64($elem479);
              $this->fileIds []= $elem479;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->expr);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->doGetFooters);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::I32) {
            $xfer += $input->readI32($this->type);
          } 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('GetFileMetadataByExprRequest');
    if ($this->fileIds !== null) {
      if (!is_array($this->fileIds)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('fileIds', TType::LST, 1);
      {
        $output->writeListBegin(TType::I64, count($this->fileIds));
        {
          foreach ($this->fileIds as $iter480)
          {
            $xfer += $output->writeI64($iter480);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->expr !== null) {
      $xfer += $output->writeFieldBegin('expr', TType::STRING, 2);
      $xfer += $output->writeString($this->expr);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->doGetFooters !== null) {
      $xfer += $output->writeFieldBegin('doGetFooters', TType::BOOL, 3);
      $xfer += $output->writeBool($this->doGetFooters);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->type !== null) {
      $xfer += $output->writeFieldBegin('type', TType::I32, 4);
      $xfer += $output->writeI32($this->type);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GetFileMetadataResult {
  static $_TSPEC;

  /**
   * @var array
   */
  public $metadata = null;
  /**
   * @var bool
   */
  public $isSupported = null;

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

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

  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->metadata = array();
            $_size481 = 0;
            $_ktype482 = 0;
            $_vtype483 = 0;
            $xfer += $input->readMapBegin($_ktype482, $_vtype483, $_size481);
            for ($_i485 = 0; $_i485 < $_size481; ++$_i485)
            {
              $key486 = 0;
              $val487 = '';
              $xfer += $input->readI64($key486);
              $xfer += $input->readString($val487);
              $this->metadata[$key486] = $val487;
            }
            $xfer += $input->readMapEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::BOOL) {
            $xfer += $input->readBool($this->isSupported);
          } 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('GetFileMetadataResult');
    if ($this->metadata !== null) {
      if (!is_array($this->metadata)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('metadata', TType::MAP, 1);
      {
        $output->writeMapBegin(TType::I64, TType::STRING, count($this->metadata));
        {
          foreach ($this->metadata as $kiter488 => $viter489)
          {
            $xfer += $output->writeI64($kiter488);
            $xfer += $output->writeString($viter489);
          }
        }
        $output->writeMapEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->isSupported !== null) {
      $xfer += $output->writeFieldBegin('isSupported', TType::BOOL, 2);
      $xfer += $output->writeBool($this->isSupported);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GetFileMetadataRequest {
  static $_TSPEC;

  /**
   * @var int[]
   */
  public $fileIds = null;

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

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

  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->fileIds = array();
            $_size490 = 0;
            $_etype493 = 0;
            $xfer += $input->readListBegin($_etype493, $_size490);
            for ($_i494 = 0; $_i494 < $_size490; ++$_i494)
            {
              $elem495 = null;
              $xfer += $input->readI64($elem495);
              $this->fileIds []= $elem495;
            }
            $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('GetFileMetadataRequest');
    if ($this->fileIds !== null) {
      if (!is_array($this->fileIds)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('fileIds', TType::LST, 1);
      {
        $output->writeListBegin(TType::I64, count($this->fileIds));
        {
          foreach ($this->fileIds as $iter496)
          {
            $xfer += $output->writeI64($iter496);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PutFileMetadataResult {
  static $_TSPEC;


  public function __construct() {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        );
    }
  }

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

  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)
      {
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('PutFileMetadataResult');
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class PutFileMetadataRequest {
  static $_TSPEC;

  /**
   * @var int[]
   */
  public $fileIds = null;
  /**
   * @var string[]
   */
  public $metadata = null;

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

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

  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->fileIds = array();
            $_size497 = 0;
            $_etype500 = 0;
            $xfer += $input->readListBegin($_etype500, $_size497);
            for ($_i501 = 0; $_i501 < $_size497; ++$_i501)
            {
              $elem502 = null;
              $xfer += $input->readI64($elem502);
              $this->fileIds []= $elem502;
            }
            $xfer += $input->readListEnd();
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::LST) {
            $this->metadata = array();
            $_size503 = 0;
            $_etype506 = 0;
            $xfer += $input->readListBegin($_etype506, $_size503);
            for ($_i507 = 0; $_i507 < $_size503; ++$_i507)
            {
              $elem508 = null;
              $xfer += $input->readString($elem508);
              $this->metadata []= $elem508;
            }
            $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('PutFileMetadataRequest');
    if ($this->fileIds !== null) {
      if (!is_array($this->fileIds)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('fileIds', TType::LST, 1);
      {
        $output->writeListBegin(TType::I64, count($this->fileIds));
        {
          foreach ($this->fileIds as $iter509)
          {
            $xfer += $output->writeI64($iter509);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    if ($this->metadata !== null) {
      if (!is_array($this->metadata)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('metadata', TType::LST, 2);
      {
        $output->writeListBegin(TType::STRING, count($this->metadata));
        {
          foreach ($this->metadata as $iter510)
          {
            $xfer += $output->writeString($iter510);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ClearFileMetadataResult {
  static $_TSPEC;


  public function __construct() {
    if (!isset(self::$_TSPEC)) {
      self::$_TSPEC = array(
        );
    }
  }

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

  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)
      {
        default:
          $xfer += $input->skip($ftype);
          break;
      }
      $xfer += $input->readFieldEnd();
    }
    $xfer += $input->readStructEnd();
    return $xfer;
  }

  public function write($output) {
    $xfer = 0;
    $xfer += $output->writeStructBegin('ClearFileMetadataResult');
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ClearFileMetadataRequest {
  static $_TSPEC;

  /**
   * @var int[]
   */
  public $fileIds = null;

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

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

  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->fileIds = array();
            $_size511 = 0;
            $_etype514 = 0;
            $xfer += $input->readListBegin($_etype514, $_size511);
            for ($_i515 = 0; $_i515 < $_size511; ++$_i515)
            {
              $elem516 = null;
              $xfer += $input->readI64($elem516);
              $this->fileIds []= $elem516;
            }
            $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('ClearFileMetadataRequest');
    if ($this->fileIds !== null) {
      if (!is_array($this->fileIds)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('fileIds', TType::LST, 1);
      {
        $output->writeListBegin(TType::I64, count($this->fileIds));
        {
          foreach ($this->fileIds as $iter517)
          {
            $xfer += $output->writeI64($iter517);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class GetAllFunctionsResponse {
  static $_TSPEC;

  /**
   * @var \metastore\Function[]
   */
  public $functions = null;

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

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

  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->functions = array();
            $_size518 = 0;
            $_etype521 = 0;
            $xfer += $input->readListBegin($_etype521, $_size518);
            for ($_i522 = 0; $_i522 < $_size518; ++$_i522)
            {
              $elem523 = null;
              $elem523 = new \metastore\Function();
              $xfer += $elem523->read($input);
              $this->functions []= $elem523;
            }
            $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('GetAllFunctionsResponse');
    if ($this->functions !== null) {
      if (!is_array($this->functions)) {
        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
      }
      $xfer += $output->writeFieldBegin('functions', TType::LST, 1);
      {
        $output->writeListBegin(TType::STRUCT, count($this->functions));
        {
          foreach ($this->functions as $iter524)
          {
            $xfer += $iter524->write($output);
          }
        }
        $output->writeListEnd();
      }
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TableMeta {
  static $_TSPEC;

  /**
   * @var string
   */
  public $dbName = null;
  /**
   * @var string
   */
  public $tableName = null;
  /**
   * @var string
   */
  public $tableType = null;
  /**
   * @var string
   */
  public $comments = null;

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

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

  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->dbName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 2:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tableName);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 3:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->tableType);
          } else {
            $xfer += $input->skip($ftype);
          }
          break;
        case 4:
          if ($ftype == TType::STRING) {
            $xfer += $input->readString($this->comments);
          } 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('TableMeta');
    if ($this->dbName !== null) {
      $xfer += $output->writeFieldBegin('dbName', TType::STRING, 1);
      $xfer += $output->writeString($this->dbName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableName !== null) {
      $xfer += $output->writeFieldBegin('tableName', TType::STRING, 2);
      $xfer += $output->writeString($this->tableName);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->tableType !== null) {
      $xfer += $output->writeFieldBegin('tableType', TType::STRING, 3);
      $xfer += $output->writeString($this->tableType);
      $xfer += $output->writeFieldEnd();
    }
    if ($this->comments !== null) {
      $xfer += $output->writeFieldBegin('comments', TType::STRING, 4);
      $xfer += $output->writeString($this->comments);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class MetaException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('MetaException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class UnknownTableException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('UnknownTableException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class UnknownDBException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('UnknownDBException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class AlreadyExistsException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('AlreadyExistsException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class InvalidPartitionException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('InvalidPartitionException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class UnknownPartitionException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('UnknownPartitionException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class InvalidObjectException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('InvalidObjectException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class NoSuchObjectException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('NoSuchObjectException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class IndexAlreadyExistsException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('IndexAlreadyExistsException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class InvalidOperationException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('InvalidOperationException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class ConfigValSecurityException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('ConfigValSecurityException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class InvalidInputException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('InvalidInputException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class NoSuchTxnException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('NoSuchTxnException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TxnAbortedException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('TxnAbortedException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class TxnOpenException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('TxnOpenException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

class NoSuchLockException extends TException {
  static $_TSPEC;

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

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

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

  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->message);
          } 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('NoSuchLockException');
    if ($this->message !== null) {
      $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
      $xfer += $output->writeString($this->message);
      $xfer += $output->writeFieldEnd();
    }
    $xfer += $output->writeFieldStop();
    $xfer += $output->writeStructEnd();
    return $xfer;
  }

}

final class Constant extends \Thrift\Type\TConstant {
  static protected $DDL_TIME;
  static protected $HIVE_FILTER_FIELD_OWNER;
  static protected $HIVE_FILTER_FIELD_PARAMS;
  static protected $HIVE_FILTER_FIELD_LAST_ACCESS;
  static protected $IS_ARCHIVED;
  static protected $ORIGINAL_LOCATION;
  static protected $IS_IMMUTABLE;
  static protected $META_TABLE_COLUMNS;
  static protected $META_TABLE_COLUMN_TYPES;
  static protected $BUCKET_FIELD_NAME;
  static protected $BUCKET_COUNT;
  static protected $FIELD_TO_DIMENSION;
  static protected $META_TABLE_NAME;
  static protected $META_TABLE_DB;
  static protected $META_TABLE_LOCATION;
  static protected $META_TABLE_SERDE;
  static protected $META_TABLE_PARTITION_COLUMNS;
  static protected $META_TABLE_PARTITION_COLUMN_TYPES;
  static protected $FILE_INPUT_FORMAT;
  static protected $FILE_OUTPUT_FORMAT;
  static protected $META_TABLE_STORAGE;
  static protected $TABLE_IS_TRANSACTIONAL;
  static protected $TABLE_NO_AUTO_COMPACT;

  static protected function init_DDL_TIME() {
    return "transient_lastDdlTime";
  }

  static protected function init_HIVE_FILTER_FIELD_OWNER() {
    return "hive_filter_field_owner__";
  }

  static protected function init_HIVE_FILTER_FIELD_PARAMS() {
    return "hive_filter_field_params__";
  }

  static protected function init_HIVE_FILTER_FIELD_LAST_ACCESS() {
    return "hive_filter_field_last_access__";
  }

  static protected function init_IS_ARCHIVED() {
    return "is_archived";
  }

  static protected function init_ORIGINAL_LOCATION() {
    return "original_location";
  }

  static protected function init_IS_IMMUTABLE() {
    return "immutable";
  }

  static protected function init_META_TABLE_COLUMNS() {
    return "columns";
  }

  static protected function init_META_TABLE_COLUMN_TYPES() {
    return "columns.types";
  }

  static protected function init_BUCKET_FIELD_NAME() {
    return "bucket_field_name";
  }

  static protected function init_BUCKET_COUNT() {
    return "bucket_count";
  }

  static protected function init_FIELD_TO_DIMENSION() {
    return "field_to_dimension";
  }

  static protected function init_META_TABLE_NAME() {
    return "name";
  }

  static protected function init_META_TABLE_DB() {
    return "db";
  }

  static protected function init_META_TABLE_LOCATION() {
    return "location";
  }

  static protected function init_META_TABLE_SERDE() {
    return "serde";
  }

  static protected function init_META_TABLE_PARTITION_COLUMNS() {
    return "partition_columns";
  }

  static protected function init_META_TABLE_PARTITION_COLUMN_TYPES() {
    return "partition_columns.types";
  }

  static protected function init_FILE_INPUT_FORMAT() {
    return "file.inputformat";
  }

  static protected function init_FILE_OUTPUT_FORMAT() {
    return "file.outputformat";
  }

  static protected function init_META_TABLE_STORAGE() {
    return "storage_handler";
  }

  static protected function init_TABLE_IS_TRANSACTIONAL() {
    return "transactional";
  }

  static protected function init_TABLE_NO_AUTO_COMPACT() {
    return "no_auto_compaction";
  }
}