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

require 'types_types'
require 'exprs_types'


module Impala
  module Protocol
    module TTableType
      HDFS_TABLE = 0
      HBASE_TABLE = 1
      VALUE_MAP = { 0 => "HDFS_TABLE", 1 => "HBASE_TABLE" }
      VALID_VALUES = Set.new([HDFS_TABLE, HBASE_TABLE]).freeze
    end

    module THdfsFileFormat
      TEXT = 0
      LZO_TEXT = 1
      RC_FILE = 2
      SEQUENCE_FILE = 3
      TREVNI = 4
      VALUE_MAP = { 0 => "TEXT", 1 => "LZO_TEXT", 2 => "RC_FILE", 3 => "SEQUENCE_FILE", 4 => "TREVNI" }
      VALID_VALUES = Set.new([TEXT, LZO_TEXT, RC_FILE, SEQUENCE_FILE, TREVNI]).freeze
    end

    module THdfsCompression
      NONE = 0
      DEFAULT = 1
      GZIP = 2
      BZIP2 = 3
      SNAPPY = 4
      SNAPPY_BLOCKED = 5
      VALUE_MAP = { 0 => "NONE", 1 => "DEFAULT", 2 => "GZIP", 3 => "BZIP2", 4 => "SNAPPY", 5 => "SNAPPY_BLOCKED" }
      VALID_VALUES = Set.new([NONE, DEFAULT, GZIP, BZIP2, SNAPPY, SNAPPY_BLOCKED]).freeze
    end

    class TSlotDescriptor
      include ::Thrift::Struct, ::Thrift::Struct_Union
      ID = 1
      PARENT = 2
      SLOTTYPE = 3
      COLUMNPOS = 4
      BYTEOFFSET = 5
      NULLINDICATORBYTE = 6
      NULLINDICATORBIT = 7
      SLOTIDX = 9
      ISMATERIALIZED = 10

      FIELDS = {
      ID => { :type => ::Thrift::Types::I32, :name => 'id' },
      PARENT => { :type => ::Thrift::Types::I32, :name => 'parent' },
      SLOTTYPE => { :type => ::Thrift::Types::I32, :name => 'slotType', :enum_class => Impala::Protocol::TPrimitiveType },
      COLUMNPOS => { :type => ::Thrift::Types::I32, :name => 'columnPos' },
      BYTEOFFSET => { :type => ::Thrift::Types::I32, :name => 'byteOffset' },
      NULLINDICATORBYTE => { :type => ::Thrift::Types::I32, :name => 'nullIndicatorByte' },
      NULLINDICATORBIT => { :type => ::Thrift::Types::I32, :name => 'nullIndicatorBit' },
      SLOTIDX => { :type => ::Thrift::Types::I32, :name => 'slotIdx' },
      ISMATERIALIZED => { :type => ::Thrift::Types::BOOL, :name => 'isMaterialized' }
      }

      def struct_fields; FIELDS; end

      def validate
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field parent is unset!') unless @parent
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field slotType is unset!') unless @slotType
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field columnPos is unset!') unless @columnPos
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field byteOffset is unset!') unless @byteOffset
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nullIndicatorByte is unset!') unless @nullIndicatorByte
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nullIndicatorBit is unset!') unless @nullIndicatorBit
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field slotIdx is unset!') unless @slotIdx
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field isMaterialized is unset!') if @isMaterialized.nil?
        unless @slotType.nil? || Impala::Protocol::TPrimitiveType::VALID_VALUES.include?(@slotType)
          raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field slotType!')
        end
      end

      ::Thrift::Struct.generate_accessors self
    end

    class THdfsPartition
      include ::Thrift::Struct, ::Thrift::Struct_Union
      LINEDELIM = 1
      FIELDDELIM = 2
      COLLECTIONDELIM = 3
      MAPKEYDELIM = 4
      ESCAPECHAR = 5
      FILEFORMAT = 6
      PARTITIONKEYEXPRS = 7
      BLOCKSIZE = 8
      COMPRESSION = 9

      FIELDS = {
      LINEDELIM => { :type => ::Thrift::Types::BYTE, :name => 'lineDelim' },
      FIELDDELIM => { :type => ::Thrift::Types::BYTE, :name => 'fieldDelim' },
      COLLECTIONDELIM => { :type => ::Thrift::Types::BYTE, :name => 'collectionDelim' },
      MAPKEYDELIM => { :type => ::Thrift::Types::BYTE, :name => 'mapKeyDelim' },
      ESCAPECHAR => { :type => ::Thrift::Types::BYTE, :name => 'escapeChar' },
      FILEFORMAT => { :type => ::Thrift::Types::I32, :name => 'fileFormat', :enum_class => Impala::Protocol::THdfsFileFormat },
      PARTITIONKEYEXPRS => { :type => ::Thrift::Types::LIST, :name => 'partitionKeyExprs', :element => { :type => ::Thrift::Types::STRUCT, :class => Impala::Protocol::TExpr } },
      BLOCKSIZE => { :type => ::Thrift::Types::I32, :name => 'blockSize' },
      COMPRESSION => { :type => ::Thrift::Types::I32, :name => 'compression', :enum_class => Impala::Protocol::THdfsCompression }
      }

      def struct_fields; FIELDS; end

      def validate
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field lineDelim is unset!') unless @lineDelim
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field fieldDelim is unset!') unless @fieldDelim
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field collectionDelim is unset!') unless @collectionDelim
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field mapKeyDelim is unset!') unless @mapKeyDelim
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field escapeChar is unset!') unless @escapeChar
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field fileFormat is unset!') unless @fileFormat
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field blockSize is unset!') unless @blockSize
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field compression is unset!') unless @compression
        unless @fileFormat.nil? || Impala::Protocol::THdfsFileFormat::VALID_VALUES.include?(@fileFormat)
          raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field fileFormat!')
        end
        unless @compression.nil? || Impala::Protocol::THdfsCompression::VALID_VALUES.include?(@compression)
          raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field compression!')
        end
      end

      ::Thrift::Struct.generate_accessors self
    end

    class THdfsTable
      include ::Thrift::Struct, ::Thrift::Struct_Union
      HDFSBASEDIR = 1
      PARTITIONKEYNAMES = 2
      NULLPARTITIONKEYVALUE = 3
      PARTITIONS = 4

      FIELDS = {
      HDFSBASEDIR => { :type => ::Thrift::Types::STRING, :name => 'hdfsBaseDir' },
      PARTITIONKEYNAMES => { :type => ::Thrift::Types::LIST, :name => 'partitionKeyNames', :element => { :type => ::Thrift::Types::STRING } },
      NULLPARTITIONKEYVALUE => { :type => ::Thrift::Types::STRING, :name => 'nullPartitionKeyValue' },
      PARTITIONS => { :type => ::Thrift::Types::MAP, :name => 'partitions', :key => { :type => ::Thrift::Types::I64 }, :value => { :type => ::Thrift::Types::STRUCT, :class => Impala::Protocol::THdfsPartition } }
      }

      def struct_fields; FIELDS; end

      def validate
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field hdfsBaseDir is unset!') unless @hdfsBaseDir
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field partitionKeyNames is unset!') unless @partitionKeyNames
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nullPartitionKeyValue is unset!') unless @nullPartitionKeyValue
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field partitions is unset!') unless @partitions
      end

      ::Thrift::Struct.generate_accessors self
    end

    class THBaseTable
      include ::Thrift::Struct, ::Thrift::Struct_Union
      TABLENAME = 1
      FAMILIES = 2
      QUALIFIERS = 3

      FIELDS = {
      TABLENAME => { :type => ::Thrift::Types::STRING, :name => 'tableName' },
      FAMILIES => { :type => ::Thrift::Types::LIST, :name => 'families', :element => { :type => ::Thrift::Types::STRING } },
      QUALIFIERS => { :type => ::Thrift::Types::LIST, :name => 'qualifiers', :element => { :type => ::Thrift::Types::STRING } }
      }

      def struct_fields; FIELDS; end

      def validate
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field tableName is unset!') unless @tableName
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field families is unset!') unless @families
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field qualifiers is unset!') unless @qualifiers
      end

      ::Thrift::Struct.generate_accessors self
    end

    class TTableDescriptor
      include ::Thrift::Struct, ::Thrift::Struct_Union
      ID = 1
      TABLETYPE = 2
      NUMCOLS = 3
      NUMCLUSTERINGCOLS = 4
      HDFSTABLE = 5
      HBASETABLE = 6
      TABLENAME = 7
      DBNAME = 8

      FIELDS = {
      ID => { :type => ::Thrift::Types::I32, :name => 'id' },
      TABLETYPE => { :type => ::Thrift::Types::I32, :name => 'tableType', :enum_class => Impala::Protocol::TTableType },
      NUMCOLS => { :type => ::Thrift::Types::I32, :name => 'numCols' },
      NUMCLUSTERINGCOLS => { :type => ::Thrift::Types::I32, :name => 'numClusteringCols' },
      HDFSTABLE => { :type => ::Thrift::Types::STRUCT, :name => 'hdfsTable', :class => Impala::Protocol::THdfsTable, :optional => true },
      HBASETABLE => { :type => ::Thrift::Types::STRUCT, :name => 'hbaseTable', :class => Impala::Protocol::THBaseTable, :optional => true },
      TABLENAME => { :type => ::Thrift::Types::STRING, :name => 'tableName' },
      DBNAME => { :type => ::Thrift::Types::STRING, :name => 'dbName' }
      }

      def struct_fields; FIELDS; end

      def validate
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field tableType is unset!') unless @tableType
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field numCols is unset!') unless @numCols
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field numClusteringCols is unset!') unless @numClusteringCols
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field tableName is unset!') unless @tableName
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field dbName is unset!') unless @dbName
        unless @tableType.nil? || Impala::Protocol::TTableType::VALID_VALUES.include?(@tableType)
          raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field tableType!')
        end
      end

      ::Thrift::Struct.generate_accessors self
    end

    class TTupleDescriptor
      include ::Thrift::Struct, ::Thrift::Struct_Union
      ID = 1
      BYTESIZE = 2
      NUMNULLBYTES = 3
      TABLEID = 4

      FIELDS = {
      ID => { :type => ::Thrift::Types::I32, :name => 'id' },
      BYTESIZE => { :type => ::Thrift::Types::I32, :name => 'byteSize' },
      NUMNULLBYTES => { :type => ::Thrift::Types::I32, :name => 'numNullBytes' },
      TABLEID => { :type => ::Thrift::Types::I32, :name => 'tableId', :optional => true }
      }

      def struct_fields; FIELDS; end

      def validate
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field byteSize is unset!') unless @byteSize
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field numNullBytes is unset!') unless @numNullBytes
      end

      ::Thrift::Struct.generate_accessors self
    end

    class TDescriptorTable
      include ::Thrift::Struct, ::Thrift::Struct_Union
      SLOTDESCRIPTORS = 1
      TUPLEDESCRIPTORS = 2
      TABLEDESCRIPTORS = 3

      FIELDS = {
      SLOTDESCRIPTORS => { :type => ::Thrift::Types::LIST, :name => 'slotDescriptors', :element => { :type => ::Thrift::Types::STRUCT, :class => Impala::Protocol::TSlotDescriptor }, :optional => true },
      TUPLEDESCRIPTORS => { :type => ::Thrift::Types::LIST, :name => 'tupleDescriptors', :element => { :type => ::Thrift::Types::STRUCT, :class => Impala::Protocol::TTupleDescriptor } },
      TABLEDESCRIPTORS => { :type => ::Thrift::Types::LIST, :name => 'tableDescriptors', :element => { :type => ::Thrift::Types::STRUCT, :class => Impala::Protocol::TTableDescriptor }, :optional => true }
      }

      def struct_fields; FIELDS; end

      def validate
        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field tupleDescriptors is unset!') unless @tupleDescriptors
      end

      ::Thrift::Struct.generate_accessors self
    end

  end
end
