Пример #1
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_num_values = false;
                bool   isset_num_nulls  = false;
                bool   isset_num_rows   = false;
                bool   isset_encoding   = false;
                bool   isset_definition_levels_byte_length = false;
                bool   isset_repetition_levels_byte_length = false;
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.I32)
                        {
                            Num_values       = iprot.ReadI32();
                            isset_num_values = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.I32)
                        {
                            Num_nulls       = iprot.ReadI32();
                            isset_num_nulls = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I32)
                        {
                            Num_rows       = iprot.ReadI32();
                            isset_num_rows = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.I32)
                        {
                            Encoding       = (Encoding)iprot.ReadI32();
                            isset_encoding = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.I32)
                        {
                            Definition_levels_byte_length       = iprot.ReadI32();
                            isset_definition_levels_byte_length = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.I32)
                        {
                            Repetition_levels_byte_length       = iprot.ReadI32();
                            isset_repetition_levels_byte_length = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.Bool)
                        {
                            Is_compressed = iprot.ReadBool();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 8:
                        if (field.Type == TType.Struct)
                        {
                            Statistics = new Statistics();
                            Statistics.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_num_values)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_num_nulls)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_num_rows)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_encoding)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_definition_levels_byte_length)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_repetition_levels_byte_length)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
Пример #2
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_type                    = false;
                bool   isset_encodings               = false;
                bool   isset_path_in_schema          = false;
                bool   isset_codec                   = false;
                bool   isset_num_values              = false;
                bool   isset_total_uncompressed_size = false;
                bool   isset_total_compressed_size   = false;
                bool   isset_data_page_offset        = false;
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.I32)
                        {
                            Type       = (Type)iprot.ReadI32();
                            isset_type = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.List)
                        {
                            {
                                Encodings = new List <Encoding>();
                                TList _list0 = iprot.ReadListBegin();
                                for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                                {
                                    Encoding _elem2;
                                    _elem2 = (Encoding)iprot.ReadI32();
                                    Encodings.Add(_elem2);
                                }
                                iprot.ReadListEnd();
                            }
                            isset_encodings = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.List)
                        {
                            {
                                Path_in_schema = new List <string>();
                                TList _list3 = iprot.ReadListBegin();
                                for (int _i4 = 0; _i4 < _list3.Count; ++_i4)
                                {
                                    string _elem5;
                                    _elem5 = iprot.ReadString();
                                    Path_in_schema.Add(_elem5);
                                }
                                iprot.ReadListEnd();
                            }
                            isset_path_in_schema = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.I32)
                        {
                            Codec       = (CompressionCodec)iprot.ReadI32();
                            isset_codec = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.I64)
                        {
                            Num_values       = iprot.ReadI64();
                            isset_num_values = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.I64)
                        {
                            Total_uncompressed_size       = iprot.ReadI64();
                            isset_total_uncompressed_size = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.I64)
                        {
                            Total_compressed_size       = iprot.ReadI64();
                            isset_total_compressed_size = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 8:
                        if (field.Type == TType.List)
                        {
                            {
                                Key_value_metadata = new List <KeyValue>();
                                TList _list6 = iprot.ReadListBegin();
                                for (int _i7 = 0; _i7 < _list6.Count; ++_i7)
                                {
                                    KeyValue _elem8;
                                    _elem8 = new KeyValue();
                                    _elem8.Read(iprot);
                                    Key_value_metadata.Add(_elem8);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 9:
                        if (field.Type == TType.I64)
                        {
                            Data_page_offset       = iprot.ReadI64();
                            isset_data_page_offset = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 10:
                        if (field.Type == TType.I64)
                        {
                            Index_page_offset = iprot.ReadI64();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 11:
                        if (field.Type == TType.I64)
                        {
                            Dictionary_page_offset = iprot.ReadI64();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 12:
                        if (field.Type == TType.Struct)
                        {
                            Statistics = new Statistics();
                            Statistics.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 13:
                        if (field.Type == TType.List)
                        {
                            {
                                Encoding_stats = new List <PageEncodingStats>();
                                TList _list9 = iprot.ReadListBegin();
                                for (int _i10 = 0; _i10 < _list9.Count; ++_i10)
                                {
                                    PageEncodingStats _elem11;
                                    _elem11 = new PageEncodingStats();
                                    _elem11.Read(iprot);
                                    Encoding_stats.Add(_elem11);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_type)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_encodings)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_path_in_schema)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_codec)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_num_values)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_total_uncompressed_size)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_total_compressed_size)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_data_page_offset)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }