<?php
namespace metastore;

/**
 * Autogenerated by Thrift Compiler (0.16.0)
 *
 * 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;

class SkewedInfo
{
    static public $isValidate = false;

    static public $_TSPEC = array(
        1 => array(
            'var' => 'skewedColNames',
            'isRequired' => false,
            'type' => TType::LST,
            'etype' => TType::STRING,
            'elem' => array(
                'type' => TType::STRING,
                ),
        ),
        2 => array(
            'var' => 'skewedColValues',
            'isRequired' => false,
            'type' => TType::LST,
            'etype' => TType::LST,
            'elem' => array(
                'type' => TType::LST,
                'etype' => TType::STRING,
                'elem' => array(
                    'type' => TType::STRING,
                    ),
                ),
        ),
        3 => array(
            'var' => 'skewedColValueLocationMaps',
            'isRequired' => false,
            '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,
                ),
        ),
    );

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

    public function __construct($vals = null)
    {
        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();
                        $_size207 = 0;
                        $_etype210 = 0;
                        $xfer += $input->readListBegin($_etype210, $_size207);
                        for ($_i211 = 0; $_i211 < $_size207; ++$_i211) {
                            $elem212 = null;
                            $xfer += $input->readString($elem212);
                            $this->skewedColNames []= $elem212;
                        }
                        $xfer += $input->readListEnd();
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 2:
                    if ($ftype == TType::LST) {
                        $this->skewedColValues = array();
                        $_size213 = 0;
                        $_etype216 = 0;
                        $xfer += $input->readListBegin($_etype216, $_size213);
                        for ($_i217 = 0; $_i217 < $_size213; ++$_i217) {
                            $elem218 = null;
                            $elem218 = array();
                            $_size219 = 0;
                            $_etype222 = 0;
                            $xfer += $input->readListBegin($_etype222, $_size219);
                            for ($_i223 = 0; $_i223 < $_size219; ++$_i223) {
                                $elem224 = null;
                                $xfer += $input->readString($elem224);
                                $elem218 []= $elem224;
                            }
                            $xfer += $input->readListEnd();
                            $this->skewedColValues []= $elem218;
                        }
                        $xfer += $input->readListEnd();
                    } else {
                        $xfer += $input->skip($ftype);
                    }
                    break;
                case 3:
                    if ($ftype == TType::MAP) {
                        $this->skewedColValueLocationMaps = array();
                        $_size225 = 0;
                        $_ktype226 = 0;
                        $_vtype227 = 0;
                        $xfer += $input->readMapBegin($_ktype226, $_vtype227, $_size225);
                        for ($_i229 = 0; $_i229 < $_size225; ++$_i229) {
                            $key230 = array();
                            $val231 = '';
                            $key230 = array();
                            $_size232 = 0;
                            $_etype235 = 0;
                            $xfer += $input->readListBegin($_etype235, $_size232);
                            for ($_i236 = 0; $_i236 < $_size232; ++$_i236) {
                                $elem237 = null;
                                $xfer += $input->readString($elem237);
                                $key230 []= $elem237;
                            }
                            $xfer += $input->readListEnd();
                            $xfer += $input->readString($val231);
                            $this->skewedColValueLocationMaps[$key230] = $val231;
                        }
                        $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 $iter238) {
                $xfer += $output->writeString($iter238);
            }
            $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 $iter239) {
                $output->writeListBegin(TType::STRING, count($iter239));
                foreach ($iter239 as $iter240) {
                    $xfer += $output->writeString($iter240);
                }
                $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 $kiter241 => $viter242) {
                $output->writeListBegin(TType::STRING, count($kiter241));
                foreach ($kiter241 as $iter243) {
                    $xfer += $output->writeString($iter243);
                }
                $output->writeListEnd();
                $xfer += $output->writeString($viter242);
            }
            $output->writeMapEnd();
            $xfer += $output->writeFieldEnd();
        }
        $xfer += $output->writeFieldStop();
        $xfer += $output->writeStructEnd();
        return $xfer;
    }
}
