Ejemplo n.º 1
0
        public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
        {
            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;
                await iprot.ReadStructBeginAsync(cancellationToken);

                while (true)
                {
                    field = await iprot.ReadFieldBeginAsync(cancellationToken);

                    if (field.Type == TType.Stop)
                    {
                        break;
                    }

                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.I32)
                        {
                            Type = (Type)await iprot.ReadI32Async(cancellationToken);

                            isset_type = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.List)
                        {
                            {
                                Encodings = new List <Encoding>();
                                TList _list0 = await iprot.ReadListBeginAsync(cancellationToken);

                                for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                                {
                                    Encoding _elem2;
                                    _elem2 = (Encoding)await iprot.ReadI32Async(cancellationToken);

                                    Encodings.Add(_elem2);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                            isset_encodings = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.List)
                        {
                            {
                                Path_in_schema = new List <string>();
                                TList _list3 = await iprot.ReadListBeginAsync(cancellationToken);

                                for (int _i4 = 0; _i4 < _list3.Count; ++_i4)
                                {
                                    string _elem5;
                                    _elem5 = await iprot.ReadStringAsync(cancellationToken);

                                    Path_in_schema.Add(_elem5);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                            isset_path_in_schema = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.I32)
                        {
                            Codec = (CompressionCodec)await iprot.ReadI32Async(cancellationToken);

                            isset_codec = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.I64)
                        {
                            Num_values = await iprot.ReadI64Async(cancellationToken);

                            isset_num_values = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.I64)
                        {
                            Total_uncompressed_size = await iprot.ReadI64Async(cancellationToken);

                            isset_total_uncompressed_size = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.I64)
                        {
                            Total_compressed_size = await iprot.ReadI64Async(cancellationToken);

                            isset_total_compressed_size = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 8:
                        if (field.Type == TType.List)
                        {
                            {
                                Key_value_metadata = new List <KeyValue>();
                                TList _list6 = await iprot.ReadListBeginAsync(cancellationToken);

                                for (int _i7 = 0; _i7 < _list6.Count; ++_i7)
                                {
                                    KeyValue _elem8;
                                    _elem8 = new KeyValue();
                                    await _elem8.ReadAsync(iprot, cancellationToken);

                                    Key_value_metadata.Add(_elem8);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 9:
                        if (field.Type == TType.I64)
                        {
                            Data_page_offset = await iprot.ReadI64Async(cancellationToken);

                            isset_data_page_offset = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 10:
                        if (field.Type == TType.I64)
                        {
                            Index_page_offset = await iprot.ReadI64Async(cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 11:
                        if (field.Type == TType.I64)
                        {
                            Dictionary_page_offset = await iprot.ReadI64Async(cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 12:
                        if (field.Type == TType.Struct)
                        {
                            Statistics = new Statistics();
                            await Statistics.ReadAsync(iprot, cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 13:
                        if (field.Type == TType.List)
                        {
                            {
                                Encoding_stats = new List <PageEncodingStats>();
                                TList _list9 = await iprot.ReadListBeginAsync(cancellationToken);

                                for (int _i10 = 0; _i10 < _list9.Count; ++_i10)
                                {
                                    PageEncodingStats _elem11;
                                    _elem11 = new PageEncodingStats();
                                    await _elem11.ReadAsync(iprot, cancellationToken);

                                    Encoding_stats.Add(_elem11);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    default:
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                        break;
                    }

                    await iprot.ReadFieldEndAsync(cancellationToken);
                }

                await iprot.ReadStructEndAsync(cancellationToken);

                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();
            }
        }
Ejemplo n.º 2
0
        public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_version    = false;
                bool   isset_schema     = false;
                bool   isset_num_rows   = false;
                bool   isset_row_groups = false;
                TField field;
                await iprot.ReadStructBeginAsync(cancellationToken);

                while (true)
                {
                    field = await iprot.ReadFieldBeginAsync(cancellationToken);

                    if (field.Type == TType.Stop)
                    {
                        break;
                    }

                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.I32)
                        {
                            Version = await iprot.ReadI32Async(cancellationToken);

                            isset_version = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.List)
                        {
                            {
                                Schema = new List <SchemaElement>();
                                TList _list44 = await iprot.ReadListBeginAsync(cancellationToken);

                                for (int _i45 = 0; _i45 < _list44.Count; ++_i45)
                                {
                                    SchemaElement _elem46;
                                    _elem46 = new SchemaElement();
                                    await _elem46.ReadAsync(iprot, cancellationToken);

                                    Schema.Add(_elem46);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                            isset_schema = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I64)
                        {
                            Num_rows = await iprot.ReadI64Async(cancellationToken);

                            isset_num_rows = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.List)
                        {
                            {
                                Row_groups = new List <RowGroup>();
                                TList _list47 = await iprot.ReadListBeginAsync(cancellationToken);

                                for (int _i48 = 0; _i48 < _list47.Count; ++_i48)
                                {
                                    RowGroup _elem49;
                                    _elem49 = new RowGroup();
                                    await _elem49.ReadAsync(iprot, cancellationToken);

                                    Row_groups.Add(_elem49);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                            isset_row_groups = true;
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.List)
                        {
                            {
                                Key_value_metadata = new List <KeyValue>();
                                TList _list50 = await iprot.ReadListBeginAsync(cancellationToken);

                                for (int _i51 = 0; _i51 < _list50.Count; ++_i51)
                                {
                                    KeyValue _elem52;
                                    _elem52 = new KeyValue();
                                    await _elem52.ReadAsync(iprot, cancellationToken);

                                    Key_value_metadata.Add(_elem52);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.String)
                        {
                            Created_by = await iprot.ReadStringAsync(cancellationToken);
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.List)
                        {
                            {
                                Column_orders = new List <ColumnOrder>();
                                TList _list53 = await iprot.ReadListBeginAsync(cancellationToken);

                                for (int _i54 = 0; _i54 < _list53.Count; ++_i54)
                                {
                                    ColumnOrder _elem55;
                                    _elem55 = new ColumnOrder();
                                    await _elem55.ReadAsync(iprot, cancellationToken);

                                    Column_orders.Add(_elem55);
                                }
                                await iprot.ReadListEndAsync(cancellationToken);
                            }
                        }
                        else
                        {
                            await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                        }
                        break;

                    default:
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                        break;
                    }

                    await iprot.ReadFieldEndAsync(cancellationToken);
                }

                await iprot.ReadStructEndAsync(cancellationToken);

                if (!isset_version)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_schema)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_num_rows)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_row_groups)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }