1// Code generated by Thrift Compiler (0.14.0). DO NOT EDIT. 2 3package parquet 4 5import( 6 "bytes" 7 "context" 8 "database/sql/driver" 9 "errors" 10 "fmt" 11 "time" 12 "github.com/apache/thrift/lib/go/thrift" 13) 14 15// (needed to ensure safety because of naive import list construction.) 16var _ = thrift.ZERO 17var _ = fmt.Printf 18var _ = context.Background 19var _ = time.Now 20var _ = bytes.Equal 21 22//Types supported by Parquet. These types are intended to be used in combination 23//with the encodings to control the on disk storage format. 24//For example INT16 is not included as a type since a good encoding of INT32 25//would handle this. 26type Type int64 27const ( 28 Type_BOOLEAN Type = 0 29 Type_INT32 Type = 1 30 Type_INT64 Type = 2 31 Type_INT96 Type = 3 32 Type_FLOAT Type = 4 33 Type_DOUBLE Type = 5 34 Type_BYTE_ARRAY Type = 6 35 Type_FIXED_LEN_BYTE_ARRAY Type = 7 36) 37 38func (p Type) String() string { 39 switch p { 40 case Type_BOOLEAN: return "BOOLEAN" 41 case Type_INT32: return "INT32" 42 case Type_INT64: return "INT64" 43 case Type_INT96: return "INT96" 44 case Type_FLOAT: return "FLOAT" 45 case Type_DOUBLE: return "DOUBLE" 46 case Type_BYTE_ARRAY: return "BYTE_ARRAY" 47 case Type_FIXED_LEN_BYTE_ARRAY: return "FIXED_LEN_BYTE_ARRAY" 48 } 49 return "<UNSET>" 50} 51 52func TypeFromString(s string) (Type, error) { 53 switch s { 54 case "BOOLEAN": return Type_BOOLEAN, nil 55 case "INT32": return Type_INT32, nil 56 case "INT64": return Type_INT64, nil 57 case "INT96": return Type_INT96, nil 58 case "FLOAT": return Type_FLOAT, nil 59 case "DOUBLE": return Type_DOUBLE, nil 60 case "BYTE_ARRAY": return Type_BYTE_ARRAY, nil 61 case "FIXED_LEN_BYTE_ARRAY": return Type_FIXED_LEN_BYTE_ARRAY, nil 62 } 63 return Type(0), fmt.Errorf("not a valid Type string") 64} 65 66 67func TypePtr(v Type) *Type { return &v } 68 69func (p Type) MarshalText() ([]byte, error) { 70return []byte(p.String()), nil 71} 72 73func (p *Type) UnmarshalText(text []byte) error { 74q, err := TypeFromString(string(text)) 75if (err != nil) { 76return err 77} 78*p = q 79return nil 80} 81 82func (p *Type) Scan(value interface{}) error { 83v, ok := value.(int64) 84if !ok { 85return errors.New("Scan value is not int64") 86} 87*p = Type(v) 88return nil 89} 90 91func (p * Type) Value() (driver.Value, error) { 92 if p == nil { 93 return nil, nil 94 } 95return int64(*p), nil 96} 97//Common types used by frameworks(e.g. hive, pig) using parquet. This helps map 98//between types in those frameworks to the base types in parquet. This is only 99//metadata and not needed to read or write the data. 100type ConvertedType int64 101const ( 102 ConvertedType_UTF8 ConvertedType = 0 103 ConvertedType_MAP ConvertedType = 1 104 ConvertedType_MAP_KEY_VALUE ConvertedType = 2 105 ConvertedType_LIST ConvertedType = 3 106 ConvertedType_ENUM ConvertedType = 4 107 ConvertedType_DECIMAL ConvertedType = 5 108 ConvertedType_DATE ConvertedType = 6 109 ConvertedType_TIME_MILLIS ConvertedType = 7 110 ConvertedType_TIME_MICROS ConvertedType = 8 111 ConvertedType_TIMESTAMP_MILLIS ConvertedType = 9 112 ConvertedType_TIMESTAMP_MICROS ConvertedType = 10 113 ConvertedType_UINT_8 ConvertedType = 11 114 ConvertedType_UINT_16 ConvertedType = 12 115 ConvertedType_UINT_32 ConvertedType = 13 116 ConvertedType_UINT_64 ConvertedType = 14 117 ConvertedType_INT_8 ConvertedType = 15 118 ConvertedType_INT_16 ConvertedType = 16 119 ConvertedType_INT_32 ConvertedType = 17 120 ConvertedType_INT_64 ConvertedType = 18 121 ConvertedType_JSON ConvertedType = 19 122 ConvertedType_BSON ConvertedType = 20 123 ConvertedType_INTERVAL ConvertedType = 21 124) 125 126func (p ConvertedType) String() string { 127 switch p { 128 case ConvertedType_UTF8: return "UTF8" 129 case ConvertedType_MAP: return "MAP" 130 case ConvertedType_MAP_KEY_VALUE: return "MAP_KEY_VALUE" 131 case ConvertedType_LIST: return "LIST" 132 case ConvertedType_ENUM: return "ENUM" 133 case ConvertedType_DECIMAL: return "DECIMAL" 134 case ConvertedType_DATE: return "DATE" 135 case ConvertedType_TIME_MILLIS: return "TIME_MILLIS" 136 case ConvertedType_TIME_MICROS: return "TIME_MICROS" 137 case ConvertedType_TIMESTAMP_MILLIS: return "TIMESTAMP_MILLIS" 138 case ConvertedType_TIMESTAMP_MICROS: return "TIMESTAMP_MICROS" 139 case ConvertedType_UINT_8: return "UINT_8" 140 case ConvertedType_UINT_16: return "UINT_16" 141 case ConvertedType_UINT_32: return "UINT_32" 142 case ConvertedType_UINT_64: return "UINT_64" 143 case ConvertedType_INT_8: return "INT_8" 144 case ConvertedType_INT_16: return "INT_16" 145 case ConvertedType_INT_32: return "INT_32" 146 case ConvertedType_INT_64: return "INT_64" 147 case ConvertedType_JSON: return "JSON" 148 case ConvertedType_BSON: return "BSON" 149 case ConvertedType_INTERVAL: return "INTERVAL" 150 } 151 return "<UNSET>" 152} 153 154func ConvertedTypeFromString(s string) (ConvertedType, error) { 155 switch s { 156 case "UTF8": return ConvertedType_UTF8, nil 157 case "MAP": return ConvertedType_MAP, nil 158 case "MAP_KEY_VALUE": return ConvertedType_MAP_KEY_VALUE, nil 159 case "LIST": return ConvertedType_LIST, nil 160 case "ENUM": return ConvertedType_ENUM, nil 161 case "DECIMAL": return ConvertedType_DECIMAL, nil 162 case "DATE": return ConvertedType_DATE, nil 163 case "TIME_MILLIS": return ConvertedType_TIME_MILLIS, nil 164 case "TIME_MICROS": return ConvertedType_TIME_MICROS, nil 165 case "TIMESTAMP_MILLIS": return ConvertedType_TIMESTAMP_MILLIS, nil 166 case "TIMESTAMP_MICROS": return ConvertedType_TIMESTAMP_MICROS, nil 167 case "UINT_8": return ConvertedType_UINT_8, nil 168 case "UINT_16": return ConvertedType_UINT_16, nil 169 case "UINT_32": return ConvertedType_UINT_32, nil 170 case "UINT_64": return ConvertedType_UINT_64, nil 171 case "INT_8": return ConvertedType_INT_8, nil 172 case "INT_16": return ConvertedType_INT_16, nil 173 case "INT_32": return ConvertedType_INT_32, nil 174 case "INT_64": return ConvertedType_INT_64, nil 175 case "JSON": return ConvertedType_JSON, nil 176 case "BSON": return ConvertedType_BSON, nil 177 case "INTERVAL": return ConvertedType_INTERVAL, nil 178 } 179 return ConvertedType(0), fmt.Errorf("not a valid ConvertedType string") 180} 181 182 183func ConvertedTypePtr(v ConvertedType) *ConvertedType { return &v } 184 185func (p ConvertedType) MarshalText() ([]byte, error) { 186return []byte(p.String()), nil 187} 188 189func (p *ConvertedType) UnmarshalText(text []byte) error { 190q, err := ConvertedTypeFromString(string(text)) 191if (err != nil) { 192return err 193} 194*p = q 195return nil 196} 197 198func (p *ConvertedType) Scan(value interface{}) error { 199v, ok := value.(int64) 200if !ok { 201return errors.New("Scan value is not int64") 202} 203*p = ConvertedType(v) 204return nil 205} 206 207func (p * ConvertedType) Value() (driver.Value, error) { 208 if p == nil { 209 return nil, nil 210 } 211return int64(*p), nil 212} 213//Representation of Schemas 214type FieldRepetitionType int64 215const ( 216 FieldRepetitionType_REQUIRED FieldRepetitionType = 0 217 FieldRepetitionType_OPTIONAL FieldRepetitionType = 1 218 FieldRepetitionType_REPEATED FieldRepetitionType = 2 219) 220 221func (p FieldRepetitionType) String() string { 222 switch p { 223 case FieldRepetitionType_REQUIRED: return "REQUIRED" 224 case FieldRepetitionType_OPTIONAL: return "OPTIONAL" 225 case FieldRepetitionType_REPEATED: return "REPEATED" 226 } 227 return "<UNSET>" 228} 229 230func FieldRepetitionTypeFromString(s string) (FieldRepetitionType, error) { 231 switch s { 232 case "REQUIRED": return FieldRepetitionType_REQUIRED, nil 233 case "OPTIONAL": return FieldRepetitionType_OPTIONAL, nil 234 case "REPEATED": return FieldRepetitionType_REPEATED, nil 235 } 236 return FieldRepetitionType(0), fmt.Errorf("not a valid FieldRepetitionType string") 237} 238 239 240func FieldRepetitionTypePtr(v FieldRepetitionType) *FieldRepetitionType { return &v } 241 242func (p FieldRepetitionType) MarshalText() ([]byte, error) { 243return []byte(p.String()), nil 244} 245 246func (p *FieldRepetitionType) UnmarshalText(text []byte) error { 247q, err := FieldRepetitionTypeFromString(string(text)) 248if (err != nil) { 249return err 250} 251*p = q 252return nil 253} 254 255func (p *FieldRepetitionType) Scan(value interface{}) error { 256v, ok := value.(int64) 257if !ok { 258return errors.New("Scan value is not int64") 259} 260*p = FieldRepetitionType(v) 261return nil 262} 263 264func (p * FieldRepetitionType) Value() (driver.Value, error) { 265 if p == nil { 266 return nil, nil 267 } 268return int64(*p), nil 269} 270//Encodings supported by Parquet. Not all encodings are valid for all types. These 271//enums are also used to specify the encoding of definition and repetition levels. 272//See the accompanying doc for the details of the more complicated encodings. 273type Encoding int64 274const ( 275 Encoding_PLAIN Encoding = 0 276 Encoding_PLAIN_DICTIONARY Encoding = 2 277 Encoding_RLE Encoding = 3 278 Encoding_BIT_PACKED Encoding = 4 279 Encoding_DELTA_BINARY_PACKED Encoding = 5 280 Encoding_DELTA_LENGTH_BYTE_ARRAY Encoding = 6 281 Encoding_DELTA_BYTE_ARRAY Encoding = 7 282 Encoding_RLE_DICTIONARY Encoding = 8 283 Encoding_BYTE_STREAM_SPLIT Encoding = 9 284) 285 286func (p Encoding) String() string { 287 switch p { 288 case Encoding_PLAIN: return "PLAIN" 289 case Encoding_PLAIN_DICTIONARY: return "PLAIN_DICTIONARY" 290 case Encoding_RLE: return "RLE" 291 case Encoding_BIT_PACKED: return "BIT_PACKED" 292 case Encoding_DELTA_BINARY_PACKED: return "DELTA_BINARY_PACKED" 293 case Encoding_DELTA_LENGTH_BYTE_ARRAY: return "DELTA_LENGTH_BYTE_ARRAY" 294 case Encoding_DELTA_BYTE_ARRAY: return "DELTA_BYTE_ARRAY" 295 case Encoding_RLE_DICTIONARY: return "RLE_DICTIONARY" 296 case Encoding_BYTE_STREAM_SPLIT: return "BYTE_STREAM_SPLIT" 297 } 298 return "<UNSET>" 299} 300 301func EncodingFromString(s string) (Encoding, error) { 302 switch s { 303 case "PLAIN": return Encoding_PLAIN, nil 304 case "PLAIN_DICTIONARY": return Encoding_PLAIN_DICTIONARY, nil 305 case "RLE": return Encoding_RLE, nil 306 case "BIT_PACKED": return Encoding_BIT_PACKED, nil 307 case "DELTA_BINARY_PACKED": return Encoding_DELTA_BINARY_PACKED, nil 308 case "DELTA_LENGTH_BYTE_ARRAY": return Encoding_DELTA_LENGTH_BYTE_ARRAY, nil 309 case "DELTA_BYTE_ARRAY": return Encoding_DELTA_BYTE_ARRAY, nil 310 case "RLE_DICTIONARY": return Encoding_RLE_DICTIONARY, nil 311 case "BYTE_STREAM_SPLIT": return Encoding_BYTE_STREAM_SPLIT, nil 312 } 313 return Encoding(0), fmt.Errorf("not a valid Encoding string") 314} 315 316 317func EncodingPtr(v Encoding) *Encoding { return &v } 318 319func (p Encoding) MarshalText() ([]byte, error) { 320return []byte(p.String()), nil 321} 322 323func (p *Encoding) UnmarshalText(text []byte) error { 324q, err := EncodingFromString(string(text)) 325if (err != nil) { 326return err 327} 328*p = q 329return nil 330} 331 332func (p *Encoding) Scan(value interface{}) error { 333v, ok := value.(int64) 334if !ok { 335return errors.New("Scan value is not int64") 336} 337*p = Encoding(v) 338return nil 339} 340 341func (p * Encoding) Value() (driver.Value, error) { 342 if p == nil { 343 return nil, nil 344 } 345return int64(*p), nil 346} 347//Supported compression algorithms. 348// 349//Codecs added in 2.4 can be read by readers based on 2.4 and later. 350//Codec support may vary between readers based on the format version and 351//libraries available at runtime. Gzip, Snappy, and LZ4 codecs are 352//widely available, while Zstd and Brotli require additional libraries. 353type CompressionCodec int64 354const ( 355 CompressionCodec_UNCOMPRESSED CompressionCodec = 0 356 CompressionCodec_SNAPPY CompressionCodec = 1 357 CompressionCodec_GZIP CompressionCodec = 2 358 CompressionCodec_LZO CompressionCodec = 3 359 CompressionCodec_BROTLI CompressionCodec = 4 360 CompressionCodec_LZ4 CompressionCodec = 5 361 CompressionCodec_ZSTD CompressionCodec = 6 362) 363 364func (p CompressionCodec) String() string { 365 switch p { 366 case CompressionCodec_UNCOMPRESSED: return "UNCOMPRESSED" 367 case CompressionCodec_SNAPPY: return "SNAPPY" 368 case CompressionCodec_GZIP: return "GZIP" 369 case CompressionCodec_LZO: return "LZO" 370 case CompressionCodec_BROTLI: return "BROTLI" 371 case CompressionCodec_LZ4: return "LZ4" 372 case CompressionCodec_ZSTD: return "ZSTD" 373 } 374 return "<UNSET>" 375} 376 377func CompressionCodecFromString(s string) (CompressionCodec, error) { 378 switch s { 379 case "UNCOMPRESSED": return CompressionCodec_UNCOMPRESSED, nil 380 case "SNAPPY": return CompressionCodec_SNAPPY, nil 381 case "GZIP": return CompressionCodec_GZIP, nil 382 case "LZO": return CompressionCodec_LZO, nil 383 case "BROTLI": return CompressionCodec_BROTLI, nil 384 case "LZ4": return CompressionCodec_LZ4, nil 385 case "ZSTD": return CompressionCodec_ZSTD, nil 386 } 387 return CompressionCodec(0), fmt.Errorf("not a valid CompressionCodec string") 388} 389 390 391func CompressionCodecPtr(v CompressionCodec) *CompressionCodec { return &v } 392 393func (p CompressionCodec) MarshalText() ([]byte, error) { 394return []byte(p.String()), nil 395} 396 397func (p *CompressionCodec) UnmarshalText(text []byte) error { 398q, err := CompressionCodecFromString(string(text)) 399if (err != nil) { 400return err 401} 402*p = q 403return nil 404} 405 406func (p *CompressionCodec) Scan(value interface{}) error { 407v, ok := value.(int64) 408if !ok { 409return errors.New("Scan value is not int64") 410} 411*p = CompressionCodec(v) 412return nil 413} 414 415func (p * CompressionCodec) Value() (driver.Value, error) { 416 if p == nil { 417 return nil, nil 418 } 419return int64(*p), nil 420} 421type PageType int64 422const ( 423 PageType_DATA_PAGE PageType = 0 424 PageType_INDEX_PAGE PageType = 1 425 PageType_DICTIONARY_PAGE PageType = 2 426 PageType_DATA_PAGE_V2 PageType = 3 427) 428 429func (p PageType) String() string { 430 switch p { 431 case PageType_DATA_PAGE: return "DATA_PAGE" 432 case PageType_INDEX_PAGE: return "INDEX_PAGE" 433 case PageType_DICTIONARY_PAGE: return "DICTIONARY_PAGE" 434 case PageType_DATA_PAGE_V2: return "DATA_PAGE_V2" 435 } 436 return "<UNSET>" 437} 438 439func PageTypeFromString(s string) (PageType, error) { 440 switch s { 441 case "DATA_PAGE": return PageType_DATA_PAGE, nil 442 case "INDEX_PAGE": return PageType_INDEX_PAGE, nil 443 case "DICTIONARY_PAGE": return PageType_DICTIONARY_PAGE, nil 444 case "DATA_PAGE_V2": return PageType_DATA_PAGE_V2, nil 445 } 446 return PageType(0), fmt.Errorf("not a valid PageType string") 447} 448 449 450func PageTypePtr(v PageType) *PageType { return &v } 451 452func (p PageType) MarshalText() ([]byte, error) { 453return []byte(p.String()), nil 454} 455 456func (p *PageType) UnmarshalText(text []byte) error { 457q, err := PageTypeFromString(string(text)) 458if (err != nil) { 459return err 460} 461*p = q 462return nil 463} 464 465func (p *PageType) Scan(value interface{}) error { 466v, ok := value.(int64) 467if !ok { 468return errors.New("Scan value is not int64") 469} 470*p = PageType(v) 471return nil 472} 473 474func (p * PageType) Value() (driver.Value, error) { 475 if p == nil { 476 return nil, nil 477 } 478return int64(*p), nil 479} 480//Enum to annotate whether lists of min/max elements inside ColumnIndex 481//are ordered and if so, in which direction. 482type BoundaryOrder int64 483const ( 484 BoundaryOrder_UNORDERED BoundaryOrder = 0 485 BoundaryOrder_ASCENDING BoundaryOrder = 1 486 BoundaryOrder_DESCENDING BoundaryOrder = 2 487) 488 489func (p BoundaryOrder) String() string { 490 switch p { 491 case BoundaryOrder_UNORDERED: return "UNORDERED" 492 case BoundaryOrder_ASCENDING: return "ASCENDING" 493 case BoundaryOrder_DESCENDING: return "DESCENDING" 494 } 495 return "<UNSET>" 496} 497 498func BoundaryOrderFromString(s string) (BoundaryOrder, error) { 499 switch s { 500 case "UNORDERED": return BoundaryOrder_UNORDERED, nil 501 case "ASCENDING": return BoundaryOrder_ASCENDING, nil 502 case "DESCENDING": return BoundaryOrder_DESCENDING, nil 503 } 504 return BoundaryOrder(0), fmt.Errorf("not a valid BoundaryOrder string") 505} 506 507 508func BoundaryOrderPtr(v BoundaryOrder) *BoundaryOrder { return &v } 509 510func (p BoundaryOrder) MarshalText() ([]byte, error) { 511return []byte(p.String()), nil 512} 513 514func (p *BoundaryOrder) UnmarshalText(text []byte) error { 515q, err := BoundaryOrderFromString(string(text)) 516if (err != nil) { 517return err 518} 519*p = q 520return nil 521} 522 523func (p *BoundaryOrder) Scan(value interface{}) error { 524v, ok := value.(int64) 525if !ok { 526return errors.New("Scan value is not int64") 527} 528*p = BoundaryOrder(v) 529return nil 530} 531 532func (p * BoundaryOrder) Value() (driver.Value, error) { 533 if p == nil { 534 return nil, nil 535 } 536return int64(*p), nil 537} 538// Statistics per row group and per page 539// All fields are optional. 540// 541// Attributes: 542// - Max: DEPRECATED: min and max value of the column. Use min_value and max_value. 543// 544// Values are encoded using PLAIN encoding, except that variable-length byte 545// arrays do not include a length prefix. 546// 547// These fields encode min and max values determined by signed comparison 548// only. New files should use the correct order for a column's logical type 549// and store the values in the min_value and max_value fields. 550// 551// To support older readers, these may be set when the column order is 552// signed. 553// - Min 554// - NullCount: count of null value in the column 555// - DistinctCount: count of distinct values occurring 556// - MaxValue: Min and max values for the column, determined by its ColumnOrder. 557// 558// Values are encoded using PLAIN encoding, except that variable-length byte 559// arrays do not include a length prefix. 560// - MinValue 561type Statistics struct { 562 Max []byte `thrift:"max,1" db:"max" json:"max,omitempty"` 563 Min []byte `thrift:"min,2" db:"min" json:"min,omitempty"` 564 NullCount *int64 `thrift:"null_count,3" db:"null_count" json:"null_count,omitempty"` 565 DistinctCount *int64 `thrift:"distinct_count,4" db:"distinct_count" json:"distinct_count,omitempty"` 566 MaxValue []byte `thrift:"max_value,5" db:"max_value" json:"max_value,omitempty"` 567 MinValue []byte `thrift:"min_value,6" db:"min_value" json:"min_value,omitempty"` 568} 569 570func NewStatistics() *Statistics { 571 return &Statistics{} 572} 573 574var Statistics_Max_DEFAULT []byte 575 576func (p *Statistics) GetMax() []byte { 577 return p.Max 578} 579var Statistics_Min_DEFAULT []byte 580 581func (p *Statistics) GetMin() []byte { 582 return p.Min 583} 584var Statistics_NullCount_DEFAULT int64 585func (p *Statistics) GetNullCount() int64 { 586 if !p.IsSetNullCount() { 587 return Statistics_NullCount_DEFAULT 588 } 589return *p.NullCount 590} 591var Statistics_DistinctCount_DEFAULT int64 592func (p *Statistics) GetDistinctCount() int64 { 593 if !p.IsSetDistinctCount() { 594 return Statistics_DistinctCount_DEFAULT 595 } 596return *p.DistinctCount 597} 598var Statistics_MaxValue_DEFAULT []byte 599 600func (p *Statistics) GetMaxValue() []byte { 601 return p.MaxValue 602} 603var Statistics_MinValue_DEFAULT []byte 604 605func (p *Statistics) GetMinValue() []byte { 606 return p.MinValue 607} 608func (p *Statistics) IsSetMax() bool { 609 return p.Max != nil 610} 611 612func (p *Statistics) IsSetMin() bool { 613 return p.Min != nil 614} 615 616func (p *Statistics) IsSetNullCount() bool { 617 return p.NullCount != nil 618} 619 620func (p *Statistics) IsSetDistinctCount() bool { 621 return p.DistinctCount != nil 622} 623 624func (p *Statistics) IsSetMaxValue() bool { 625 return p.MaxValue != nil 626} 627 628func (p *Statistics) IsSetMinValue() bool { 629 return p.MinValue != nil 630} 631 632func (p *Statistics) Read(ctx context.Context, iprot thrift.TProtocol) error { 633 if _, err := iprot.ReadStructBegin(ctx); err != nil { 634 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 635 } 636 637 638 for { 639 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 640 if err != nil { 641 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 642 } 643 if fieldTypeId == thrift.STOP { break; } 644 switch fieldId { 645 case 1: 646 if fieldTypeId == thrift.STRING { 647 if err := p.ReadField1(ctx, iprot); err != nil { 648 return err 649 } 650 } else { 651 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 652 return err 653 } 654 } 655 case 2: 656 if fieldTypeId == thrift.STRING { 657 if err := p.ReadField2(ctx, iprot); err != nil { 658 return err 659 } 660 } else { 661 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 662 return err 663 } 664 } 665 case 3: 666 if fieldTypeId == thrift.I64 { 667 if err := p.ReadField3(ctx, iprot); err != nil { 668 return err 669 } 670 } else { 671 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 672 return err 673 } 674 } 675 case 4: 676 if fieldTypeId == thrift.I64 { 677 if err := p.ReadField4(ctx, iprot); err != nil { 678 return err 679 } 680 } else { 681 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 682 return err 683 } 684 } 685 case 5: 686 if fieldTypeId == thrift.STRING { 687 if err := p.ReadField5(ctx, iprot); err != nil { 688 return err 689 } 690 } else { 691 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 692 return err 693 } 694 } 695 case 6: 696 if fieldTypeId == thrift.STRING { 697 if err := p.ReadField6(ctx, iprot); err != nil { 698 return err 699 } 700 } else { 701 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 702 return err 703 } 704 } 705 default: 706 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 707 return err 708 } 709 } 710 if err := iprot.ReadFieldEnd(ctx); err != nil { 711 return err 712 } 713 } 714 if err := iprot.ReadStructEnd(ctx); err != nil { 715 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 716 } 717 return nil 718} 719 720func (p *Statistics) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 721 if v, err := iprot.ReadBinary(ctx); err != nil { 722 return thrift.PrependError("error reading field 1: ", err) 723} else { 724 p.Max = v 725} 726 return nil 727} 728 729func (p *Statistics) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 730 if v, err := iprot.ReadBinary(ctx); err != nil { 731 return thrift.PrependError("error reading field 2: ", err) 732} else { 733 p.Min = v 734} 735 return nil 736} 737 738func (p *Statistics) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 739 if v, err := iprot.ReadI64(ctx); err != nil { 740 return thrift.PrependError("error reading field 3: ", err) 741} else { 742 p.NullCount = &v 743} 744 return nil 745} 746 747func (p *Statistics) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 748 if v, err := iprot.ReadI64(ctx); err != nil { 749 return thrift.PrependError("error reading field 4: ", err) 750} else { 751 p.DistinctCount = &v 752} 753 return nil 754} 755 756func (p *Statistics) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 757 if v, err := iprot.ReadBinary(ctx); err != nil { 758 return thrift.PrependError("error reading field 5: ", err) 759} else { 760 p.MaxValue = v 761} 762 return nil 763} 764 765func (p *Statistics) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 766 if v, err := iprot.ReadBinary(ctx); err != nil { 767 return thrift.PrependError("error reading field 6: ", err) 768} else { 769 p.MinValue = v 770} 771 return nil 772} 773 774func (p *Statistics) Write(ctx context.Context, oprot thrift.TProtocol) error { 775 if err := oprot.WriteStructBegin(ctx, "Statistics"); err != nil { 776 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 777 if p != nil { 778 if err := p.writeField1(ctx, oprot); err != nil { return err } 779 if err := p.writeField2(ctx, oprot); err != nil { return err } 780 if err := p.writeField3(ctx, oprot); err != nil { return err } 781 if err := p.writeField4(ctx, oprot); err != nil { return err } 782 if err := p.writeField5(ctx, oprot); err != nil { return err } 783 if err := p.writeField6(ctx, oprot); err != nil { return err } 784 } 785 if err := oprot.WriteFieldStop(ctx); err != nil { 786 return thrift.PrependError("write field stop error: ", err) } 787 if err := oprot.WriteStructEnd(ctx); err != nil { 788 return thrift.PrependError("write struct stop error: ", err) } 789 return nil 790} 791 792func (p *Statistics) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 793 if p.IsSetMax() { 794 if err := oprot.WriteFieldBegin(ctx, "max", thrift.STRING, 1); err != nil { 795 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:max: ", p), err) } 796 if err := oprot.WriteBinary(ctx, p.Max); err != nil { 797 return thrift.PrependError(fmt.Sprintf("%T.max (1) field write error: ", p), err) } 798 if err := oprot.WriteFieldEnd(ctx); err != nil { 799 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:max: ", p), err) } 800 } 801 return err 802} 803 804func (p *Statistics) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 805 if p.IsSetMin() { 806 if err := oprot.WriteFieldBegin(ctx, "min", thrift.STRING, 2); err != nil { 807 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:min: ", p), err) } 808 if err := oprot.WriteBinary(ctx, p.Min); err != nil { 809 return thrift.PrependError(fmt.Sprintf("%T.min (2) field write error: ", p), err) } 810 if err := oprot.WriteFieldEnd(ctx); err != nil { 811 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:min: ", p), err) } 812 } 813 return err 814} 815 816func (p *Statistics) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 817 if p.IsSetNullCount() { 818 if err := oprot.WriteFieldBegin(ctx, "null_count", thrift.I64, 3); err != nil { 819 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:null_count: ", p), err) } 820 if err := oprot.WriteI64(ctx, int64(*p.NullCount)); err != nil { 821 return thrift.PrependError(fmt.Sprintf("%T.null_count (3) field write error: ", p), err) } 822 if err := oprot.WriteFieldEnd(ctx); err != nil { 823 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:null_count: ", p), err) } 824 } 825 return err 826} 827 828func (p *Statistics) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 829 if p.IsSetDistinctCount() { 830 if err := oprot.WriteFieldBegin(ctx, "distinct_count", thrift.I64, 4); err != nil { 831 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:distinct_count: ", p), err) } 832 if err := oprot.WriteI64(ctx, int64(*p.DistinctCount)); err != nil { 833 return thrift.PrependError(fmt.Sprintf("%T.distinct_count (4) field write error: ", p), err) } 834 if err := oprot.WriteFieldEnd(ctx); err != nil { 835 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:distinct_count: ", p), err) } 836 } 837 return err 838} 839 840func (p *Statistics) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 841 if p.IsSetMaxValue() { 842 if err := oprot.WriteFieldBegin(ctx, "max_value", thrift.STRING, 5); err != nil { 843 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:max_value: ", p), err) } 844 if err := oprot.WriteBinary(ctx, p.MaxValue); err != nil { 845 return thrift.PrependError(fmt.Sprintf("%T.max_value (5) field write error: ", p), err) } 846 if err := oprot.WriteFieldEnd(ctx); err != nil { 847 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:max_value: ", p), err) } 848 } 849 return err 850} 851 852func (p *Statistics) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 853 if p.IsSetMinValue() { 854 if err := oprot.WriteFieldBegin(ctx, "min_value", thrift.STRING, 6); err != nil { 855 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:min_value: ", p), err) } 856 if err := oprot.WriteBinary(ctx, p.MinValue); err != nil { 857 return thrift.PrependError(fmt.Sprintf("%T.min_value (6) field write error: ", p), err) } 858 if err := oprot.WriteFieldEnd(ctx); err != nil { 859 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:min_value: ", p), err) } 860 } 861 return err 862} 863 864func (p *Statistics) Equals(other *Statistics) bool { 865 if p == other { 866 return true 867 } else if p == nil || other == nil { 868 return false 869 } 870 if bytes.Compare(p.Max, other.Max) != 0 { return false } 871 if bytes.Compare(p.Min, other.Min) != 0 { return false } 872 if p.NullCount != other.NullCount { 873 if p.NullCount == nil || other.NullCount == nil { 874 return false 875 } 876 if (*p.NullCount) != (*other.NullCount) { return false } 877 } 878 if p.DistinctCount != other.DistinctCount { 879 if p.DistinctCount == nil || other.DistinctCount == nil { 880 return false 881 } 882 if (*p.DistinctCount) != (*other.DistinctCount) { return false } 883 } 884 if bytes.Compare(p.MaxValue, other.MaxValue) != 0 { return false } 885 if bytes.Compare(p.MinValue, other.MinValue) != 0 { return false } 886 return true 887} 888 889func (p *Statistics) String() string { 890 if p == nil { 891 return "<nil>" 892 } 893 return fmt.Sprintf("Statistics(%+v)", *p) 894} 895 896// Empty structs to use as logical type annotations 897type StringType struct { 898} 899 900func NewStringType() *StringType { 901 return &StringType{} 902} 903 904func (p *StringType) Read(ctx context.Context, iprot thrift.TProtocol) error { 905 if _, err := iprot.ReadStructBegin(ctx); err != nil { 906 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 907 } 908 909 910 for { 911 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 912 if err != nil { 913 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 914 } 915 if fieldTypeId == thrift.STOP { break; } 916 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 917 return err 918 } 919 if err := iprot.ReadFieldEnd(ctx); err != nil { 920 return err 921 } 922 } 923 if err := iprot.ReadStructEnd(ctx); err != nil { 924 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 925 } 926 return nil 927} 928 929func (p *StringType) Write(ctx context.Context, oprot thrift.TProtocol) error { 930 if err := oprot.WriteStructBegin(ctx, "StringType"); err != nil { 931 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 932 if p != nil { 933 } 934 if err := oprot.WriteFieldStop(ctx); err != nil { 935 return thrift.PrependError("write field stop error: ", err) } 936 if err := oprot.WriteStructEnd(ctx); err != nil { 937 return thrift.PrependError("write struct stop error: ", err) } 938 return nil 939} 940 941func (p *StringType) Equals(other *StringType) bool { 942 if p == other { 943 return true 944 } else if p == nil || other == nil { 945 return false 946 } 947 return true 948} 949 950func (p *StringType) String() string { 951 if p == nil { 952 return "<nil>" 953 } 954 return fmt.Sprintf("StringType(%+v)", *p) 955} 956 957type UUIDType struct { 958} 959 960func NewUUIDType() *UUIDType { 961 return &UUIDType{} 962} 963 964func (p *UUIDType) Read(ctx context.Context, iprot thrift.TProtocol) error { 965 if _, err := iprot.ReadStructBegin(ctx); err != nil { 966 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 967 } 968 969 970 for { 971 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 972 if err != nil { 973 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 974 } 975 if fieldTypeId == thrift.STOP { break; } 976 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 977 return err 978 } 979 if err := iprot.ReadFieldEnd(ctx); err != nil { 980 return err 981 } 982 } 983 if err := iprot.ReadStructEnd(ctx); err != nil { 984 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 985 } 986 return nil 987} 988 989func (p *UUIDType) Write(ctx context.Context, oprot thrift.TProtocol) error { 990 if err := oprot.WriteStructBegin(ctx, "UUIDType"); err != nil { 991 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 992 if p != nil { 993 } 994 if err := oprot.WriteFieldStop(ctx); err != nil { 995 return thrift.PrependError("write field stop error: ", err) } 996 if err := oprot.WriteStructEnd(ctx); err != nil { 997 return thrift.PrependError("write struct stop error: ", err) } 998 return nil 999} 1000 1001func (p *UUIDType) Equals(other *UUIDType) bool { 1002 if p == other { 1003 return true 1004 } else if p == nil || other == nil { 1005 return false 1006 } 1007 return true 1008} 1009 1010func (p *UUIDType) String() string { 1011 if p == nil { 1012 return "<nil>" 1013 } 1014 return fmt.Sprintf("UUIDType(%+v)", *p) 1015} 1016 1017type MapType struct { 1018} 1019 1020func NewMapType() *MapType { 1021 return &MapType{} 1022} 1023 1024func (p *MapType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1025 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1026 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1027 } 1028 1029 1030 for { 1031 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1032 if err != nil { 1033 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1034 } 1035 if fieldTypeId == thrift.STOP { break; } 1036 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1037 return err 1038 } 1039 if err := iprot.ReadFieldEnd(ctx); err != nil { 1040 return err 1041 } 1042 } 1043 if err := iprot.ReadStructEnd(ctx); err != nil { 1044 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1045 } 1046 return nil 1047} 1048 1049func (p *MapType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1050 if err := oprot.WriteStructBegin(ctx, "MapType"); err != nil { 1051 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 1052 if p != nil { 1053 } 1054 if err := oprot.WriteFieldStop(ctx); err != nil { 1055 return thrift.PrependError("write field stop error: ", err) } 1056 if err := oprot.WriteStructEnd(ctx); err != nil { 1057 return thrift.PrependError("write struct stop error: ", err) } 1058 return nil 1059} 1060 1061func (p *MapType) Equals(other *MapType) bool { 1062 if p == other { 1063 return true 1064 } else if p == nil || other == nil { 1065 return false 1066 } 1067 return true 1068} 1069 1070func (p *MapType) String() string { 1071 if p == nil { 1072 return "<nil>" 1073 } 1074 return fmt.Sprintf("MapType(%+v)", *p) 1075} 1076 1077type ListType struct { 1078} 1079 1080func NewListType() *ListType { 1081 return &ListType{} 1082} 1083 1084func (p *ListType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1085 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1086 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1087 } 1088 1089 1090 for { 1091 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1092 if err != nil { 1093 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1094 } 1095 if fieldTypeId == thrift.STOP { break; } 1096 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1097 return err 1098 } 1099 if err := iprot.ReadFieldEnd(ctx); err != nil { 1100 return err 1101 } 1102 } 1103 if err := iprot.ReadStructEnd(ctx); err != nil { 1104 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1105 } 1106 return nil 1107} 1108 1109func (p *ListType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1110 if err := oprot.WriteStructBegin(ctx, "ListType"); err != nil { 1111 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 1112 if p != nil { 1113 } 1114 if err := oprot.WriteFieldStop(ctx); err != nil { 1115 return thrift.PrependError("write field stop error: ", err) } 1116 if err := oprot.WriteStructEnd(ctx); err != nil { 1117 return thrift.PrependError("write struct stop error: ", err) } 1118 return nil 1119} 1120 1121func (p *ListType) Equals(other *ListType) bool { 1122 if p == other { 1123 return true 1124 } else if p == nil || other == nil { 1125 return false 1126 } 1127 return true 1128} 1129 1130func (p *ListType) String() string { 1131 if p == nil { 1132 return "<nil>" 1133 } 1134 return fmt.Sprintf("ListType(%+v)", *p) 1135} 1136 1137type EnumType struct { 1138} 1139 1140func NewEnumType() *EnumType { 1141 return &EnumType{} 1142} 1143 1144func (p *EnumType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1145 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1146 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1147 } 1148 1149 1150 for { 1151 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1152 if err != nil { 1153 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1154 } 1155 if fieldTypeId == thrift.STOP { break; } 1156 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1157 return err 1158 } 1159 if err := iprot.ReadFieldEnd(ctx); err != nil { 1160 return err 1161 } 1162 } 1163 if err := iprot.ReadStructEnd(ctx); err != nil { 1164 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1165 } 1166 return nil 1167} 1168 1169func (p *EnumType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1170 if err := oprot.WriteStructBegin(ctx, "EnumType"); err != nil { 1171 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 1172 if p != nil { 1173 } 1174 if err := oprot.WriteFieldStop(ctx); err != nil { 1175 return thrift.PrependError("write field stop error: ", err) } 1176 if err := oprot.WriteStructEnd(ctx); err != nil { 1177 return thrift.PrependError("write struct stop error: ", err) } 1178 return nil 1179} 1180 1181func (p *EnumType) Equals(other *EnumType) bool { 1182 if p == other { 1183 return true 1184 } else if p == nil || other == nil { 1185 return false 1186 } 1187 return true 1188} 1189 1190func (p *EnumType) String() string { 1191 if p == nil { 1192 return "<nil>" 1193 } 1194 return fmt.Sprintf("EnumType(%+v)", *p) 1195} 1196 1197type DateType struct { 1198} 1199 1200func NewDateType() *DateType { 1201 return &DateType{} 1202} 1203 1204func (p *DateType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1205 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1206 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1207 } 1208 1209 1210 for { 1211 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1212 if err != nil { 1213 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1214 } 1215 if fieldTypeId == thrift.STOP { break; } 1216 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1217 return err 1218 } 1219 if err := iprot.ReadFieldEnd(ctx); err != nil { 1220 return err 1221 } 1222 } 1223 if err := iprot.ReadStructEnd(ctx); err != nil { 1224 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1225 } 1226 return nil 1227} 1228 1229func (p *DateType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1230 if err := oprot.WriteStructBegin(ctx, "DateType"); err != nil { 1231 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 1232 if p != nil { 1233 } 1234 if err := oprot.WriteFieldStop(ctx); err != nil { 1235 return thrift.PrependError("write field stop error: ", err) } 1236 if err := oprot.WriteStructEnd(ctx); err != nil { 1237 return thrift.PrependError("write struct stop error: ", err) } 1238 return nil 1239} 1240 1241func (p *DateType) Equals(other *DateType) bool { 1242 if p == other { 1243 return true 1244 } else if p == nil || other == nil { 1245 return false 1246 } 1247 return true 1248} 1249 1250func (p *DateType) String() string { 1251 if p == nil { 1252 return "<nil>" 1253 } 1254 return fmt.Sprintf("DateType(%+v)", *p) 1255} 1256 1257// Logical type to annotate a column that is always null. 1258// 1259// Sometimes when discovering the schema of existing data, values are always 1260// null and the physical type can't be determined. This annotation signals 1261// the case where the physical type was guessed from all null values. 1262type NullType struct { 1263} 1264 1265func NewNullType() *NullType { 1266 return &NullType{} 1267} 1268 1269func (p *NullType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1270 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1271 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1272 } 1273 1274 1275 for { 1276 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1277 if err != nil { 1278 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1279 } 1280 if fieldTypeId == thrift.STOP { break; } 1281 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1282 return err 1283 } 1284 if err := iprot.ReadFieldEnd(ctx); err != nil { 1285 return err 1286 } 1287 } 1288 if err := iprot.ReadStructEnd(ctx); err != nil { 1289 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1290 } 1291 return nil 1292} 1293 1294func (p *NullType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1295 if err := oprot.WriteStructBegin(ctx, "NullType"); err != nil { 1296 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 1297 if p != nil { 1298 } 1299 if err := oprot.WriteFieldStop(ctx); err != nil { 1300 return thrift.PrependError("write field stop error: ", err) } 1301 if err := oprot.WriteStructEnd(ctx); err != nil { 1302 return thrift.PrependError("write struct stop error: ", err) } 1303 return nil 1304} 1305 1306func (p *NullType) Equals(other *NullType) bool { 1307 if p == other { 1308 return true 1309 } else if p == nil || other == nil { 1310 return false 1311 } 1312 return true 1313} 1314 1315func (p *NullType) String() string { 1316 if p == nil { 1317 return "<nil>" 1318 } 1319 return fmt.Sprintf("NullType(%+v)", *p) 1320} 1321 1322// Decimal logical type annotation 1323// 1324// To maintain forward-compatibility in v1, implementations using this logical 1325// type must also set scale and precision on the annotated SchemaElement. 1326// 1327// Allowed for physical types: INT32, INT64, FIXED, and BINARY 1328// 1329// Attributes: 1330// - Scale 1331// - Precision 1332type DecimalType struct { 1333 Scale int32 `thrift:"scale,1,required" db:"scale" json:"scale"` 1334 Precision int32 `thrift:"precision,2,required" db:"precision" json:"precision"` 1335} 1336 1337func NewDecimalType() *DecimalType { 1338 return &DecimalType{} 1339} 1340 1341 1342func (p *DecimalType) GetScale() int32 { 1343 return p.Scale 1344} 1345 1346func (p *DecimalType) GetPrecision() int32 { 1347 return p.Precision 1348} 1349func (p *DecimalType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1350 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1351 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1352 } 1353 1354 var issetScale bool = false; 1355 var issetPrecision bool = false; 1356 1357 for { 1358 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1359 if err != nil { 1360 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1361 } 1362 if fieldTypeId == thrift.STOP { break; } 1363 switch fieldId { 1364 case 1: 1365 if fieldTypeId == thrift.I32 { 1366 if err := p.ReadField1(ctx, iprot); err != nil { 1367 return err 1368 } 1369 issetScale = true 1370 } else { 1371 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1372 return err 1373 } 1374 } 1375 case 2: 1376 if fieldTypeId == thrift.I32 { 1377 if err := p.ReadField2(ctx, iprot); err != nil { 1378 return err 1379 } 1380 issetPrecision = true 1381 } else { 1382 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1383 return err 1384 } 1385 } 1386 default: 1387 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1388 return err 1389 } 1390 } 1391 if err := iprot.ReadFieldEnd(ctx); err != nil { 1392 return err 1393 } 1394 } 1395 if err := iprot.ReadStructEnd(ctx); err != nil { 1396 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1397 } 1398 if !issetScale{ 1399 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Scale is not set")); 1400 } 1401 if !issetPrecision{ 1402 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Precision is not set")); 1403 } 1404 return nil 1405} 1406 1407func (p *DecimalType) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 1408 if v, err := iprot.ReadI32(ctx); err != nil { 1409 return thrift.PrependError("error reading field 1: ", err) 1410} else { 1411 p.Scale = v 1412} 1413 return nil 1414} 1415 1416func (p *DecimalType) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 1417 if v, err := iprot.ReadI32(ctx); err != nil { 1418 return thrift.PrependError("error reading field 2: ", err) 1419} else { 1420 p.Precision = v 1421} 1422 return nil 1423} 1424 1425func (p *DecimalType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1426 if err := oprot.WriteStructBegin(ctx, "DecimalType"); err != nil { 1427 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 1428 if p != nil { 1429 if err := p.writeField1(ctx, oprot); err != nil { return err } 1430 if err := p.writeField2(ctx, oprot); err != nil { return err } 1431 } 1432 if err := oprot.WriteFieldStop(ctx); err != nil { 1433 return thrift.PrependError("write field stop error: ", err) } 1434 if err := oprot.WriteStructEnd(ctx); err != nil { 1435 return thrift.PrependError("write struct stop error: ", err) } 1436 return nil 1437} 1438 1439func (p *DecimalType) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 1440 if err := oprot.WriteFieldBegin(ctx, "scale", thrift.I32, 1); err != nil { 1441 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:scale: ", p), err) } 1442 if err := oprot.WriteI32(ctx, int32(p.Scale)); err != nil { 1443 return thrift.PrependError(fmt.Sprintf("%T.scale (1) field write error: ", p), err) } 1444 if err := oprot.WriteFieldEnd(ctx); err != nil { 1445 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:scale: ", p), err) } 1446 return err 1447} 1448 1449func (p *DecimalType) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 1450 if err := oprot.WriteFieldBegin(ctx, "precision", thrift.I32, 2); err != nil { 1451 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:precision: ", p), err) } 1452 if err := oprot.WriteI32(ctx, int32(p.Precision)); err != nil { 1453 return thrift.PrependError(fmt.Sprintf("%T.precision (2) field write error: ", p), err) } 1454 if err := oprot.WriteFieldEnd(ctx); err != nil { 1455 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:precision: ", p), err) } 1456 return err 1457} 1458 1459func (p *DecimalType) Equals(other *DecimalType) bool { 1460 if p == other { 1461 return true 1462 } else if p == nil || other == nil { 1463 return false 1464 } 1465 if p.Scale != other.Scale { return false } 1466 if p.Precision != other.Precision { return false } 1467 return true 1468} 1469 1470func (p *DecimalType) String() string { 1471 if p == nil { 1472 return "<nil>" 1473 } 1474 return fmt.Sprintf("DecimalType(%+v)", *p) 1475} 1476 1477// Time units for logical types 1478type MilliSeconds struct { 1479} 1480 1481func NewMilliSeconds() *MilliSeconds { 1482 return &MilliSeconds{} 1483} 1484 1485func (p *MilliSeconds) Read(ctx context.Context, iprot thrift.TProtocol) error { 1486 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1487 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1488 } 1489 1490 1491 for { 1492 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1493 if err != nil { 1494 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1495 } 1496 if fieldTypeId == thrift.STOP { break; } 1497 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1498 return err 1499 } 1500 if err := iprot.ReadFieldEnd(ctx); err != nil { 1501 return err 1502 } 1503 } 1504 if err := iprot.ReadStructEnd(ctx); err != nil { 1505 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1506 } 1507 return nil 1508} 1509 1510func (p *MilliSeconds) Write(ctx context.Context, oprot thrift.TProtocol) error { 1511 if err := oprot.WriteStructBegin(ctx, "MilliSeconds"); err != nil { 1512 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 1513 if p != nil { 1514 } 1515 if err := oprot.WriteFieldStop(ctx); err != nil { 1516 return thrift.PrependError("write field stop error: ", err) } 1517 if err := oprot.WriteStructEnd(ctx); err != nil { 1518 return thrift.PrependError("write struct stop error: ", err) } 1519 return nil 1520} 1521 1522func (p *MilliSeconds) Equals(other *MilliSeconds) bool { 1523 if p == other { 1524 return true 1525 } else if p == nil || other == nil { 1526 return false 1527 } 1528 return true 1529} 1530 1531func (p *MilliSeconds) String() string { 1532 if p == nil { 1533 return "<nil>" 1534 } 1535 return fmt.Sprintf("MilliSeconds(%+v)", *p) 1536} 1537 1538type MicroSeconds struct { 1539} 1540 1541func NewMicroSeconds() *MicroSeconds { 1542 return &MicroSeconds{} 1543} 1544 1545func (p *MicroSeconds) Read(ctx context.Context, iprot thrift.TProtocol) error { 1546 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1547 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1548 } 1549 1550 1551 for { 1552 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1553 if err != nil { 1554 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1555 } 1556 if fieldTypeId == thrift.STOP { break; } 1557 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1558 return err 1559 } 1560 if err := iprot.ReadFieldEnd(ctx); err != nil { 1561 return err 1562 } 1563 } 1564 if err := iprot.ReadStructEnd(ctx); err != nil { 1565 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1566 } 1567 return nil 1568} 1569 1570func (p *MicroSeconds) Write(ctx context.Context, oprot thrift.TProtocol) error { 1571 if err := oprot.WriteStructBegin(ctx, "MicroSeconds"); err != nil { 1572 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 1573 if p != nil { 1574 } 1575 if err := oprot.WriteFieldStop(ctx); err != nil { 1576 return thrift.PrependError("write field stop error: ", err) } 1577 if err := oprot.WriteStructEnd(ctx); err != nil { 1578 return thrift.PrependError("write struct stop error: ", err) } 1579 return nil 1580} 1581 1582func (p *MicroSeconds) Equals(other *MicroSeconds) bool { 1583 if p == other { 1584 return true 1585 } else if p == nil || other == nil { 1586 return false 1587 } 1588 return true 1589} 1590 1591func (p *MicroSeconds) String() string { 1592 if p == nil { 1593 return "<nil>" 1594 } 1595 return fmt.Sprintf("MicroSeconds(%+v)", *p) 1596} 1597 1598type NanoSeconds struct { 1599} 1600 1601func NewNanoSeconds() *NanoSeconds { 1602 return &NanoSeconds{} 1603} 1604 1605func (p *NanoSeconds) Read(ctx context.Context, iprot thrift.TProtocol) error { 1606 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1607 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1608 } 1609 1610 1611 for { 1612 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1613 if err != nil { 1614 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1615 } 1616 if fieldTypeId == thrift.STOP { break; } 1617 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1618 return err 1619 } 1620 if err := iprot.ReadFieldEnd(ctx); err != nil { 1621 return err 1622 } 1623 } 1624 if err := iprot.ReadStructEnd(ctx); err != nil { 1625 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1626 } 1627 return nil 1628} 1629 1630func (p *NanoSeconds) Write(ctx context.Context, oprot thrift.TProtocol) error { 1631 if err := oprot.WriteStructBegin(ctx, "NanoSeconds"); err != nil { 1632 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 1633 if p != nil { 1634 } 1635 if err := oprot.WriteFieldStop(ctx); err != nil { 1636 return thrift.PrependError("write field stop error: ", err) } 1637 if err := oprot.WriteStructEnd(ctx); err != nil { 1638 return thrift.PrependError("write struct stop error: ", err) } 1639 return nil 1640} 1641 1642func (p *NanoSeconds) Equals(other *NanoSeconds) bool { 1643 if p == other { 1644 return true 1645 } else if p == nil || other == nil { 1646 return false 1647 } 1648 return true 1649} 1650 1651func (p *NanoSeconds) String() string { 1652 if p == nil { 1653 return "<nil>" 1654 } 1655 return fmt.Sprintf("NanoSeconds(%+v)", *p) 1656} 1657 1658// Attributes: 1659// - MILLIS 1660// - MICROS 1661// - NANOS 1662type TimeUnit struct { 1663 MILLIS *MilliSeconds `thrift:"MILLIS,1" db:"MILLIS" json:"MILLIS,omitempty"` 1664 MICROS *MicroSeconds `thrift:"MICROS,2" db:"MICROS" json:"MICROS,omitempty"` 1665 NANOS *NanoSeconds `thrift:"NANOS,3" db:"NANOS" json:"NANOS,omitempty"` 1666} 1667 1668func NewTimeUnit() *TimeUnit { 1669 return &TimeUnit{} 1670} 1671 1672var TimeUnit_MILLIS_DEFAULT *MilliSeconds 1673func (p *TimeUnit) GetMILLIS() *MilliSeconds { 1674 if !p.IsSetMILLIS() { 1675 return TimeUnit_MILLIS_DEFAULT 1676 } 1677return p.MILLIS 1678} 1679var TimeUnit_MICROS_DEFAULT *MicroSeconds 1680func (p *TimeUnit) GetMICROS() *MicroSeconds { 1681 if !p.IsSetMICROS() { 1682 return TimeUnit_MICROS_DEFAULT 1683 } 1684return p.MICROS 1685} 1686var TimeUnit_NANOS_DEFAULT *NanoSeconds 1687func (p *TimeUnit) GetNANOS() *NanoSeconds { 1688 if !p.IsSetNANOS() { 1689 return TimeUnit_NANOS_DEFAULT 1690 } 1691return p.NANOS 1692} 1693func (p *TimeUnit) CountSetFieldsTimeUnit() int { 1694 count := 0 1695 if (p.IsSetMILLIS()) { 1696 count++ 1697 } 1698 if (p.IsSetMICROS()) { 1699 count++ 1700 } 1701 if (p.IsSetNANOS()) { 1702 count++ 1703 } 1704 return count 1705 1706} 1707 1708func (p *TimeUnit) IsSetMILLIS() bool { 1709 return p.MILLIS != nil 1710} 1711 1712func (p *TimeUnit) IsSetMICROS() bool { 1713 return p.MICROS != nil 1714} 1715 1716func (p *TimeUnit) IsSetNANOS() bool { 1717 return p.NANOS != nil 1718} 1719 1720func (p *TimeUnit) Read(ctx context.Context, iprot thrift.TProtocol) error { 1721 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1722 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1723 } 1724 1725 1726 for { 1727 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1728 if err != nil { 1729 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1730 } 1731 if fieldTypeId == thrift.STOP { break; } 1732 switch fieldId { 1733 case 1: 1734 if fieldTypeId == thrift.STRUCT { 1735 if err := p.ReadField1(ctx, iprot); err != nil { 1736 return err 1737 } 1738 } else { 1739 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1740 return err 1741 } 1742 } 1743 case 2: 1744 if fieldTypeId == thrift.STRUCT { 1745 if err := p.ReadField2(ctx, iprot); err != nil { 1746 return err 1747 } 1748 } else { 1749 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1750 return err 1751 } 1752 } 1753 case 3: 1754 if fieldTypeId == thrift.STRUCT { 1755 if err := p.ReadField3(ctx, iprot); err != nil { 1756 return err 1757 } 1758 } else { 1759 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1760 return err 1761 } 1762 } 1763 default: 1764 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1765 return err 1766 } 1767 } 1768 if err := iprot.ReadFieldEnd(ctx); err != nil { 1769 return err 1770 } 1771 } 1772 if err := iprot.ReadStructEnd(ctx); err != nil { 1773 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1774 } 1775 return nil 1776} 1777 1778func (p *TimeUnit) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 1779 p.MILLIS = &MilliSeconds{} 1780 if err := p.MILLIS.Read(ctx, iprot); err != nil { 1781 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.MILLIS), err) 1782 } 1783 return nil 1784} 1785 1786func (p *TimeUnit) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 1787 p.MICROS = &MicroSeconds{} 1788 if err := p.MICROS.Read(ctx, iprot); err != nil { 1789 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.MICROS), err) 1790 } 1791 return nil 1792} 1793 1794func (p *TimeUnit) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 1795 p.NANOS = &NanoSeconds{} 1796 if err := p.NANOS.Read(ctx, iprot); err != nil { 1797 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.NANOS), err) 1798 } 1799 return nil 1800} 1801 1802func (p *TimeUnit) Write(ctx context.Context, oprot thrift.TProtocol) error { 1803 if c := p.CountSetFieldsTimeUnit(); c != 1 { 1804 return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) 1805 } 1806 if err := oprot.WriteStructBegin(ctx, "TimeUnit"); err != nil { 1807 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 1808 if p != nil { 1809 if err := p.writeField1(ctx, oprot); err != nil { return err } 1810 if err := p.writeField2(ctx, oprot); err != nil { return err } 1811 if err := p.writeField3(ctx, oprot); err != nil { return err } 1812 } 1813 if err := oprot.WriteFieldStop(ctx); err != nil { 1814 return thrift.PrependError("write field stop error: ", err) } 1815 if err := oprot.WriteStructEnd(ctx); err != nil { 1816 return thrift.PrependError("write struct stop error: ", err) } 1817 return nil 1818} 1819 1820func (p *TimeUnit) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 1821 if p.IsSetMILLIS() { 1822 if err := oprot.WriteFieldBegin(ctx, "MILLIS", thrift.STRUCT, 1); err != nil { 1823 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:MILLIS: ", p), err) } 1824 if err := p.MILLIS.Write(ctx, oprot); err != nil { 1825 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.MILLIS), err) 1826 } 1827 if err := oprot.WriteFieldEnd(ctx); err != nil { 1828 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:MILLIS: ", p), err) } 1829 } 1830 return err 1831} 1832 1833func (p *TimeUnit) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 1834 if p.IsSetMICROS() { 1835 if err := oprot.WriteFieldBegin(ctx, "MICROS", thrift.STRUCT, 2); err != nil { 1836 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:MICROS: ", p), err) } 1837 if err := p.MICROS.Write(ctx, oprot); err != nil { 1838 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.MICROS), err) 1839 } 1840 if err := oprot.WriteFieldEnd(ctx); err != nil { 1841 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:MICROS: ", p), err) } 1842 } 1843 return err 1844} 1845 1846func (p *TimeUnit) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 1847 if p.IsSetNANOS() { 1848 if err := oprot.WriteFieldBegin(ctx, "NANOS", thrift.STRUCT, 3); err != nil { 1849 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:NANOS: ", p), err) } 1850 if err := p.NANOS.Write(ctx, oprot); err != nil { 1851 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.NANOS), err) 1852 } 1853 if err := oprot.WriteFieldEnd(ctx); err != nil { 1854 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:NANOS: ", p), err) } 1855 } 1856 return err 1857} 1858 1859func (p *TimeUnit) Equals(other *TimeUnit) bool { 1860 if p == other { 1861 return true 1862 } else if p == nil || other == nil { 1863 return false 1864 } 1865 if !p.MILLIS.Equals(other.MILLIS) { return false } 1866 if !p.MICROS.Equals(other.MICROS) { return false } 1867 if !p.NANOS.Equals(other.NANOS) { return false } 1868 return true 1869} 1870 1871func (p *TimeUnit) String() string { 1872 if p == nil { 1873 return "<nil>" 1874 } 1875 return fmt.Sprintf("TimeUnit(%+v)", *p) 1876} 1877 1878// Timestamp logical type annotation 1879// 1880// Allowed for physical types: INT64 1881// 1882// Attributes: 1883// - IsAdjustedToUTC 1884// - Unit 1885type TimestampType struct { 1886 IsAdjustedToUTC bool `thrift:"isAdjustedToUTC,1,required" db:"isAdjustedToUTC" json:"isAdjustedToUTC"` 1887 Unit *TimeUnit `thrift:"unit,2,required" db:"unit" json:"unit"` 1888} 1889 1890func NewTimestampType() *TimestampType { 1891 return &TimestampType{} 1892} 1893 1894 1895func (p *TimestampType) GetIsAdjustedToUTC() bool { 1896 return p.IsAdjustedToUTC 1897} 1898var TimestampType_Unit_DEFAULT *TimeUnit 1899func (p *TimestampType) GetUnit() *TimeUnit { 1900 if !p.IsSetUnit() { 1901 return TimestampType_Unit_DEFAULT 1902 } 1903return p.Unit 1904} 1905func (p *TimestampType) IsSetUnit() bool { 1906 return p.Unit != nil 1907} 1908 1909func (p *TimestampType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1910 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1911 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1912 } 1913 1914 var issetIsAdjustedToUTC bool = false; 1915 var issetUnit bool = false; 1916 1917 for { 1918 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1919 if err != nil { 1920 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1921 } 1922 if fieldTypeId == thrift.STOP { break; } 1923 switch fieldId { 1924 case 1: 1925 if fieldTypeId == thrift.BOOL { 1926 if err := p.ReadField1(ctx, iprot); err != nil { 1927 return err 1928 } 1929 issetIsAdjustedToUTC = true 1930 } else { 1931 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1932 return err 1933 } 1934 } 1935 case 2: 1936 if fieldTypeId == thrift.STRUCT { 1937 if err := p.ReadField2(ctx, iprot); err != nil { 1938 return err 1939 } 1940 issetUnit = true 1941 } else { 1942 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1943 return err 1944 } 1945 } 1946 default: 1947 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1948 return err 1949 } 1950 } 1951 if err := iprot.ReadFieldEnd(ctx); err != nil { 1952 return err 1953 } 1954 } 1955 if err := iprot.ReadStructEnd(ctx); err != nil { 1956 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1957 } 1958 if !issetIsAdjustedToUTC{ 1959 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsAdjustedToUTC is not set")); 1960 } 1961 if !issetUnit{ 1962 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Unit is not set")); 1963 } 1964 return nil 1965} 1966 1967func (p *TimestampType) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 1968 if v, err := iprot.ReadBool(ctx); err != nil { 1969 return thrift.PrependError("error reading field 1: ", err) 1970} else { 1971 p.IsAdjustedToUTC = v 1972} 1973 return nil 1974} 1975 1976func (p *TimestampType) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 1977 p.Unit = &TimeUnit{} 1978 if err := p.Unit.Read(ctx, iprot); err != nil { 1979 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Unit), err) 1980 } 1981 return nil 1982} 1983 1984func (p *TimestampType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1985 if err := oprot.WriteStructBegin(ctx, "TimestampType"); err != nil { 1986 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 1987 if p != nil { 1988 if err := p.writeField1(ctx, oprot); err != nil { return err } 1989 if err := p.writeField2(ctx, oprot); err != nil { return err } 1990 } 1991 if err := oprot.WriteFieldStop(ctx); err != nil { 1992 return thrift.PrependError("write field stop error: ", err) } 1993 if err := oprot.WriteStructEnd(ctx); err != nil { 1994 return thrift.PrependError("write struct stop error: ", err) } 1995 return nil 1996} 1997 1998func (p *TimestampType) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 1999 if err := oprot.WriteFieldBegin(ctx, "isAdjustedToUTC", thrift.BOOL, 1); err != nil { 2000 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:isAdjustedToUTC: ", p), err) } 2001 if err := oprot.WriteBool(ctx, bool(p.IsAdjustedToUTC)); err != nil { 2002 return thrift.PrependError(fmt.Sprintf("%T.isAdjustedToUTC (1) field write error: ", p), err) } 2003 if err := oprot.WriteFieldEnd(ctx); err != nil { 2004 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:isAdjustedToUTC: ", p), err) } 2005 return err 2006} 2007 2008func (p *TimestampType) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 2009 if err := oprot.WriteFieldBegin(ctx, "unit", thrift.STRUCT, 2); err != nil { 2010 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:unit: ", p), err) } 2011 if err := p.Unit.Write(ctx, oprot); err != nil { 2012 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Unit), err) 2013 } 2014 if err := oprot.WriteFieldEnd(ctx); err != nil { 2015 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:unit: ", p), err) } 2016 return err 2017} 2018 2019func (p *TimestampType) Equals(other *TimestampType) bool { 2020 if p == other { 2021 return true 2022 } else if p == nil || other == nil { 2023 return false 2024 } 2025 if p.IsAdjustedToUTC != other.IsAdjustedToUTC { return false } 2026 if !p.Unit.Equals(other.Unit) { return false } 2027 return true 2028} 2029 2030func (p *TimestampType) String() string { 2031 if p == nil { 2032 return "<nil>" 2033 } 2034 return fmt.Sprintf("TimestampType(%+v)", *p) 2035} 2036 2037// Time logical type annotation 2038// 2039// Allowed for physical types: INT32 (millis), INT64 (micros, nanos) 2040// 2041// Attributes: 2042// - IsAdjustedToUTC 2043// - Unit 2044type TimeType struct { 2045 IsAdjustedToUTC bool `thrift:"isAdjustedToUTC,1,required" db:"isAdjustedToUTC" json:"isAdjustedToUTC"` 2046 Unit *TimeUnit `thrift:"unit,2,required" db:"unit" json:"unit"` 2047} 2048 2049func NewTimeType() *TimeType { 2050 return &TimeType{} 2051} 2052 2053 2054func (p *TimeType) GetIsAdjustedToUTC() bool { 2055 return p.IsAdjustedToUTC 2056} 2057var TimeType_Unit_DEFAULT *TimeUnit 2058func (p *TimeType) GetUnit() *TimeUnit { 2059 if !p.IsSetUnit() { 2060 return TimeType_Unit_DEFAULT 2061 } 2062return p.Unit 2063} 2064func (p *TimeType) IsSetUnit() bool { 2065 return p.Unit != nil 2066} 2067 2068func (p *TimeType) Read(ctx context.Context, iprot thrift.TProtocol) error { 2069 if _, err := iprot.ReadStructBegin(ctx); err != nil { 2070 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2071 } 2072 2073 var issetIsAdjustedToUTC bool = false; 2074 var issetUnit bool = false; 2075 2076 for { 2077 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 2078 if err != nil { 2079 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2080 } 2081 if fieldTypeId == thrift.STOP { break; } 2082 switch fieldId { 2083 case 1: 2084 if fieldTypeId == thrift.BOOL { 2085 if err := p.ReadField1(ctx, iprot); err != nil { 2086 return err 2087 } 2088 issetIsAdjustedToUTC = true 2089 } else { 2090 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2091 return err 2092 } 2093 } 2094 case 2: 2095 if fieldTypeId == thrift.STRUCT { 2096 if err := p.ReadField2(ctx, iprot); err != nil { 2097 return err 2098 } 2099 issetUnit = true 2100 } else { 2101 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2102 return err 2103 } 2104 } 2105 default: 2106 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2107 return err 2108 } 2109 } 2110 if err := iprot.ReadFieldEnd(ctx); err != nil { 2111 return err 2112 } 2113 } 2114 if err := iprot.ReadStructEnd(ctx); err != nil { 2115 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2116 } 2117 if !issetIsAdjustedToUTC{ 2118 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsAdjustedToUTC is not set")); 2119 } 2120 if !issetUnit{ 2121 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Unit is not set")); 2122 } 2123 return nil 2124} 2125 2126func (p *TimeType) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 2127 if v, err := iprot.ReadBool(ctx); err != nil { 2128 return thrift.PrependError("error reading field 1: ", err) 2129} else { 2130 p.IsAdjustedToUTC = v 2131} 2132 return nil 2133} 2134 2135func (p *TimeType) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 2136 p.Unit = &TimeUnit{} 2137 if err := p.Unit.Read(ctx, iprot); err != nil { 2138 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Unit), err) 2139 } 2140 return nil 2141} 2142 2143func (p *TimeType) Write(ctx context.Context, oprot thrift.TProtocol) error { 2144 if err := oprot.WriteStructBegin(ctx, "TimeType"); err != nil { 2145 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 2146 if p != nil { 2147 if err := p.writeField1(ctx, oprot); err != nil { return err } 2148 if err := p.writeField2(ctx, oprot); err != nil { return err } 2149 } 2150 if err := oprot.WriteFieldStop(ctx); err != nil { 2151 return thrift.PrependError("write field stop error: ", err) } 2152 if err := oprot.WriteStructEnd(ctx); err != nil { 2153 return thrift.PrependError("write struct stop error: ", err) } 2154 return nil 2155} 2156 2157func (p *TimeType) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 2158 if err := oprot.WriteFieldBegin(ctx, "isAdjustedToUTC", thrift.BOOL, 1); err != nil { 2159 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:isAdjustedToUTC: ", p), err) } 2160 if err := oprot.WriteBool(ctx, bool(p.IsAdjustedToUTC)); err != nil { 2161 return thrift.PrependError(fmt.Sprintf("%T.isAdjustedToUTC (1) field write error: ", p), err) } 2162 if err := oprot.WriteFieldEnd(ctx); err != nil { 2163 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:isAdjustedToUTC: ", p), err) } 2164 return err 2165} 2166 2167func (p *TimeType) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 2168 if err := oprot.WriteFieldBegin(ctx, "unit", thrift.STRUCT, 2); err != nil { 2169 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:unit: ", p), err) } 2170 if err := p.Unit.Write(ctx, oprot); err != nil { 2171 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Unit), err) 2172 } 2173 if err := oprot.WriteFieldEnd(ctx); err != nil { 2174 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:unit: ", p), err) } 2175 return err 2176} 2177 2178func (p *TimeType) Equals(other *TimeType) bool { 2179 if p == other { 2180 return true 2181 } else if p == nil || other == nil { 2182 return false 2183 } 2184 if p.IsAdjustedToUTC != other.IsAdjustedToUTC { return false } 2185 if !p.Unit.Equals(other.Unit) { return false } 2186 return true 2187} 2188 2189func (p *TimeType) String() string { 2190 if p == nil { 2191 return "<nil>" 2192 } 2193 return fmt.Sprintf("TimeType(%+v)", *p) 2194} 2195 2196// Integer logical type annotation 2197// 2198// bitWidth must be 8, 16, 32, or 64. 2199// 2200// Allowed for physical types: INT32, INT64 2201// 2202// Attributes: 2203// - BitWidth 2204// - IsSigned 2205type IntType struct { 2206 BitWidth int8 `thrift:"bitWidth,1,required" db:"bitWidth" json:"bitWidth"` 2207 IsSigned bool `thrift:"isSigned,2,required" db:"isSigned" json:"isSigned"` 2208} 2209 2210func NewIntType() *IntType { 2211 return &IntType{} 2212} 2213 2214 2215func (p *IntType) GetBitWidth() int8 { 2216 return p.BitWidth 2217} 2218 2219func (p *IntType) GetIsSigned() bool { 2220 return p.IsSigned 2221} 2222func (p *IntType) Read(ctx context.Context, iprot thrift.TProtocol) error { 2223 if _, err := iprot.ReadStructBegin(ctx); err != nil { 2224 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2225 } 2226 2227 var issetBitWidth bool = false; 2228 var issetIsSigned bool = false; 2229 2230 for { 2231 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 2232 if err != nil { 2233 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2234 } 2235 if fieldTypeId == thrift.STOP { break; } 2236 switch fieldId { 2237 case 1: 2238 if fieldTypeId == thrift.BYTE { 2239 if err := p.ReadField1(ctx, iprot); err != nil { 2240 return err 2241 } 2242 issetBitWidth = true 2243 } else { 2244 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2245 return err 2246 } 2247 } 2248 case 2: 2249 if fieldTypeId == thrift.BOOL { 2250 if err := p.ReadField2(ctx, iprot); err != nil { 2251 return err 2252 } 2253 issetIsSigned = true 2254 } else { 2255 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2256 return err 2257 } 2258 } 2259 default: 2260 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2261 return err 2262 } 2263 } 2264 if err := iprot.ReadFieldEnd(ctx); err != nil { 2265 return err 2266 } 2267 } 2268 if err := iprot.ReadStructEnd(ctx); err != nil { 2269 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2270 } 2271 if !issetBitWidth{ 2272 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field BitWidth is not set")); 2273 } 2274 if !issetIsSigned{ 2275 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsSigned is not set")); 2276 } 2277 return nil 2278} 2279 2280func (p *IntType) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 2281 if v, err := iprot.ReadByte(ctx); err != nil { 2282 return thrift.PrependError("error reading field 1: ", err) 2283} else { 2284 temp := int8(v) 2285 p.BitWidth = temp 2286} 2287 return nil 2288} 2289 2290func (p *IntType) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 2291 if v, err := iprot.ReadBool(ctx); err != nil { 2292 return thrift.PrependError("error reading field 2: ", err) 2293} else { 2294 p.IsSigned = v 2295} 2296 return nil 2297} 2298 2299func (p *IntType) Write(ctx context.Context, oprot thrift.TProtocol) error { 2300 if err := oprot.WriteStructBegin(ctx, "IntType"); err != nil { 2301 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 2302 if p != nil { 2303 if err := p.writeField1(ctx, oprot); err != nil { return err } 2304 if err := p.writeField2(ctx, oprot); err != nil { return err } 2305 } 2306 if err := oprot.WriteFieldStop(ctx); err != nil { 2307 return thrift.PrependError("write field stop error: ", err) } 2308 if err := oprot.WriteStructEnd(ctx); err != nil { 2309 return thrift.PrependError("write struct stop error: ", err) } 2310 return nil 2311} 2312 2313func (p *IntType) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 2314 if err := oprot.WriteFieldBegin(ctx, "bitWidth", thrift.BYTE, 1); err != nil { 2315 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:bitWidth: ", p), err) } 2316 if err := oprot.WriteByte(ctx, int8(p.BitWidth)); err != nil { 2317 return thrift.PrependError(fmt.Sprintf("%T.bitWidth (1) field write error: ", p), err) } 2318 if err := oprot.WriteFieldEnd(ctx); err != nil { 2319 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:bitWidth: ", p), err) } 2320 return err 2321} 2322 2323func (p *IntType) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 2324 if err := oprot.WriteFieldBegin(ctx, "isSigned", thrift.BOOL, 2); err != nil { 2325 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:isSigned: ", p), err) } 2326 if err := oprot.WriteBool(ctx, bool(p.IsSigned)); err != nil { 2327 return thrift.PrependError(fmt.Sprintf("%T.isSigned (2) field write error: ", p), err) } 2328 if err := oprot.WriteFieldEnd(ctx); err != nil { 2329 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:isSigned: ", p), err) } 2330 return err 2331} 2332 2333func (p *IntType) Equals(other *IntType) bool { 2334 if p == other { 2335 return true 2336 } else if p == nil || other == nil { 2337 return false 2338 } 2339 if p.BitWidth != other.BitWidth { return false } 2340 if p.IsSigned != other.IsSigned { return false } 2341 return true 2342} 2343 2344func (p *IntType) String() string { 2345 if p == nil { 2346 return "<nil>" 2347 } 2348 return fmt.Sprintf("IntType(%+v)", *p) 2349} 2350 2351// Embedded JSON logical type annotation 2352// 2353// Allowed for physical types: BINARY 2354type JsonType struct { 2355} 2356 2357func NewJsonType() *JsonType { 2358 return &JsonType{} 2359} 2360 2361func (p *JsonType) Read(ctx context.Context, iprot thrift.TProtocol) error { 2362 if _, err := iprot.ReadStructBegin(ctx); err != nil { 2363 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2364 } 2365 2366 2367 for { 2368 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 2369 if err != nil { 2370 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2371 } 2372 if fieldTypeId == thrift.STOP { break; } 2373 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2374 return err 2375 } 2376 if err := iprot.ReadFieldEnd(ctx); err != nil { 2377 return err 2378 } 2379 } 2380 if err := iprot.ReadStructEnd(ctx); err != nil { 2381 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2382 } 2383 return nil 2384} 2385 2386func (p *JsonType) Write(ctx context.Context, oprot thrift.TProtocol) error { 2387 if err := oprot.WriteStructBegin(ctx, "JsonType"); err != nil { 2388 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 2389 if p != nil { 2390 } 2391 if err := oprot.WriteFieldStop(ctx); err != nil { 2392 return thrift.PrependError("write field stop error: ", err) } 2393 if err := oprot.WriteStructEnd(ctx); err != nil { 2394 return thrift.PrependError("write struct stop error: ", err) } 2395 return nil 2396} 2397 2398func (p *JsonType) Equals(other *JsonType) bool { 2399 if p == other { 2400 return true 2401 } else if p == nil || other == nil { 2402 return false 2403 } 2404 return true 2405} 2406 2407func (p *JsonType) String() string { 2408 if p == nil { 2409 return "<nil>" 2410 } 2411 return fmt.Sprintf("JsonType(%+v)", *p) 2412} 2413 2414// Embedded BSON logical type annotation 2415// 2416// Allowed for physical types: BINARY 2417type BsonType struct { 2418} 2419 2420func NewBsonType() *BsonType { 2421 return &BsonType{} 2422} 2423 2424func (p *BsonType) Read(ctx context.Context, iprot thrift.TProtocol) error { 2425 if _, err := iprot.ReadStructBegin(ctx); err != nil { 2426 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2427 } 2428 2429 2430 for { 2431 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 2432 if err != nil { 2433 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2434 } 2435 if fieldTypeId == thrift.STOP { break; } 2436 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2437 return err 2438 } 2439 if err := iprot.ReadFieldEnd(ctx); err != nil { 2440 return err 2441 } 2442 } 2443 if err := iprot.ReadStructEnd(ctx); err != nil { 2444 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2445 } 2446 return nil 2447} 2448 2449func (p *BsonType) Write(ctx context.Context, oprot thrift.TProtocol) error { 2450 if err := oprot.WriteStructBegin(ctx, "BsonType"); err != nil { 2451 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 2452 if p != nil { 2453 } 2454 if err := oprot.WriteFieldStop(ctx); err != nil { 2455 return thrift.PrependError("write field stop error: ", err) } 2456 if err := oprot.WriteStructEnd(ctx); err != nil { 2457 return thrift.PrependError("write struct stop error: ", err) } 2458 return nil 2459} 2460 2461func (p *BsonType) Equals(other *BsonType) bool { 2462 if p == other { 2463 return true 2464 } else if p == nil || other == nil { 2465 return false 2466 } 2467 return true 2468} 2469 2470func (p *BsonType) String() string { 2471 if p == nil { 2472 return "<nil>" 2473 } 2474 return fmt.Sprintf("BsonType(%+v)", *p) 2475} 2476 2477// LogicalType annotations to replace ConvertedType. 2478// 2479// To maintain compatibility, implementations using LogicalType for a 2480// SchemaElement must also set the corresponding ConvertedType from the 2481// following table. 2482// 2483// Attributes: 2484// - STRING 2485// - MAP 2486// - LIST 2487// - ENUM 2488// - DECIMAL 2489// - DATE 2490// - TIME 2491// - TIMESTAMP 2492// - INTEGER 2493// - UNKNOWN 2494// - JSON 2495// - BSON 2496// - UUID 2497type LogicalType struct { 2498 STRING *StringType `thrift:"STRING,1" db:"STRING" json:"STRING,omitempty"` 2499 MAP *MapType `thrift:"MAP,2" db:"MAP" json:"MAP,omitempty"` 2500 LIST *ListType `thrift:"LIST,3" db:"LIST" json:"LIST,omitempty"` 2501 ENUM *EnumType `thrift:"ENUM,4" db:"ENUM" json:"ENUM,omitempty"` 2502 DECIMAL *DecimalType `thrift:"DECIMAL,5" db:"DECIMAL" json:"DECIMAL,omitempty"` 2503 DATE *DateType `thrift:"DATE,6" db:"DATE" json:"DATE,omitempty"` 2504 TIME *TimeType `thrift:"TIME,7" db:"TIME" json:"TIME,omitempty"` 2505 TIMESTAMP *TimestampType `thrift:"TIMESTAMP,8" db:"TIMESTAMP" json:"TIMESTAMP,omitempty"` 2506 // unused field # 9 2507 INTEGER *IntType `thrift:"INTEGER,10" db:"INTEGER" json:"INTEGER,omitempty"` 2508 UNKNOWN *NullType `thrift:"UNKNOWN,11" db:"UNKNOWN" json:"UNKNOWN,omitempty"` 2509 JSON *JsonType `thrift:"JSON,12" db:"JSON" json:"JSON,omitempty"` 2510 BSON *BsonType `thrift:"BSON,13" db:"BSON" json:"BSON,omitempty"` 2511 UUID *UUIDType `thrift:"UUID,14" db:"UUID" json:"UUID,omitempty"` 2512} 2513 2514func NewLogicalType() *LogicalType { 2515 return &LogicalType{} 2516} 2517 2518var LogicalType_STRING_DEFAULT *StringType 2519func (p *LogicalType) GetSTRING() *StringType { 2520 if !p.IsSetSTRING() { 2521 return LogicalType_STRING_DEFAULT 2522 } 2523return p.STRING 2524} 2525var LogicalType_MAP_DEFAULT *MapType 2526func (p *LogicalType) GetMAP() *MapType { 2527 if !p.IsSetMAP() { 2528 return LogicalType_MAP_DEFAULT 2529 } 2530return p.MAP 2531} 2532var LogicalType_LIST_DEFAULT *ListType 2533func (p *LogicalType) GetLIST() *ListType { 2534 if !p.IsSetLIST() { 2535 return LogicalType_LIST_DEFAULT 2536 } 2537return p.LIST 2538} 2539var LogicalType_ENUM_DEFAULT *EnumType 2540func (p *LogicalType) GetENUM() *EnumType { 2541 if !p.IsSetENUM() { 2542 return LogicalType_ENUM_DEFAULT 2543 } 2544return p.ENUM 2545} 2546var LogicalType_DECIMAL_DEFAULT *DecimalType 2547func (p *LogicalType) GetDECIMAL() *DecimalType { 2548 if !p.IsSetDECIMAL() { 2549 return LogicalType_DECIMAL_DEFAULT 2550 } 2551return p.DECIMAL 2552} 2553var LogicalType_DATE_DEFAULT *DateType 2554func (p *LogicalType) GetDATE() *DateType { 2555 if !p.IsSetDATE() { 2556 return LogicalType_DATE_DEFAULT 2557 } 2558return p.DATE 2559} 2560var LogicalType_TIME_DEFAULT *TimeType 2561func (p *LogicalType) GetTIME() *TimeType { 2562 if !p.IsSetTIME() { 2563 return LogicalType_TIME_DEFAULT 2564 } 2565return p.TIME 2566} 2567var LogicalType_TIMESTAMP_DEFAULT *TimestampType 2568func (p *LogicalType) GetTIMESTAMP() *TimestampType { 2569 if !p.IsSetTIMESTAMP() { 2570 return LogicalType_TIMESTAMP_DEFAULT 2571 } 2572return p.TIMESTAMP 2573} 2574var LogicalType_INTEGER_DEFAULT *IntType 2575func (p *LogicalType) GetINTEGER() *IntType { 2576 if !p.IsSetINTEGER() { 2577 return LogicalType_INTEGER_DEFAULT 2578 } 2579return p.INTEGER 2580} 2581var LogicalType_UNKNOWN_DEFAULT *NullType 2582func (p *LogicalType) GetUNKNOWN() *NullType { 2583 if !p.IsSetUNKNOWN() { 2584 return LogicalType_UNKNOWN_DEFAULT 2585 } 2586return p.UNKNOWN 2587} 2588var LogicalType_JSON_DEFAULT *JsonType 2589func (p *LogicalType) GetJSON() *JsonType { 2590 if !p.IsSetJSON() { 2591 return LogicalType_JSON_DEFAULT 2592 } 2593return p.JSON 2594} 2595var LogicalType_BSON_DEFAULT *BsonType 2596func (p *LogicalType) GetBSON() *BsonType { 2597 if !p.IsSetBSON() { 2598 return LogicalType_BSON_DEFAULT 2599 } 2600return p.BSON 2601} 2602var LogicalType_UUID_DEFAULT *UUIDType 2603func (p *LogicalType) GetUUID() *UUIDType { 2604 if !p.IsSetUUID() { 2605 return LogicalType_UUID_DEFAULT 2606 } 2607return p.UUID 2608} 2609func (p *LogicalType) CountSetFieldsLogicalType() int { 2610 count := 0 2611 if (p.IsSetSTRING()) { 2612 count++ 2613 } 2614 if (p.IsSetMAP()) { 2615 count++ 2616 } 2617 if (p.IsSetLIST()) { 2618 count++ 2619 } 2620 if (p.IsSetENUM()) { 2621 count++ 2622 } 2623 if (p.IsSetDECIMAL()) { 2624 count++ 2625 } 2626 if (p.IsSetDATE()) { 2627 count++ 2628 } 2629 if (p.IsSetTIME()) { 2630 count++ 2631 } 2632 if (p.IsSetTIMESTAMP()) { 2633 count++ 2634 } 2635 if (p.IsSetINTEGER()) { 2636 count++ 2637 } 2638 if (p.IsSetUNKNOWN()) { 2639 count++ 2640 } 2641 if (p.IsSetJSON()) { 2642 count++ 2643 } 2644 if (p.IsSetBSON()) { 2645 count++ 2646 } 2647 if (p.IsSetUUID()) { 2648 count++ 2649 } 2650 return count 2651 2652} 2653 2654func (p *LogicalType) IsSetSTRING() bool { 2655 return p.STRING != nil 2656} 2657 2658func (p *LogicalType) IsSetMAP() bool { 2659 return p.MAP != nil 2660} 2661 2662func (p *LogicalType) IsSetLIST() bool { 2663 return p.LIST != nil 2664} 2665 2666func (p *LogicalType) IsSetENUM() bool { 2667 return p.ENUM != nil 2668} 2669 2670func (p *LogicalType) IsSetDECIMAL() bool { 2671 return p.DECIMAL != nil 2672} 2673 2674func (p *LogicalType) IsSetDATE() bool { 2675 return p.DATE != nil 2676} 2677 2678func (p *LogicalType) IsSetTIME() bool { 2679 return p.TIME != nil 2680} 2681 2682func (p *LogicalType) IsSetTIMESTAMP() bool { 2683 return p.TIMESTAMP != nil 2684} 2685 2686func (p *LogicalType) IsSetINTEGER() bool { 2687 return p.INTEGER != nil 2688} 2689 2690func (p *LogicalType) IsSetUNKNOWN() bool { 2691 return p.UNKNOWN != nil 2692} 2693 2694func (p *LogicalType) IsSetJSON() bool { 2695 return p.JSON != nil 2696} 2697 2698func (p *LogicalType) IsSetBSON() bool { 2699 return p.BSON != nil 2700} 2701 2702func (p *LogicalType) IsSetUUID() bool { 2703 return p.UUID != nil 2704} 2705 2706func (p *LogicalType) Read(ctx context.Context, iprot thrift.TProtocol) error { 2707 if _, err := iprot.ReadStructBegin(ctx); err != nil { 2708 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2709 } 2710 2711 2712 for { 2713 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 2714 if err != nil { 2715 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2716 } 2717 if fieldTypeId == thrift.STOP { break; } 2718 switch fieldId { 2719 case 1: 2720 if fieldTypeId == thrift.STRUCT { 2721 if err := p.ReadField1(ctx, iprot); err != nil { 2722 return err 2723 } 2724 } else { 2725 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2726 return err 2727 } 2728 } 2729 case 2: 2730 if fieldTypeId == thrift.STRUCT { 2731 if err := p.ReadField2(ctx, iprot); err != nil { 2732 return err 2733 } 2734 } else { 2735 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2736 return err 2737 } 2738 } 2739 case 3: 2740 if fieldTypeId == thrift.STRUCT { 2741 if err := p.ReadField3(ctx, iprot); err != nil { 2742 return err 2743 } 2744 } else { 2745 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2746 return err 2747 } 2748 } 2749 case 4: 2750 if fieldTypeId == thrift.STRUCT { 2751 if err := p.ReadField4(ctx, iprot); err != nil { 2752 return err 2753 } 2754 } else { 2755 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2756 return err 2757 } 2758 } 2759 case 5: 2760 if fieldTypeId == thrift.STRUCT { 2761 if err := p.ReadField5(ctx, iprot); err != nil { 2762 return err 2763 } 2764 } else { 2765 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2766 return err 2767 } 2768 } 2769 case 6: 2770 if fieldTypeId == thrift.STRUCT { 2771 if err := p.ReadField6(ctx, iprot); err != nil { 2772 return err 2773 } 2774 } else { 2775 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2776 return err 2777 } 2778 } 2779 case 7: 2780 if fieldTypeId == thrift.STRUCT { 2781 if err := p.ReadField7(ctx, iprot); err != nil { 2782 return err 2783 } 2784 } else { 2785 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2786 return err 2787 } 2788 } 2789 case 8: 2790 if fieldTypeId == thrift.STRUCT { 2791 if err := p.ReadField8(ctx, iprot); err != nil { 2792 return err 2793 } 2794 } else { 2795 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2796 return err 2797 } 2798 } 2799 case 10: 2800 if fieldTypeId == thrift.STRUCT { 2801 if err := p.ReadField10(ctx, iprot); err != nil { 2802 return err 2803 } 2804 } else { 2805 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2806 return err 2807 } 2808 } 2809 case 11: 2810 if fieldTypeId == thrift.STRUCT { 2811 if err := p.ReadField11(ctx, iprot); err != nil { 2812 return err 2813 } 2814 } else { 2815 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2816 return err 2817 } 2818 } 2819 case 12: 2820 if fieldTypeId == thrift.STRUCT { 2821 if err := p.ReadField12(ctx, iprot); err != nil { 2822 return err 2823 } 2824 } else { 2825 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2826 return err 2827 } 2828 } 2829 case 13: 2830 if fieldTypeId == thrift.STRUCT { 2831 if err := p.ReadField13(ctx, iprot); err != nil { 2832 return err 2833 } 2834 } else { 2835 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2836 return err 2837 } 2838 } 2839 case 14: 2840 if fieldTypeId == thrift.STRUCT { 2841 if err := p.ReadField14(ctx, iprot); err != nil { 2842 return err 2843 } 2844 } else { 2845 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2846 return err 2847 } 2848 } 2849 default: 2850 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2851 return err 2852 } 2853 } 2854 if err := iprot.ReadFieldEnd(ctx); err != nil { 2855 return err 2856 } 2857 } 2858 if err := iprot.ReadStructEnd(ctx); err != nil { 2859 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2860 } 2861 return nil 2862} 2863 2864func (p *LogicalType) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 2865 p.STRING = &StringType{} 2866 if err := p.STRING.Read(ctx, iprot); err != nil { 2867 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.STRING), err) 2868 } 2869 return nil 2870} 2871 2872func (p *LogicalType) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 2873 p.MAP = &MapType{} 2874 if err := p.MAP.Read(ctx, iprot); err != nil { 2875 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.MAP), err) 2876 } 2877 return nil 2878} 2879 2880func (p *LogicalType) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 2881 p.LIST = &ListType{} 2882 if err := p.LIST.Read(ctx, iprot); err != nil { 2883 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.LIST), err) 2884 } 2885 return nil 2886} 2887 2888func (p *LogicalType) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 2889 p.ENUM = &EnumType{} 2890 if err := p.ENUM.Read(ctx, iprot); err != nil { 2891 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ENUM), err) 2892 } 2893 return nil 2894} 2895 2896func (p *LogicalType) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 2897 p.DECIMAL = &DecimalType{} 2898 if err := p.DECIMAL.Read(ctx, iprot); err != nil { 2899 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DECIMAL), err) 2900 } 2901 return nil 2902} 2903 2904func (p *LogicalType) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 2905 p.DATE = &DateType{} 2906 if err := p.DATE.Read(ctx, iprot); err != nil { 2907 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DATE), err) 2908 } 2909 return nil 2910} 2911 2912func (p *LogicalType) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 2913 p.TIME = &TimeType{} 2914 if err := p.TIME.Read(ctx, iprot); err != nil { 2915 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TIME), err) 2916 } 2917 return nil 2918} 2919 2920func (p *LogicalType) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 2921 p.TIMESTAMP = &TimestampType{} 2922 if err := p.TIMESTAMP.Read(ctx, iprot); err != nil { 2923 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TIMESTAMP), err) 2924 } 2925 return nil 2926} 2927 2928func (p *LogicalType) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { 2929 p.INTEGER = &IntType{} 2930 if err := p.INTEGER.Read(ctx, iprot); err != nil { 2931 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.INTEGER), err) 2932 } 2933 return nil 2934} 2935 2936func (p *LogicalType) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { 2937 p.UNKNOWN = &NullType{} 2938 if err := p.UNKNOWN.Read(ctx, iprot); err != nil { 2939 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.UNKNOWN), err) 2940 } 2941 return nil 2942} 2943 2944func (p *LogicalType) ReadField12(ctx context.Context, iprot thrift.TProtocol) error { 2945 p.JSON = &JsonType{} 2946 if err := p.JSON.Read(ctx, iprot); err != nil { 2947 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.JSON), err) 2948 } 2949 return nil 2950} 2951 2952func (p *LogicalType) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { 2953 p.BSON = &BsonType{} 2954 if err := p.BSON.Read(ctx, iprot); err != nil { 2955 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.BSON), err) 2956 } 2957 return nil 2958} 2959 2960func (p *LogicalType) ReadField14(ctx context.Context, iprot thrift.TProtocol) error { 2961 p.UUID = &UUIDType{} 2962 if err := p.UUID.Read(ctx, iprot); err != nil { 2963 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.UUID), err) 2964 } 2965 return nil 2966} 2967 2968func (p *LogicalType) Write(ctx context.Context, oprot thrift.TProtocol) error { 2969 if c := p.CountSetFieldsLogicalType(); c != 1 { 2970 return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) 2971 } 2972 if err := oprot.WriteStructBegin(ctx, "LogicalType"); err != nil { 2973 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 2974 if p != nil { 2975 if err := p.writeField1(ctx, oprot); err != nil { return err } 2976 if err := p.writeField2(ctx, oprot); err != nil { return err } 2977 if err := p.writeField3(ctx, oprot); err != nil { return err } 2978 if err := p.writeField4(ctx, oprot); err != nil { return err } 2979 if err := p.writeField5(ctx, oprot); err != nil { return err } 2980 if err := p.writeField6(ctx, oprot); err != nil { return err } 2981 if err := p.writeField7(ctx, oprot); err != nil { return err } 2982 if err := p.writeField8(ctx, oprot); err != nil { return err } 2983 if err := p.writeField10(ctx, oprot); err != nil { return err } 2984 if err := p.writeField11(ctx, oprot); err != nil { return err } 2985 if err := p.writeField12(ctx, oprot); err != nil { return err } 2986 if err := p.writeField13(ctx, oprot); err != nil { return err } 2987 if err := p.writeField14(ctx, oprot); err != nil { return err } 2988 } 2989 if err := oprot.WriteFieldStop(ctx); err != nil { 2990 return thrift.PrependError("write field stop error: ", err) } 2991 if err := oprot.WriteStructEnd(ctx); err != nil { 2992 return thrift.PrependError("write struct stop error: ", err) } 2993 return nil 2994} 2995 2996func (p *LogicalType) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 2997 if p.IsSetSTRING() { 2998 if err := oprot.WriteFieldBegin(ctx, "STRING", thrift.STRUCT, 1); err != nil { 2999 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:STRING: ", p), err) } 3000 if err := p.STRING.Write(ctx, oprot); err != nil { 3001 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.STRING), err) 3002 } 3003 if err := oprot.WriteFieldEnd(ctx); err != nil { 3004 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:STRING: ", p), err) } 3005 } 3006 return err 3007} 3008 3009func (p *LogicalType) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 3010 if p.IsSetMAP() { 3011 if err := oprot.WriteFieldBegin(ctx, "MAP", thrift.STRUCT, 2); err != nil { 3012 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:MAP: ", p), err) } 3013 if err := p.MAP.Write(ctx, oprot); err != nil { 3014 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.MAP), err) 3015 } 3016 if err := oprot.WriteFieldEnd(ctx); err != nil { 3017 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:MAP: ", p), err) } 3018 } 3019 return err 3020} 3021 3022func (p *LogicalType) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 3023 if p.IsSetLIST() { 3024 if err := oprot.WriteFieldBegin(ctx, "LIST", thrift.STRUCT, 3); err != nil { 3025 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:LIST: ", p), err) } 3026 if err := p.LIST.Write(ctx, oprot); err != nil { 3027 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.LIST), err) 3028 } 3029 if err := oprot.WriteFieldEnd(ctx); err != nil { 3030 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:LIST: ", p), err) } 3031 } 3032 return err 3033} 3034 3035func (p *LogicalType) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 3036 if p.IsSetENUM() { 3037 if err := oprot.WriteFieldBegin(ctx, "ENUM", thrift.STRUCT, 4); err != nil { 3038 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:ENUM: ", p), err) } 3039 if err := p.ENUM.Write(ctx, oprot); err != nil { 3040 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ENUM), err) 3041 } 3042 if err := oprot.WriteFieldEnd(ctx); err != nil { 3043 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:ENUM: ", p), err) } 3044 } 3045 return err 3046} 3047 3048func (p *LogicalType) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 3049 if p.IsSetDECIMAL() { 3050 if err := oprot.WriteFieldBegin(ctx, "DECIMAL", thrift.STRUCT, 5); err != nil { 3051 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:DECIMAL: ", p), err) } 3052 if err := p.DECIMAL.Write(ctx, oprot); err != nil { 3053 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DECIMAL), err) 3054 } 3055 if err := oprot.WriteFieldEnd(ctx); err != nil { 3056 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:DECIMAL: ", p), err) } 3057 } 3058 return err 3059} 3060 3061func (p *LogicalType) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 3062 if p.IsSetDATE() { 3063 if err := oprot.WriteFieldBegin(ctx, "DATE", thrift.STRUCT, 6); err != nil { 3064 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:DATE: ", p), err) } 3065 if err := p.DATE.Write(ctx, oprot); err != nil { 3066 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DATE), err) 3067 } 3068 if err := oprot.WriteFieldEnd(ctx); err != nil { 3069 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:DATE: ", p), err) } 3070 } 3071 return err 3072} 3073 3074func (p *LogicalType) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 3075 if p.IsSetTIME() { 3076 if err := oprot.WriteFieldBegin(ctx, "TIME", thrift.STRUCT, 7); err != nil { 3077 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:TIME: ", p), err) } 3078 if err := p.TIME.Write(ctx, oprot); err != nil { 3079 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TIME), err) 3080 } 3081 if err := oprot.WriteFieldEnd(ctx); err != nil { 3082 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:TIME: ", p), err) } 3083 } 3084 return err 3085} 3086 3087func (p *LogicalType) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 3088 if p.IsSetTIMESTAMP() { 3089 if err := oprot.WriteFieldBegin(ctx, "TIMESTAMP", thrift.STRUCT, 8); err != nil { 3090 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:TIMESTAMP: ", p), err) } 3091 if err := p.TIMESTAMP.Write(ctx, oprot); err != nil { 3092 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TIMESTAMP), err) 3093 } 3094 if err := oprot.WriteFieldEnd(ctx); err != nil { 3095 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:TIMESTAMP: ", p), err) } 3096 } 3097 return err 3098} 3099 3100func (p *LogicalType) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { 3101 if p.IsSetINTEGER() { 3102 if err := oprot.WriteFieldBegin(ctx, "INTEGER", thrift.STRUCT, 10); err != nil { 3103 return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:INTEGER: ", p), err) } 3104 if err := p.INTEGER.Write(ctx, oprot); err != nil { 3105 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.INTEGER), err) 3106 } 3107 if err := oprot.WriteFieldEnd(ctx); err != nil { 3108 return thrift.PrependError(fmt.Sprintf("%T write field end error 10:INTEGER: ", p), err) } 3109 } 3110 return err 3111} 3112 3113func (p *LogicalType) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { 3114 if p.IsSetUNKNOWN() { 3115 if err := oprot.WriteFieldBegin(ctx, "UNKNOWN", thrift.STRUCT, 11); err != nil { 3116 return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:UNKNOWN: ", p), err) } 3117 if err := p.UNKNOWN.Write(ctx, oprot); err != nil { 3118 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.UNKNOWN), err) 3119 } 3120 if err := oprot.WriteFieldEnd(ctx); err != nil { 3121 return thrift.PrependError(fmt.Sprintf("%T write field end error 11:UNKNOWN: ", p), err) } 3122 } 3123 return err 3124} 3125 3126func (p *LogicalType) writeField12(ctx context.Context, oprot thrift.TProtocol) (err error) { 3127 if p.IsSetJSON() { 3128 if err := oprot.WriteFieldBegin(ctx, "JSON", thrift.STRUCT, 12); err != nil { 3129 return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:JSON: ", p), err) } 3130 if err := p.JSON.Write(ctx, oprot); err != nil { 3131 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JSON), err) 3132 } 3133 if err := oprot.WriteFieldEnd(ctx); err != nil { 3134 return thrift.PrependError(fmt.Sprintf("%T write field end error 12:JSON: ", p), err) } 3135 } 3136 return err 3137} 3138 3139func (p *LogicalType) writeField13(ctx context.Context, oprot thrift.TProtocol) (err error) { 3140 if p.IsSetBSON() { 3141 if err := oprot.WriteFieldBegin(ctx, "BSON", thrift.STRUCT, 13); err != nil { 3142 return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:BSON: ", p), err) } 3143 if err := p.BSON.Write(ctx, oprot); err != nil { 3144 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.BSON), err) 3145 } 3146 if err := oprot.WriteFieldEnd(ctx); err != nil { 3147 return thrift.PrependError(fmt.Sprintf("%T write field end error 13:BSON: ", p), err) } 3148 } 3149 return err 3150} 3151 3152func (p *LogicalType) writeField14(ctx context.Context, oprot thrift.TProtocol) (err error) { 3153 if p.IsSetUUID() { 3154 if err := oprot.WriteFieldBegin(ctx, "UUID", thrift.STRUCT, 14); err != nil { 3155 return thrift.PrependError(fmt.Sprintf("%T write field begin error 14:UUID: ", p), err) } 3156 if err := p.UUID.Write(ctx, oprot); err != nil { 3157 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.UUID), err) 3158 } 3159 if err := oprot.WriteFieldEnd(ctx); err != nil { 3160 return thrift.PrependError(fmt.Sprintf("%T write field end error 14:UUID: ", p), err) } 3161 } 3162 return err 3163} 3164 3165func (p *LogicalType) Equals(other *LogicalType) bool { 3166 if p == other { 3167 return true 3168 } else if p == nil || other == nil { 3169 return false 3170 } 3171 if !p.STRING.Equals(other.STRING) { return false } 3172 if !p.MAP.Equals(other.MAP) { return false } 3173 if !p.LIST.Equals(other.LIST) { return false } 3174 if !p.ENUM.Equals(other.ENUM) { return false } 3175 if !p.DECIMAL.Equals(other.DECIMAL) { return false } 3176 if !p.DATE.Equals(other.DATE) { return false } 3177 if !p.TIME.Equals(other.TIME) { return false } 3178 if !p.TIMESTAMP.Equals(other.TIMESTAMP) { return false } 3179 if !p.INTEGER.Equals(other.INTEGER) { return false } 3180 if !p.UNKNOWN.Equals(other.UNKNOWN) { return false } 3181 if !p.JSON.Equals(other.JSON) { return false } 3182 if !p.BSON.Equals(other.BSON) { return false } 3183 if !p.UUID.Equals(other.UUID) { return false } 3184 return true 3185} 3186 3187func (p *LogicalType) String() string { 3188 if p == nil { 3189 return "<nil>" 3190 } 3191 return fmt.Sprintf("LogicalType(%+v)", *p) 3192} 3193 3194// Represents a element inside a schema definition. 3195// - if it is a group (inner node) then type is undefined and num_children is defined 3196// - if it is a primitive type (leaf) then type is defined and num_children is undefined 3197// the nodes are listed in depth first traversal order. 3198// 3199// Attributes: 3200// - Type: Data type for this field. Not set if the current element is a non-leaf node 3201// - TypeLength: If type is FIXED_LEN_BYTE_ARRAY, this is the byte length of the vales. 3202// Otherwise, if specified, this is the maximum bit length to store any of the values. 3203// (e.g. a low cardinality INT col could have this set to 3). Note that this is 3204// in the schema, and therefore fixed for the entire file. 3205// - RepetitionType: repetition of the field. The root of the schema does not have a repetition_type. 3206// All other nodes must have one 3207// - Name: Name of the field in the schema 3208// - NumChildren: Nested fields. Since thrift does not support nested fields, 3209// the nesting is flattened to a single list by a depth-first traversal. 3210// The children count is used to construct the nested relationship. 3211// This field is not set when the element is a primitive type 3212// - ConvertedType: When the schema is the result of a conversion from another model 3213// Used to record the original type to help with cross conversion. 3214// - Scale: Used when this column contains decimal data. 3215// See the DECIMAL converted type for more details. 3216// - Precision 3217// - FieldID: When the original schema supports field ids, this will save the 3218// original field id in the parquet schema 3219// - LogicalType: The logical type of this SchemaElement 3220// 3221// LogicalType replaces ConvertedType, but ConvertedType is still required 3222// for some logical types to ensure forward-compatibility in format v1. 3223type SchemaElement struct { 3224 Type *Type `thrift:"type,1" db:"type" json:"type,omitempty"` 3225 TypeLength *int32 `thrift:"type_length,2" db:"type_length" json:"type_length,omitempty"` 3226 RepetitionType *FieldRepetitionType `thrift:"repetition_type,3" db:"repetition_type" json:"repetition_type,omitempty"` 3227 Name string `thrift:"name,4,required" db:"name" json:"name"` 3228 NumChildren *int32 `thrift:"num_children,5" db:"num_children" json:"num_children,omitempty"` 3229 ConvertedType *ConvertedType `thrift:"converted_type,6" db:"converted_type" json:"converted_type,omitempty"` 3230 Scale *int32 `thrift:"scale,7" db:"scale" json:"scale,omitempty"` 3231 Precision *int32 `thrift:"precision,8" db:"precision" json:"precision,omitempty"` 3232 FieldID *int32 `thrift:"field_id,9" db:"field_id" json:"field_id,omitempty"` 3233 LogicalType *LogicalType `thrift:"logicalType,10" db:"logicalType" json:"logicalType,omitempty"` 3234} 3235 3236func NewSchemaElement() *SchemaElement { 3237 return &SchemaElement{} 3238} 3239 3240var SchemaElement_Type_DEFAULT Type 3241func (p *SchemaElement) GetType() Type { 3242 if !p.IsSetType() { 3243 return SchemaElement_Type_DEFAULT 3244 } 3245return *p.Type 3246} 3247var SchemaElement_TypeLength_DEFAULT int32 3248func (p *SchemaElement) GetTypeLength() int32 { 3249 if !p.IsSetTypeLength() { 3250 return SchemaElement_TypeLength_DEFAULT 3251 } 3252return *p.TypeLength 3253} 3254var SchemaElement_RepetitionType_DEFAULT FieldRepetitionType 3255func (p *SchemaElement) GetRepetitionType() FieldRepetitionType { 3256 if !p.IsSetRepetitionType() { 3257 return SchemaElement_RepetitionType_DEFAULT 3258 } 3259return *p.RepetitionType 3260} 3261 3262func (p *SchemaElement) GetName() string { 3263 return p.Name 3264} 3265var SchemaElement_NumChildren_DEFAULT int32 3266func (p *SchemaElement) GetNumChildren() int32 { 3267 if !p.IsSetNumChildren() { 3268 return SchemaElement_NumChildren_DEFAULT 3269 } 3270return *p.NumChildren 3271} 3272var SchemaElement_ConvertedType_DEFAULT ConvertedType 3273func (p *SchemaElement) GetConvertedType() ConvertedType { 3274 if !p.IsSetConvertedType() { 3275 return SchemaElement_ConvertedType_DEFAULT 3276 } 3277return *p.ConvertedType 3278} 3279var SchemaElement_Scale_DEFAULT int32 3280func (p *SchemaElement) GetScale() int32 { 3281 if !p.IsSetScale() { 3282 return SchemaElement_Scale_DEFAULT 3283 } 3284return *p.Scale 3285} 3286var SchemaElement_Precision_DEFAULT int32 3287func (p *SchemaElement) GetPrecision() int32 { 3288 if !p.IsSetPrecision() { 3289 return SchemaElement_Precision_DEFAULT 3290 } 3291return *p.Precision 3292} 3293var SchemaElement_FieldID_DEFAULT int32 3294func (p *SchemaElement) GetFieldID() int32 { 3295 if !p.IsSetFieldID() { 3296 return SchemaElement_FieldID_DEFAULT 3297 } 3298return *p.FieldID 3299} 3300var SchemaElement_LogicalType_DEFAULT *LogicalType 3301func (p *SchemaElement) GetLogicalType() *LogicalType { 3302 if !p.IsSetLogicalType() { 3303 return SchemaElement_LogicalType_DEFAULT 3304 } 3305return p.LogicalType 3306} 3307func (p *SchemaElement) IsSetType() bool { 3308 return p.Type != nil 3309} 3310 3311func (p *SchemaElement) IsSetTypeLength() bool { 3312 return p.TypeLength != nil 3313} 3314 3315func (p *SchemaElement) IsSetRepetitionType() bool { 3316 return p.RepetitionType != nil 3317} 3318 3319func (p *SchemaElement) IsSetNumChildren() bool { 3320 return p.NumChildren != nil 3321} 3322 3323func (p *SchemaElement) IsSetConvertedType() bool { 3324 return p.ConvertedType != nil 3325} 3326 3327func (p *SchemaElement) IsSetScale() bool { 3328 return p.Scale != nil 3329} 3330 3331func (p *SchemaElement) IsSetPrecision() bool { 3332 return p.Precision != nil 3333} 3334 3335func (p *SchemaElement) IsSetFieldID() bool { 3336 return p.FieldID != nil 3337} 3338 3339func (p *SchemaElement) IsSetLogicalType() bool { 3340 return p.LogicalType != nil 3341} 3342 3343func (p *SchemaElement) Read(ctx context.Context, iprot thrift.TProtocol) error { 3344 if _, err := iprot.ReadStructBegin(ctx); err != nil { 3345 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 3346 } 3347 3348 var issetName bool = false; 3349 3350 for { 3351 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 3352 if err != nil { 3353 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 3354 } 3355 if fieldTypeId == thrift.STOP { break; } 3356 switch fieldId { 3357 case 1: 3358 if fieldTypeId == thrift.I32 { 3359 if err := p.ReadField1(ctx, iprot); err != nil { 3360 return err 3361 } 3362 } else { 3363 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3364 return err 3365 } 3366 } 3367 case 2: 3368 if fieldTypeId == thrift.I32 { 3369 if err := p.ReadField2(ctx, iprot); err != nil { 3370 return err 3371 } 3372 } else { 3373 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3374 return err 3375 } 3376 } 3377 case 3: 3378 if fieldTypeId == thrift.I32 { 3379 if err := p.ReadField3(ctx, iprot); err != nil { 3380 return err 3381 } 3382 } else { 3383 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3384 return err 3385 } 3386 } 3387 case 4: 3388 if fieldTypeId == thrift.STRING { 3389 if err := p.ReadField4(ctx, iprot); err != nil { 3390 return err 3391 } 3392 issetName = true 3393 } else { 3394 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3395 return err 3396 } 3397 } 3398 case 5: 3399 if fieldTypeId == thrift.I32 { 3400 if err := p.ReadField5(ctx, iprot); err != nil { 3401 return err 3402 } 3403 } else { 3404 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3405 return err 3406 } 3407 } 3408 case 6: 3409 if fieldTypeId == thrift.I32 { 3410 if err := p.ReadField6(ctx, iprot); err != nil { 3411 return err 3412 } 3413 } else { 3414 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3415 return err 3416 } 3417 } 3418 case 7: 3419 if fieldTypeId == thrift.I32 { 3420 if err := p.ReadField7(ctx, iprot); err != nil { 3421 return err 3422 } 3423 } else { 3424 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3425 return err 3426 } 3427 } 3428 case 8: 3429 if fieldTypeId == thrift.I32 { 3430 if err := p.ReadField8(ctx, iprot); err != nil { 3431 return err 3432 } 3433 } else { 3434 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3435 return err 3436 } 3437 } 3438 case 9: 3439 if fieldTypeId == thrift.I32 { 3440 if err := p.ReadField9(ctx, iprot); err != nil { 3441 return err 3442 } 3443 } else { 3444 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3445 return err 3446 } 3447 } 3448 case 10: 3449 if fieldTypeId == thrift.STRUCT { 3450 if err := p.ReadField10(ctx, iprot); err != nil { 3451 return err 3452 } 3453 } else { 3454 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3455 return err 3456 } 3457 } 3458 default: 3459 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3460 return err 3461 } 3462 } 3463 if err := iprot.ReadFieldEnd(ctx); err != nil { 3464 return err 3465 } 3466 } 3467 if err := iprot.ReadStructEnd(ctx); err != nil { 3468 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3469 } 3470 if !issetName{ 3471 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Name is not set")); 3472 } 3473 return nil 3474} 3475 3476func (p *SchemaElement) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 3477 if v, err := iprot.ReadI32(ctx); err != nil { 3478 return thrift.PrependError("error reading field 1: ", err) 3479} else { 3480 temp := Type(v) 3481 p.Type = &temp 3482} 3483 return nil 3484} 3485 3486func (p *SchemaElement) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 3487 if v, err := iprot.ReadI32(ctx); err != nil { 3488 return thrift.PrependError("error reading field 2: ", err) 3489} else { 3490 p.TypeLength = &v 3491} 3492 return nil 3493} 3494 3495func (p *SchemaElement) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 3496 if v, err := iprot.ReadI32(ctx); err != nil { 3497 return thrift.PrependError("error reading field 3: ", err) 3498} else { 3499 temp := FieldRepetitionType(v) 3500 p.RepetitionType = &temp 3501} 3502 return nil 3503} 3504 3505func (p *SchemaElement) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 3506 if v, err := iprot.ReadString(ctx); err != nil { 3507 return thrift.PrependError("error reading field 4: ", err) 3508} else { 3509 p.Name = v 3510} 3511 return nil 3512} 3513 3514func (p *SchemaElement) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 3515 if v, err := iprot.ReadI32(ctx); err != nil { 3516 return thrift.PrependError("error reading field 5: ", err) 3517} else { 3518 p.NumChildren = &v 3519} 3520 return nil 3521} 3522 3523func (p *SchemaElement) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 3524 if v, err := iprot.ReadI32(ctx); err != nil { 3525 return thrift.PrependError("error reading field 6: ", err) 3526} else { 3527 temp := ConvertedType(v) 3528 p.ConvertedType = &temp 3529} 3530 return nil 3531} 3532 3533func (p *SchemaElement) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 3534 if v, err := iprot.ReadI32(ctx); err != nil { 3535 return thrift.PrependError("error reading field 7: ", err) 3536} else { 3537 p.Scale = &v 3538} 3539 return nil 3540} 3541 3542func (p *SchemaElement) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 3543 if v, err := iprot.ReadI32(ctx); err != nil { 3544 return thrift.PrependError("error reading field 8: ", err) 3545} else { 3546 p.Precision = &v 3547} 3548 return nil 3549} 3550 3551func (p *SchemaElement) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { 3552 if v, err := iprot.ReadI32(ctx); err != nil { 3553 return thrift.PrependError("error reading field 9: ", err) 3554} else { 3555 p.FieldID = &v 3556} 3557 return nil 3558} 3559 3560func (p *SchemaElement) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { 3561 p.LogicalType = &LogicalType{} 3562 if err := p.LogicalType.Read(ctx, iprot); err != nil { 3563 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.LogicalType), err) 3564 } 3565 return nil 3566} 3567 3568func (p *SchemaElement) Write(ctx context.Context, oprot thrift.TProtocol) error { 3569 if err := oprot.WriteStructBegin(ctx, "SchemaElement"); err != nil { 3570 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 3571 if p != nil { 3572 if err := p.writeField1(ctx, oprot); err != nil { return err } 3573 if err := p.writeField2(ctx, oprot); err != nil { return err } 3574 if err := p.writeField3(ctx, oprot); err != nil { return err } 3575 if err := p.writeField4(ctx, oprot); err != nil { return err } 3576 if err := p.writeField5(ctx, oprot); err != nil { return err } 3577 if err := p.writeField6(ctx, oprot); err != nil { return err } 3578 if err := p.writeField7(ctx, oprot); err != nil { return err } 3579 if err := p.writeField8(ctx, oprot); err != nil { return err } 3580 if err := p.writeField9(ctx, oprot); err != nil { return err } 3581 if err := p.writeField10(ctx, oprot); err != nil { return err } 3582 } 3583 if err := oprot.WriteFieldStop(ctx); err != nil { 3584 return thrift.PrependError("write field stop error: ", err) } 3585 if err := oprot.WriteStructEnd(ctx); err != nil { 3586 return thrift.PrependError("write struct stop error: ", err) } 3587 return nil 3588} 3589 3590func (p *SchemaElement) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 3591 if p.IsSetType() { 3592 if err := oprot.WriteFieldBegin(ctx, "type", thrift.I32, 1); err != nil { 3593 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:type: ", p), err) } 3594 if err := oprot.WriteI32(ctx, int32(*p.Type)); err != nil { 3595 return thrift.PrependError(fmt.Sprintf("%T.type (1) field write error: ", p), err) } 3596 if err := oprot.WriteFieldEnd(ctx); err != nil { 3597 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:type: ", p), err) } 3598 } 3599 return err 3600} 3601 3602func (p *SchemaElement) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 3603 if p.IsSetTypeLength() { 3604 if err := oprot.WriteFieldBegin(ctx, "type_length", thrift.I32, 2); err != nil { 3605 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:type_length: ", p), err) } 3606 if err := oprot.WriteI32(ctx, int32(*p.TypeLength)); err != nil { 3607 return thrift.PrependError(fmt.Sprintf("%T.type_length (2) field write error: ", p), err) } 3608 if err := oprot.WriteFieldEnd(ctx); err != nil { 3609 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:type_length: ", p), err) } 3610 } 3611 return err 3612} 3613 3614func (p *SchemaElement) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 3615 if p.IsSetRepetitionType() { 3616 if err := oprot.WriteFieldBegin(ctx, "repetition_type", thrift.I32, 3); err != nil { 3617 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:repetition_type: ", p), err) } 3618 if err := oprot.WriteI32(ctx, int32(*p.RepetitionType)); err != nil { 3619 return thrift.PrependError(fmt.Sprintf("%T.repetition_type (3) field write error: ", p), err) } 3620 if err := oprot.WriteFieldEnd(ctx); err != nil { 3621 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:repetition_type: ", p), err) } 3622 } 3623 return err 3624} 3625 3626func (p *SchemaElement) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 3627 if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 4); err != nil { 3628 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:name: ", p), err) } 3629 if err := oprot.WriteString(ctx, string(p.Name)); err != nil { 3630 return thrift.PrependError(fmt.Sprintf("%T.name (4) field write error: ", p), err) } 3631 if err := oprot.WriteFieldEnd(ctx); err != nil { 3632 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:name: ", p), err) } 3633 return err 3634} 3635 3636func (p *SchemaElement) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 3637 if p.IsSetNumChildren() { 3638 if err := oprot.WriteFieldBegin(ctx, "num_children", thrift.I32, 5); err != nil { 3639 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:num_children: ", p), err) } 3640 if err := oprot.WriteI32(ctx, int32(*p.NumChildren)); err != nil { 3641 return thrift.PrependError(fmt.Sprintf("%T.num_children (5) field write error: ", p), err) } 3642 if err := oprot.WriteFieldEnd(ctx); err != nil { 3643 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:num_children: ", p), err) } 3644 } 3645 return err 3646} 3647 3648func (p *SchemaElement) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 3649 if p.IsSetConvertedType() { 3650 if err := oprot.WriteFieldBegin(ctx, "converted_type", thrift.I32, 6); err != nil { 3651 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:converted_type: ", p), err) } 3652 if err := oprot.WriteI32(ctx, int32(*p.ConvertedType)); err != nil { 3653 return thrift.PrependError(fmt.Sprintf("%T.converted_type (6) field write error: ", p), err) } 3654 if err := oprot.WriteFieldEnd(ctx); err != nil { 3655 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:converted_type: ", p), err) } 3656 } 3657 return err 3658} 3659 3660func (p *SchemaElement) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 3661 if p.IsSetScale() { 3662 if err := oprot.WriteFieldBegin(ctx, "scale", thrift.I32, 7); err != nil { 3663 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:scale: ", p), err) } 3664 if err := oprot.WriteI32(ctx, int32(*p.Scale)); err != nil { 3665 return thrift.PrependError(fmt.Sprintf("%T.scale (7) field write error: ", p), err) } 3666 if err := oprot.WriteFieldEnd(ctx); err != nil { 3667 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:scale: ", p), err) } 3668 } 3669 return err 3670} 3671 3672func (p *SchemaElement) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 3673 if p.IsSetPrecision() { 3674 if err := oprot.WriteFieldBegin(ctx, "precision", thrift.I32, 8); err != nil { 3675 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:precision: ", p), err) } 3676 if err := oprot.WriteI32(ctx, int32(*p.Precision)); err != nil { 3677 return thrift.PrependError(fmt.Sprintf("%T.precision (8) field write error: ", p), err) } 3678 if err := oprot.WriteFieldEnd(ctx); err != nil { 3679 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:precision: ", p), err) } 3680 } 3681 return err 3682} 3683 3684func (p *SchemaElement) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { 3685 if p.IsSetFieldID() { 3686 if err := oprot.WriteFieldBegin(ctx, "field_id", thrift.I32, 9); err != nil { 3687 return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:field_id: ", p), err) } 3688 if err := oprot.WriteI32(ctx, int32(*p.FieldID)); err != nil { 3689 return thrift.PrependError(fmt.Sprintf("%T.field_id (9) field write error: ", p), err) } 3690 if err := oprot.WriteFieldEnd(ctx); err != nil { 3691 return thrift.PrependError(fmt.Sprintf("%T write field end error 9:field_id: ", p), err) } 3692 } 3693 return err 3694} 3695 3696func (p *SchemaElement) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { 3697 if p.IsSetLogicalType() { 3698 if err := oprot.WriteFieldBegin(ctx, "logicalType", thrift.STRUCT, 10); err != nil { 3699 return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:logicalType: ", p), err) } 3700 if err := p.LogicalType.Write(ctx, oprot); err != nil { 3701 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.LogicalType), err) 3702 } 3703 if err := oprot.WriteFieldEnd(ctx); err != nil { 3704 return thrift.PrependError(fmt.Sprintf("%T write field end error 10:logicalType: ", p), err) } 3705 } 3706 return err 3707} 3708 3709func (p *SchemaElement) Equals(other *SchemaElement) bool { 3710 if p == other { 3711 return true 3712 } else if p == nil || other == nil { 3713 return false 3714 } 3715 if p.Type != other.Type { 3716 if p.Type == nil || other.Type == nil { 3717 return false 3718 } 3719 if (*p.Type) != (*other.Type) { return false } 3720 } 3721 if p.TypeLength != other.TypeLength { 3722 if p.TypeLength == nil || other.TypeLength == nil { 3723 return false 3724 } 3725 if (*p.TypeLength) != (*other.TypeLength) { return false } 3726 } 3727 if p.RepetitionType != other.RepetitionType { 3728 if p.RepetitionType == nil || other.RepetitionType == nil { 3729 return false 3730 } 3731 if (*p.RepetitionType) != (*other.RepetitionType) { return false } 3732 } 3733 if p.Name != other.Name { return false } 3734 if p.NumChildren != other.NumChildren { 3735 if p.NumChildren == nil || other.NumChildren == nil { 3736 return false 3737 } 3738 if (*p.NumChildren) != (*other.NumChildren) { return false } 3739 } 3740 if p.ConvertedType != other.ConvertedType { 3741 if p.ConvertedType == nil || other.ConvertedType == nil { 3742 return false 3743 } 3744 if (*p.ConvertedType) != (*other.ConvertedType) { return false } 3745 } 3746 if p.Scale != other.Scale { 3747 if p.Scale == nil || other.Scale == nil { 3748 return false 3749 } 3750 if (*p.Scale) != (*other.Scale) { return false } 3751 } 3752 if p.Precision != other.Precision { 3753 if p.Precision == nil || other.Precision == nil { 3754 return false 3755 } 3756 if (*p.Precision) != (*other.Precision) { return false } 3757 } 3758 if p.FieldID != other.FieldID { 3759 if p.FieldID == nil || other.FieldID == nil { 3760 return false 3761 } 3762 if (*p.FieldID) != (*other.FieldID) { return false } 3763 } 3764 if !p.LogicalType.Equals(other.LogicalType) { return false } 3765 return true 3766} 3767 3768func (p *SchemaElement) String() string { 3769 if p == nil { 3770 return "<nil>" 3771 } 3772 return fmt.Sprintf("SchemaElement(%+v)", *p) 3773} 3774 3775// Data page header 3776// 3777// Attributes: 3778// - NumValues: Number of values, including NULLs, in this data page. * 3779// - Encoding: Encoding used for this data page * 3780// - DefinitionLevelEncoding: Encoding used for definition levels * 3781// - RepetitionLevelEncoding: Encoding used for repetition levels * 3782// - Statistics: Optional statistics for the data in this page* 3783type DataPageHeader struct { 3784 NumValues int32 `thrift:"num_values,1,required" db:"num_values" json:"num_values"` 3785 Encoding Encoding `thrift:"encoding,2,required" db:"encoding" json:"encoding"` 3786 DefinitionLevelEncoding Encoding `thrift:"definition_level_encoding,3,required" db:"definition_level_encoding" json:"definition_level_encoding"` 3787 RepetitionLevelEncoding Encoding `thrift:"repetition_level_encoding,4,required" db:"repetition_level_encoding" json:"repetition_level_encoding"` 3788 Statistics *Statistics `thrift:"statistics,5" db:"statistics" json:"statistics,omitempty"` 3789} 3790 3791func NewDataPageHeader() *DataPageHeader { 3792 return &DataPageHeader{} 3793} 3794 3795 3796func (p *DataPageHeader) GetNumValues() int32 { 3797 return p.NumValues 3798} 3799 3800func (p *DataPageHeader) GetEncoding() Encoding { 3801 return p.Encoding 3802} 3803 3804func (p *DataPageHeader) GetDefinitionLevelEncoding() Encoding { 3805 return p.DefinitionLevelEncoding 3806} 3807 3808func (p *DataPageHeader) GetRepetitionLevelEncoding() Encoding { 3809 return p.RepetitionLevelEncoding 3810} 3811var DataPageHeader_Statistics_DEFAULT *Statistics 3812func (p *DataPageHeader) GetStatistics() *Statistics { 3813 if !p.IsSetStatistics() { 3814 return DataPageHeader_Statistics_DEFAULT 3815 } 3816return p.Statistics 3817} 3818func (p *DataPageHeader) IsSetStatistics() bool { 3819 return p.Statistics != nil 3820} 3821 3822func (p *DataPageHeader) Read(ctx context.Context, iprot thrift.TProtocol) error { 3823 if _, err := iprot.ReadStructBegin(ctx); err != nil { 3824 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 3825 } 3826 3827 var issetNumValues bool = false; 3828 var issetEncoding bool = false; 3829 var issetDefinitionLevelEncoding bool = false; 3830 var issetRepetitionLevelEncoding bool = false; 3831 3832 for { 3833 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 3834 if err != nil { 3835 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 3836 } 3837 if fieldTypeId == thrift.STOP { break; } 3838 switch fieldId { 3839 case 1: 3840 if fieldTypeId == thrift.I32 { 3841 if err := p.ReadField1(ctx, iprot); err != nil { 3842 return err 3843 } 3844 issetNumValues = true 3845 } else { 3846 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3847 return err 3848 } 3849 } 3850 case 2: 3851 if fieldTypeId == thrift.I32 { 3852 if err := p.ReadField2(ctx, iprot); err != nil { 3853 return err 3854 } 3855 issetEncoding = true 3856 } else { 3857 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3858 return err 3859 } 3860 } 3861 case 3: 3862 if fieldTypeId == thrift.I32 { 3863 if err := p.ReadField3(ctx, iprot); err != nil { 3864 return err 3865 } 3866 issetDefinitionLevelEncoding = true 3867 } else { 3868 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3869 return err 3870 } 3871 } 3872 case 4: 3873 if fieldTypeId == thrift.I32 { 3874 if err := p.ReadField4(ctx, iprot); err != nil { 3875 return err 3876 } 3877 issetRepetitionLevelEncoding = true 3878 } else { 3879 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3880 return err 3881 } 3882 } 3883 case 5: 3884 if fieldTypeId == thrift.STRUCT { 3885 if err := p.ReadField5(ctx, iprot); err != nil { 3886 return err 3887 } 3888 } else { 3889 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3890 return err 3891 } 3892 } 3893 default: 3894 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3895 return err 3896 } 3897 } 3898 if err := iprot.ReadFieldEnd(ctx); err != nil { 3899 return err 3900 } 3901 } 3902 if err := iprot.ReadStructEnd(ctx); err != nil { 3903 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3904 } 3905 if !issetNumValues{ 3906 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumValues is not set")); 3907 } 3908 if !issetEncoding{ 3909 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encoding is not set")); 3910 } 3911 if !issetDefinitionLevelEncoding{ 3912 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DefinitionLevelEncoding is not set")); 3913 } 3914 if !issetRepetitionLevelEncoding{ 3915 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RepetitionLevelEncoding is not set")); 3916 } 3917 return nil 3918} 3919 3920func (p *DataPageHeader) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 3921 if v, err := iprot.ReadI32(ctx); err != nil { 3922 return thrift.PrependError("error reading field 1: ", err) 3923} else { 3924 p.NumValues = v 3925} 3926 return nil 3927} 3928 3929func (p *DataPageHeader) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 3930 if v, err := iprot.ReadI32(ctx); err != nil { 3931 return thrift.PrependError("error reading field 2: ", err) 3932} else { 3933 temp := Encoding(v) 3934 p.Encoding = temp 3935} 3936 return nil 3937} 3938 3939func (p *DataPageHeader) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 3940 if v, err := iprot.ReadI32(ctx); err != nil { 3941 return thrift.PrependError("error reading field 3: ", err) 3942} else { 3943 temp := Encoding(v) 3944 p.DefinitionLevelEncoding = temp 3945} 3946 return nil 3947} 3948 3949func (p *DataPageHeader) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 3950 if v, err := iprot.ReadI32(ctx); err != nil { 3951 return thrift.PrependError("error reading field 4: ", err) 3952} else { 3953 temp := Encoding(v) 3954 p.RepetitionLevelEncoding = temp 3955} 3956 return nil 3957} 3958 3959func (p *DataPageHeader) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 3960 p.Statistics = &Statistics{} 3961 if err := p.Statistics.Read(ctx, iprot); err != nil { 3962 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Statistics), err) 3963 } 3964 return nil 3965} 3966 3967func (p *DataPageHeader) Write(ctx context.Context, oprot thrift.TProtocol) error { 3968 if err := oprot.WriteStructBegin(ctx, "DataPageHeader"); err != nil { 3969 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 3970 if p != nil { 3971 if err := p.writeField1(ctx, oprot); err != nil { return err } 3972 if err := p.writeField2(ctx, oprot); err != nil { return err } 3973 if err := p.writeField3(ctx, oprot); err != nil { return err } 3974 if err := p.writeField4(ctx, oprot); err != nil { return err } 3975 if err := p.writeField5(ctx, oprot); err != nil { return err } 3976 } 3977 if err := oprot.WriteFieldStop(ctx); err != nil { 3978 return thrift.PrependError("write field stop error: ", err) } 3979 if err := oprot.WriteStructEnd(ctx); err != nil { 3980 return thrift.PrependError("write struct stop error: ", err) } 3981 return nil 3982} 3983 3984func (p *DataPageHeader) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 3985 if err := oprot.WriteFieldBegin(ctx, "num_values", thrift.I32, 1); err != nil { 3986 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:num_values: ", p), err) } 3987 if err := oprot.WriteI32(ctx, int32(p.NumValues)); err != nil { 3988 return thrift.PrependError(fmt.Sprintf("%T.num_values (1) field write error: ", p), err) } 3989 if err := oprot.WriteFieldEnd(ctx); err != nil { 3990 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:num_values: ", p), err) } 3991 return err 3992} 3993 3994func (p *DataPageHeader) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 3995 if err := oprot.WriteFieldBegin(ctx, "encoding", thrift.I32, 2); err != nil { 3996 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:encoding: ", p), err) } 3997 if err := oprot.WriteI32(ctx, int32(p.Encoding)); err != nil { 3998 return thrift.PrependError(fmt.Sprintf("%T.encoding (2) field write error: ", p), err) } 3999 if err := oprot.WriteFieldEnd(ctx); err != nil { 4000 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:encoding: ", p), err) } 4001 return err 4002} 4003 4004func (p *DataPageHeader) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 4005 if err := oprot.WriteFieldBegin(ctx, "definition_level_encoding", thrift.I32, 3); err != nil { 4006 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:definition_level_encoding: ", p), err) } 4007 if err := oprot.WriteI32(ctx, int32(p.DefinitionLevelEncoding)); err != nil { 4008 return thrift.PrependError(fmt.Sprintf("%T.definition_level_encoding (3) field write error: ", p), err) } 4009 if err := oprot.WriteFieldEnd(ctx); err != nil { 4010 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:definition_level_encoding: ", p), err) } 4011 return err 4012} 4013 4014func (p *DataPageHeader) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 4015 if err := oprot.WriteFieldBegin(ctx, "repetition_level_encoding", thrift.I32, 4); err != nil { 4016 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:repetition_level_encoding: ", p), err) } 4017 if err := oprot.WriteI32(ctx, int32(p.RepetitionLevelEncoding)); err != nil { 4018 return thrift.PrependError(fmt.Sprintf("%T.repetition_level_encoding (4) field write error: ", p), err) } 4019 if err := oprot.WriteFieldEnd(ctx); err != nil { 4020 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:repetition_level_encoding: ", p), err) } 4021 return err 4022} 4023 4024func (p *DataPageHeader) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 4025 if p.IsSetStatistics() { 4026 if err := oprot.WriteFieldBegin(ctx, "statistics", thrift.STRUCT, 5); err != nil { 4027 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:statistics: ", p), err) } 4028 if err := p.Statistics.Write(ctx, oprot); err != nil { 4029 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Statistics), err) 4030 } 4031 if err := oprot.WriteFieldEnd(ctx); err != nil { 4032 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:statistics: ", p), err) } 4033 } 4034 return err 4035} 4036 4037func (p *DataPageHeader) Equals(other *DataPageHeader) bool { 4038 if p == other { 4039 return true 4040 } else if p == nil || other == nil { 4041 return false 4042 } 4043 if p.NumValues != other.NumValues { return false } 4044 if p.Encoding != other.Encoding { return false } 4045 if p.DefinitionLevelEncoding != other.DefinitionLevelEncoding { return false } 4046 if p.RepetitionLevelEncoding != other.RepetitionLevelEncoding { return false } 4047 if !p.Statistics.Equals(other.Statistics) { return false } 4048 return true 4049} 4050 4051func (p *DataPageHeader) String() string { 4052 if p == nil { 4053 return "<nil>" 4054 } 4055 return fmt.Sprintf("DataPageHeader(%+v)", *p) 4056} 4057 4058type IndexPageHeader struct { 4059} 4060 4061func NewIndexPageHeader() *IndexPageHeader { 4062 return &IndexPageHeader{} 4063} 4064 4065func (p *IndexPageHeader) Read(ctx context.Context, iprot thrift.TProtocol) error { 4066 if _, err := iprot.ReadStructBegin(ctx); err != nil { 4067 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 4068 } 4069 4070 4071 for { 4072 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 4073 if err != nil { 4074 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 4075 } 4076 if fieldTypeId == thrift.STOP { break; } 4077 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4078 return err 4079 } 4080 if err := iprot.ReadFieldEnd(ctx); err != nil { 4081 return err 4082 } 4083 } 4084 if err := iprot.ReadStructEnd(ctx); err != nil { 4085 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4086 } 4087 return nil 4088} 4089 4090func (p *IndexPageHeader) Write(ctx context.Context, oprot thrift.TProtocol) error { 4091 if err := oprot.WriteStructBegin(ctx, "IndexPageHeader"); err != nil { 4092 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 4093 if p != nil { 4094 } 4095 if err := oprot.WriteFieldStop(ctx); err != nil { 4096 return thrift.PrependError("write field stop error: ", err) } 4097 if err := oprot.WriteStructEnd(ctx); err != nil { 4098 return thrift.PrependError("write struct stop error: ", err) } 4099 return nil 4100} 4101 4102func (p *IndexPageHeader) Equals(other *IndexPageHeader) bool { 4103 if p == other { 4104 return true 4105 } else if p == nil || other == nil { 4106 return false 4107 } 4108 return true 4109} 4110 4111func (p *IndexPageHeader) String() string { 4112 if p == nil { 4113 return "<nil>" 4114 } 4115 return fmt.Sprintf("IndexPageHeader(%+v)", *p) 4116} 4117 4118// Attributes: 4119// - NumValues: Number of values in the dictionary * 4120// - Encoding: Encoding using this dictionary page * 4121// - IsSorted: If true, the entries in the dictionary are sorted in ascending order * 4122type DictionaryPageHeader struct { 4123 NumValues int32 `thrift:"num_values,1,required" db:"num_values" json:"num_values"` 4124 Encoding Encoding `thrift:"encoding,2,required" db:"encoding" json:"encoding"` 4125 IsSorted *bool `thrift:"is_sorted,3" db:"is_sorted" json:"is_sorted,omitempty"` 4126} 4127 4128func NewDictionaryPageHeader() *DictionaryPageHeader { 4129 return &DictionaryPageHeader{} 4130} 4131 4132 4133func (p *DictionaryPageHeader) GetNumValues() int32 { 4134 return p.NumValues 4135} 4136 4137func (p *DictionaryPageHeader) GetEncoding() Encoding { 4138 return p.Encoding 4139} 4140var DictionaryPageHeader_IsSorted_DEFAULT bool 4141func (p *DictionaryPageHeader) GetIsSorted() bool { 4142 if !p.IsSetIsSorted() { 4143 return DictionaryPageHeader_IsSorted_DEFAULT 4144 } 4145return *p.IsSorted 4146} 4147func (p *DictionaryPageHeader) IsSetIsSorted() bool { 4148 return p.IsSorted != nil 4149} 4150 4151func (p *DictionaryPageHeader) Read(ctx context.Context, iprot thrift.TProtocol) error { 4152 if _, err := iprot.ReadStructBegin(ctx); err != nil { 4153 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 4154 } 4155 4156 var issetNumValues bool = false; 4157 var issetEncoding bool = false; 4158 4159 for { 4160 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 4161 if err != nil { 4162 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 4163 } 4164 if fieldTypeId == thrift.STOP { break; } 4165 switch fieldId { 4166 case 1: 4167 if fieldTypeId == thrift.I32 { 4168 if err := p.ReadField1(ctx, iprot); err != nil { 4169 return err 4170 } 4171 issetNumValues = true 4172 } else { 4173 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4174 return err 4175 } 4176 } 4177 case 2: 4178 if fieldTypeId == thrift.I32 { 4179 if err := p.ReadField2(ctx, iprot); err != nil { 4180 return err 4181 } 4182 issetEncoding = true 4183 } else { 4184 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4185 return err 4186 } 4187 } 4188 case 3: 4189 if fieldTypeId == thrift.BOOL { 4190 if err := p.ReadField3(ctx, iprot); err != nil { 4191 return err 4192 } 4193 } else { 4194 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4195 return err 4196 } 4197 } 4198 default: 4199 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4200 return err 4201 } 4202 } 4203 if err := iprot.ReadFieldEnd(ctx); err != nil { 4204 return err 4205 } 4206 } 4207 if err := iprot.ReadStructEnd(ctx); err != nil { 4208 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4209 } 4210 if !issetNumValues{ 4211 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumValues is not set")); 4212 } 4213 if !issetEncoding{ 4214 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encoding is not set")); 4215 } 4216 return nil 4217} 4218 4219func (p *DictionaryPageHeader) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 4220 if v, err := iprot.ReadI32(ctx); err != nil { 4221 return thrift.PrependError("error reading field 1: ", err) 4222} else { 4223 p.NumValues = v 4224} 4225 return nil 4226} 4227 4228func (p *DictionaryPageHeader) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 4229 if v, err := iprot.ReadI32(ctx); err != nil { 4230 return thrift.PrependError("error reading field 2: ", err) 4231} else { 4232 temp := Encoding(v) 4233 p.Encoding = temp 4234} 4235 return nil 4236} 4237 4238func (p *DictionaryPageHeader) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 4239 if v, err := iprot.ReadBool(ctx); err != nil { 4240 return thrift.PrependError("error reading field 3: ", err) 4241} else { 4242 p.IsSorted = &v 4243} 4244 return nil 4245} 4246 4247func (p *DictionaryPageHeader) Write(ctx context.Context, oprot thrift.TProtocol) error { 4248 if err := oprot.WriteStructBegin(ctx, "DictionaryPageHeader"); err != nil { 4249 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 4250 if p != nil { 4251 if err := p.writeField1(ctx, oprot); err != nil { return err } 4252 if err := p.writeField2(ctx, oprot); err != nil { return err } 4253 if err := p.writeField3(ctx, oprot); err != nil { return err } 4254 } 4255 if err := oprot.WriteFieldStop(ctx); err != nil { 4256 return thrift.PrependError("write field stop error: ", err) } 4257 if err := oprot.WriteStructEnd(ctx); err != nil { 4258 return thrift.PrependError("write struct stop error: ", err) } 4259 return nil 4260} 4261 4262func (p *DictionaryPageHeader) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 4263 if err := oprot.WriteFieldBegin(ctx, "num_values", thrift.I32, 1); err != nil { 4264 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:num_values: ", p), err) } 4265 if err := oprot.WriteI32(ctx, int32(p.NumValues)); err != nil { 4266 return thrift.PrependError(fmt.Sprintf("%T.num_values (1) field write error: ", p), err) } 4267 if err := oprot.WriteFieldEnd(ctx); err != nil { 4268 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:num_values: ", p), err) } 4269 return err 4270} 4271 4272func (p *DictionaryPageHeader) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 4273 if err := oprot.WriteFieldBegin(ctx, "encoding", thrift.I32, 2); err != nil { 4274 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:encoding: ", p), err) } 4275 if err := oprot.WriteI32(ctx, int32(p.Encoding)); err != nil { 4276 return thrift.PrependError(fmt.Sprintf("%T.encoding (2) field write error: ", p), err) } 4277 if err := oprot.WriteFieldEnd(ctx); err != nil { 4278 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:encoding: ", p), err) } 4279 return err 4280} 4281 4282func (p *DictionaryPageHeader) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 4283 if p.IsSetIsSorted() { 4284 if err := oprot.WriteFieldBegin(ctx, "is_sorted", thrift.BOOL, 3); err != nil { 4285 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:is_sorted: ", p), err) } 4286 if err := oprot.WriteBool(ctx, bool(*p.IsSorted)); err != nil { 4287 return thrift.PrependError(fmt.Sprintf("%T.is_sorted (3) field write error: ", p), err) } 4288 if err := oprot.WriteFieldEnd(ctx); err != nil { 4289 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:is_sorted: ", p), err) } 4290 } 4291 return err 4292} 4293 4294func (p *DictionaryPageHeader) Equals(other *DictionaryPageHeader) bool { 4295 if p == other { 4296 return true 4297 } else if p == nil || other == nil { 4298 return false 4299 } 4300 if p.NumValues != other.NumValues { return false } 4301 if p.Encoding != other.Encoding { return false } 4302 if p.IsSorted != other.IsSorted { 4303 if p.IsSorted == nil || other.IsSorted == nil { 4304 return false 4305 } 4306 if (*p.IsSorted) != (*other.IsSorted) { return false } 4307 } 4308 return true 4309} 4310 4311func (p *DictionaryPageHeader) String() string { 4312 if p == nil { 4313 return "<nil>" 4314 } 4315 return fmt.Sprintf("DictionaryPageHeader(%+v)", *p) 4316} 4317 4318// New page format allowing reading levels without decompressing the data 4319// Repetition and definition levels are uncompressed 4320// The remaining section containing the data is compressed if is_compressed is true 4321// 4322// 4323// Attributes: 4324// - NumValues: Number of values, including NULLs, in this data page. * 4325// - NumNulls: Number of NULL values, in this data page. 4326// Number of non-null = num_values - num_nulls which is also the number of values in the data section * 4327// - NumRows: Number of rows in this data page. which means pages change on record boundaries (r = 0) * 4328// - Encoding: Encoding used for data in this page * 4329// - DefinitionLevelsByteLength: length of the definition levels 4330// - RepetitionLevelsByteLength: length of the repetition levels 4331// - IsCompressed: whether the values are compressed. 4332// Which means the section of the page between 4333// definition_levels_byte_length + repetition_levels_byte_length + 1 and compressed_page_size (included) 4334// is compressed with the compression_codec. 4335// If missing it is considered compressed 4336// - Statistics: optional statistics for this column chunk 4337type DataPageHeaderV2 struct { 4338 NumValues int32 `thrift:"num_values,1,required" db:"num_values" json:"num_values"` 4339 NumNulls int32 `thrift:"num_nulls,2,required" db:"num_nulls" json:"num_nulls"` 4340 NumRows int32 `thrift:"num_rows,3,required" db:"num_rows" json:"num_rows"` 4341 Encoding Encoding `thrift:"encoding,4,required" db:"encoding" json:"encoding"` 4342 DefinitionLevelsByteLength int32 `thrift:"definition_levels_byte_length,5,required" db:"definition_levels_byte_length" json:"definition_levels_byte_length"` 4343 RepetitionLevelsByteLength int32 `thrift:"repetition_levels_byte_length,6,required" db:"repetition_levels_byte_length" json:"repetition_levels_byte_length"` 4344 IsCompressed bool `thrift:"is_compressed,7" db:"is_compressed" json:"is_compressed"` 4345 Statistics *Statistics `thrift:"statistics,8" db:"statistics" json:"statistics,omitempty"` 4346} 4347 4348func NewDataPageHeaderV2() *DataPageHeaderV2 { 4349 return &DataPageHeaderV2{ 4350IsCompressed: true, 4351} 4352} 4353 4354 4355func (p *DataPageHeaderV2) GetNumValues() int32 { 4356 return p.NumValues 4357} 4358 4359func (p *DataPageHeaderV2) GetNumNulls() int32 { 4360 return p.NumNulls 4361} 4362 4363func (p *DataPageHeaderV2) GetNumRows() int32 { 4364 return p.NumRows 4365} 4366 4367func (p *DataPageHeaderV2) GetEncoding() Encoding { 4368 return p.Encoding 4369} 4370 4371func (p *DataPageHeaderV2) GetDefinitionLevelsByteLength() int32 { 4372 return p.DefinitionLevelsByteLength 4373} 4374 4375func (p *DataPageHeaderV2) GetRepetitionLevelsByteLength() int32 { 4376 return p.RepetitionLevelsByteLength 4377} 4378var DataPageHeaderV2_IsCompressed_DEFAULT bool = true 4379 4380func (p *DataPageHeaderV2) GetIsCompressed() bool { 4381 return p.IsCompressed 4382} 4383var DataPageHeaderV2_Statistics_DEFAULT *Statistics 4384func (p *DataPageHeaderV2) GetStatistics() *Statistics { 4385 if !p.IsSetStatistics() { 4386 return DataPageHeaderV2_Statistics_DEFAULT 4387 } 4388return p.Statistics 4389} 4390func (p *DataPageHeaderV2) IsSetIsCompressed() bool { 4391 return p.IsCompressed != DataPageHeaderV2_IsCompressed_DEFAULT 4392} 4393 4394func (p *DataPageHeaderV2) IsSetStatistics() bool { 4395 return p.Statistics != nil 4396} 4397 4398func (p *DataPageHeaderV2) Read(ctx context.Context, iprot thrift.TProtocol) error { 4399 if _, err := iprot.ReadStructBegin(ctx); err != nil { 4400 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 4401 } 4402 4403 var issetNumValues bool = false; 4404 var issetNumNulls bool = false; 4405 var issetNumRows bool = false; 4406 var issetEncoding bool = false; 4407 var issetDefinitionLevelsByteLength bool = false; 4408 var issetRepetitionLevelsByteLength bool = false; 4409 4410 for { 4411 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 4412 if err != nil { 4413 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 4414 } 4415 if fieldTypeId == thrift.STOP { break; } 4416 switch fieldId { 4417 case 1: 4418 if fieldTypeId == thrift.I32 { 4419 if err := p.ReadField1(ctx, iprot); err != nil { 4420 return err 4421 } 4422 issetNumValues = true 4423 } else { 4424 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4425 return err 4426 } 4427 } 4428 case 2: 4429 if fieldTypeId == thrift.I32 { 4430 if err := p.ReadField2(ctx, iprot); err != nil { 4431 return err 4432 } 4433 issetNumNulls = true 4434 } else { 4435 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4436 return err 4437 } 4438 } 4439 case 3: 4440 if fieldTypeId == thrift.I32 { 4441 if err := p.ReadField3(ctx, iprot); err != nil { 4442 return err 4443 } 4444 issetNumRows = true 4445 } else { 4446 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4447 return err 4448 } 4449 } 4450 case 4: 4451 if fieldTypeId == thrift.I32 { 4452 if err := p.ReadField4(ctx, iprot); err != nil { 4453 return err 4454 } 4455 issetEncoding = true 4456 } else { 4457 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4458 return err 4459 } 4460 } 4461 case 5: 4462 if fieldTypeId == thrift.I32 { 4463 if err := p.ReadField5(ctx, iprot); err != nil { 4464 return err 4465 } 4466 issetDefinitionLevelsByteLength = true 4467 } else { 4468 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4469 return err 4470 } 4471 } 4472 case 6: 4473 if fieldTypeId == thrift.I32 { 4474 if err := p.ReadField6(ctx, iprot); err != nil { 4475 return err 4476 } 4477 issetRepetitionLevelsByteLength = true 4478 } else { 4479 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4480 return err 4481 } 4482 } 4483 case 7: 4484 if fieldTypeId == thrift.BOOL { 4485 if err := p.ReadField7(ctx, iprot); err != nil { 4486 return err 4487 } 4488 } else { 4489 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4490 return err 4491 } 4492 } 4493 case 8: 4494 if fieldTypeId == thrift.STRUCT { 4495 if err := p.ReadField8(ctx, iprot); err != nil { 4496 return err 4497 } 4498 } else { 4499 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4500 return err 4501 } 4502 } 4503 default: 4504 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4505 return err 4506 } 4507 } 4508 if err := iprot.ReadFieldEnd(ctx); err != nil { 4509 return err 4510 } 4511 } 4512 if err := iprot.ReadStructEnd(ctx); err != nil { 4513 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4514 } 4515 if !issetNumValues{ 4516 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumValues is not set")); 4517 } 4518 if !issetNumNulls{ 4519 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumNulls is not set")); 4520 } 4521 if !issetNumRows{ 4522 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumRows is not set")); 4523 } 4524 if !issetEncoding{ 4525 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encoding is not set")); 4526 } 4527 if !issetDefinitionLevelsByteLength{ 4528 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DefinitionLevelsByteLength is not set")); 4529 } 4530 if !issetRepetitionLevelsByteLength{ 4531 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RepetitionLevelsByteLength is not set")); 4532 } 4533 return nil 4534} 4535 4536func (p *DataPageHeaderV2) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 4537 if v, err := iprot.ReadI32(ctx); err != nil { 4538 return thrift.PrependError("error reading field 1: ", err) 4539} else { 4540 p.NumValues = v 4541} 4542 return nil 4543} 4544 4545func (p *DataPageHeaderV2) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 4546 if v, err := iprot.ReadI32(ctx); err != nil { 4547 return thrift.PrependError("error reading field 2: ", err) 4548} else { 4549 p.NumNulls = v 4550} 4551 return nil 4552} 4553 4554func (p *DataPageHeaderV2) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 4555 if v, err := iprot.ReadI32(ctx); err != nil { 4556 return thrift.PrependError("error reading field 3: ", err) 4557} else { 4558 p.NumRows = v 4559} 4560 return nil 4561} 4562 4563func (p *DataPageHeaderV2) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 4564 if v, err := iprot.ReadI32(ctx); err != nil { 4565 return thrift.PrependError("error reading field 4: ", err) 4566} else { 4567 temp := Encoding(v) 4568 p.Encoding = temp 4569} 4570 return nil 4571} 4572 4573func (p *DataPageHeaderV2) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 4574 if v, err := iprot.ReadI32(ctx); err != nil { 4575 return thrift.PrependError("error reading field 5: ", err) 4576} else { 4577 p.DefinitionLevelsByteLength = v 4578} 4579 return nil 4580} 4581 4582func (p *DataPageHeaderV2) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 4583 if v, err := iprot.ReadI32(ctx); err != nil { 4584 return thrift.PrependError("error reading field 6: ", err) 4585} else { 4586 p.RepetitionLevelsByteLength = v 4587} 4588 return nil 4589} 4590 4591func (p *DataPageHeaderV2) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 4592 if v, err := iprot.ReadBool(ctx); err != nil { 4593 return thrift.PrependError("error reading field 7: ", err) 4594} else { 4595 p.IsCompressed = v 4596} 4597 return nil 4598} 4599 4600func (p *DataPageHeaderV2) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 4601 p.Statistics = &Statistics{} 4602 if err := p.Statistics.Read(ctx, iprot); err != nil { 4603 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Statistics), err) 4604 } 4605 return nil 4606} 4607 4608func (p *DataPageHeaderV2) Write(ctx context.Context, oprot thrift.TProtocol) error { 4609 if err := oprot.WriteStructBegin(ctx, "DataPageHeaderV2"); err != nil { 4610 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 4611 if p != nil { 4612 if err := p.writeField1(ctx, oprot); err != nil { return err } 4613 if err := p.writeField2(ctx, oprot); err != nil { return err } 4614 if err := p.writeField3(ctx, oprot); err != nil { return err } 4615 if err := p.writeField4(ctx, oprot); err != nil { return err } 4616 if err := p.writeField5(ctx, oprot); err != nil { return err } 4617 if err := p.writeField6(ctx, oprot); err != nil { return err } 4618 if err := p.writeField7(ctx, oprot); err != nil { return err } 4619 if err := p.writeField8(ctx, oprot); err != nil { return err } 4620 } 4621 if err := oprot.WriteFieldStop(ctx); err != nil { 4622 return thrift.PrependError("write field stop error: ", err) } 4623 if err := oprot.WriteStructEnd(ctx); err != nil { 4624 return thrift.PrependError("write struct stop error: ", err) } 4625 return nil 4626} 4627 4628func (p *DataPageHeaderV2) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 4629 if err := oprot.WriteFieldBegin(ctx, "num_values", thrift.I32, 1); err != nil { 4630 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:num_values: ", p), err) } 4631 if err := oprot.WriteI32(ctx, int32(p.NumValues)); err != nil { 4632 return thrift.PrependError(fmt.Sprintf("%T.num_values (1) field write error: ", p), err) } 4633 if err := oprot.WriteFieldEnd(ctx); err != nil { 4634 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:num_values: ", p), err) } 4635 return err 4636} 4637 4638func (p *DataPageHeaderV2) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 4639 if err := oprot.WriteFieldBegin(ctx, "num_nulls", thrift.I32, 2); err != nil { 4640 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:num_nulls: ", p), err) } 4641 if err := oprot.WriteI32(ctx, int32(p.NumNulls)); err != nil { 4642 return thrift.PrependError(fmt.Sprintf("%T.num_nulls (2) field write error: ", p), err) } 4643 if err := oprot.WriteFieldEnd(ctx); err != nil { 4644 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:num_nulls: ", p), err) } 4645 return err 4646} 4647 4648func (p *DataPageHeaderV2) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 4649 if err := oprot.WriteFieldBegin(ctx, "num_rows", thrift.I32, 3); err != nil { 4650 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:num_rows: ", p), err) } 4651 if err := oprot.WriteI32(ctx, int32(p.NumRows)); err != nil { 4652 return thrift.PrependError(fmt.Sprintf("%T.num_rows (3) field write error: ", p), err) } 4653 if err := oprot.WriteFieldEnd(ctx); err != nil { 4654 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:num_rows: ", p), err) } 4655 return err 4656} 4657 4658func (p *DataPageHeaderV2) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 4659 if err := oprot.WriteFieldBegin(ctx, "encoding", thrift.I32, 4); err != nil { 4660 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:encoding: ", p), err) } 4661 if err := oprot.WriteI32(ctx, int32(p.Encoding)); err != nil { 4662 return thrift.PrependError(fmt.Sprintf("%T.encoding (4) field write error: ", p), err) } 4663 if err := oprot.WriteFieldEnd(ctx); err != nil { 4664 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:encoding: ", p), err) } 4665 return err 4666} 4667 4668func (p *DataPageHeaderV2) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 4669 if err := oprot.WriteFieldBegin(ctx, "definition_levels_byte_length", thrift.I32, 5); err != nil { 4670 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:definition_levels_byte_length: ", p), err) } 4671 if err := oprot.WriteI32(ctx, int32(p.DefinitionLevelsByteLength)); err != nil { 4672 return thrift.PrependError(fmt.Sprintf("%T.definition_levels_byte_length (5) field write error: ", p), err) } 4673 if err := oprot.WriteFieldEnd(ctx); err != nil { 4674 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:definition_levels_byte_length: ", p), err) } 4675 return err 4676} 4677 4678func (p *DataPageHeaderV2) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 4679 if err := oprot.WriteFieldBegin(ctx, "repetition_levels_byte_length", thrift.I32, 6); err != nil { 4680 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:repetition_levels_byte_length: ", p), err) } 4681 if err := oprot.WriteI32(ctx, int32(p.RepetitionLevelsByteLength)); err != nil { 4682 return thrift.PrependError(fmt.Sprintf("%T.repetition_levels_byte_length (6) field write error: ", p), err) } 4683 if err := oprot.WriteFieldEnd(ctx); err != nil { 4684 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:repetition_levels_byte_length: ", p), err) } 4685 return err 4686} 4687 4688func (p *DataPageHeaderV2) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 4689 if p.IsSetIsCompressed() { 4690 if err := oprot.WriteFieldBegin(ctx, "is_compressed", thrift.BOOL, 7); err != nil { 4691 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:is_compressed: ", p), err) } 4692 if err := oprot.WriteBool(ctx, bool(p.IsCompressed)); err != nil { 4693 return thrift.PrependError(fmt.Sprintf("%T.is_compressed (7) field write error: ", p), err) } 4694 if err := oprot.WriteFieldEnd(ctx); err != nil { 4695 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:is_compressed: ", p), err) } 4696 } 4697 return err 4698} 4699 4700func (p *DataPageHeaderV2) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 4701 if p.IsSetStatistics() { 4702 if err := oprot.WriteFieldBegin(ctx, "statistics", thrift.STRUCT, 8); err != nil { 4703 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:statistics: ", p), err) } 4704 if err := p.Statistics.Write(ctx, oprot); err != nil { 4705 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Statistics), err) 4706 } 4707 if err := oprot.WriteFieldEnd(ctx); err != nil { 4708 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:statistics: ", p), err) } 4709 } 4710 return err 4711} 4712 4713func (p *DataPageHeaderV2) Equals(other *DataPageHeaderV2) bool { 4714 if p == other { 4715 return true 4716 } else if p == nil || other == nil { 4717 return false 4718 } 4719 if p.NumValues != other.NumValues { return false } 4720 if p.NumNulls != other.NumNulls { return false } 4721 if p.NumRows != other.NumRows { return false } 4722 if p.Encoding != other.Encoding { return false } 4723 if p.DefinitionLevelsByteLength != other.DefinitionLevelsByteLength { return false } 4724 if p.RepetitionLevelsByteLength != other.RepetitionLevelsByteLength { return false } 4725 if p.IsCompressed != other.IsCompressed { return false } 4726 if !p.Statistics.Equals(other.Statistics) { return false } 4727 return true 4728} 4729 4730func (p *DataPageHeaderV2) String() string { 4731 if p == nil { 4732 return "<nil>" 4733 } 4734 return fmt.Sprintf("DataPageHeaderV2(%+v)", *p) 4735} 4736 4737// Block-based algorithm type annotation. * 4738type SplitBlockAlgorithm struct { 4739} 4740 4741func NewSplitBlockAlgorithm() *SplitBlockAlgorithm { 4742 return &SplitBlockAlgorithm{} 4743} 4744 4745func (p *SplitBlockAlgorithm) Read(ctx context.Context, iprot thrift.TProtocol) error { 4746 if _, err := iprot.ReadStructBegin(ctx); err != nil { 4747 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 4748 } 4749 4750 4751 for { 4752 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 4753 if err != nil { 4754 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 4755 } 4756 if fieldTypeId == thrift.STOP { break; } 4757 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4758 return err 4759 } 4760 if err := iprot.ReadFieldEnd(ctx); err != nil { 4761 return err 4762 } 4763 } 4764 if err := iprot.ReadStructEnd(ctx); err != nil { 4765 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4766 } 4767 return nil 4768} 4769 4770func (p *SplitBlockAlgorithm) Write(ctx context.Context, oprot thrift.TProtocol) error { 4771 if err := oprot.WriteStructBegin(ctx, "SplitBlockAlgorithm"); err != nil { 4772 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 4773 if p != nil { 4774 } 4775 if err := oprot.WriteFieldStop(ctx); err != nil { 4776 return thrift.PrependError("write field stop error: ", err) } 4777 if err := oprot.WriteStructEnd(ctx); err != nil { 4778 return thrift.PrependError("write struct stop error: ", err) } 4779 return nil 4780} 4781 4782func (p *SplitBlockAlgorithm) Equals(other *SplitBlockAlgorithm) bool { 4783 if p == other { 4784 return true 4785 } else if p == nil || other == nil { 4786 return false 4787 } 4788 return true 4789} 4790 4791func (p *SplitBlockAlgorithm) String() string { 4792 if p == nil { 4793 return "<nil>" 4794 } 4795 return fmt.Sprintf("SplitBlockAlgorithm(%+v)", *p) 4796} 4797 4798// The algorithm used in Bloom filter. * 4799// 4800// Attributes: 4801// - BLOCK: Block-based Bloom filter. * 4802type BloomFilterAlgorithm struct { 4803 BLOCK *SplitBlockAlgorithm `thrift:"BLOCK,1" db:"BLOCK" json:"BLOCK,omitempty"` 4804} 4805 4806func NewBloomFilterAlgorithm() *BloomFilterAlgorithm { 4807 return &BloomFilterAlgorithm{} 4808} 4809 4810var BloomFilterAlgorithm_BLOCK_DEFAULT *SplitBlockAlgorithm 4811func (p *BloomFilterAlgorithm) GetBLOCK() *SplitBlockAlgorithm { 4812 if !p.IsSetBLOCK() { 4813 return BloomFilterAlgorithm_BLOCK_DEFAULT 4814 } 4815return p.BLOCK 4816} 4817func (p *BloomFilterAlgorithm) CountSetFieldsBloomFilterAlgorithm() int { 4818 count := 0 4819 if (p.IsSetBLOCK()) { 4820 count++ 4821 } 4822 return count 4823 4824} 4825 4826func (p *BloomFilterAlgorithm) IsSetBLOCK() bool { 4827 return p.BLOCK != nil 4828} 4829 4830func (p *BloomFilterAlgorithm) Read(ctx context.Context, iprot thrift.TProtocol) error { 4831 if _, err := iprot.ReadStructBegin(ctx); err != nil { 4832 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 4833 } 4834 4835 4836 for { 4837 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 4838 if err != nil { 4839 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 4840 } 4841 if fieldTypeId == thrift.STOP { break; } 4842 switch fieldId { 4843 case 1: 4844 if fieldTypeId == thrift.STRUCT { 4845 if err := p.ReadField1(ctx, iprot); err != nil { 4846 return err 4847 } 4848 } else { 4849 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4850 return err 4851 } 4852 } 4853 default: 4854 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4855 return err 4856 } 4857 } 4858 if err := iprot.ReadFieldEnd(ctx); err != nil { 4859 return err 4860 } 4861 } 4862 if err := iprot.ReadStructEnd(ctx); err != nil { 4863 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4864 } 4865 return nil 4866} 4867 4868func (p *BloomFilterAlgorithm) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 4869 p.BLOCK = &SplitBlockAlgorithm{} 4870 if err := p.BLOCK.Read(ctx, iprot); err != nil { 4871 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.BLOCK), err) 4872 } 4873 return nil 4874} 4875 4876func (p *BloomFilterAlgorithm) Write(ctx context.Context, oprot thrift.TProtocol) error { 4877 if c := p.CountSetFieldsBloomFilterAlgorithm(); c != 1 { 4878 return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) 4879 } 4880 if err := oprot.WriteStructBegin(ctx, "BloomFilterAlgorithm"); err != nil { 4881 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 4882 if p != nil { 4883 if err := p.writeField1(ctx, oprot); err != nil { return err } 4884 } 4885 if err := oprot.WriteFieldStop(ctx); err != nil { 4886 return thrift.PrependError("write field stop error: ", err) } 4887 if err := oprot.WriteStructEnd(ctx); err != nil { 4888 return thrift.PrependError("write struct stop error: ", err) } 4889 return nil 4890} 4891 4892func (p *BloomFilterAlgorithm) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 4893 if p.IsSetBLOCK() { 4894 if err := oprot.WriteFieldBegin(ctx, "BLOCK", thrift.STRUCT, 1); err != nil { 4895 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:BLOCK: ", p), err) } 4896 if err := p.BLOCK.Write(ctx, oprot); err != nil { 4897 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.BLOCK), err) 4898 } 4899 if err := oprot.WriteFieldEnd(ctx); err != nil { 4900 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:BLOCK: ", p), err) } 4901 } 4902 return err 4903} 4904 4905func (p *BloomFilterAlgorithm) Equals(other *BloomFilterAlgorithm) bool { 4906 if p == other { 4907 return true 4908 } else if p == nil || other == nil { 4909 return false 4910 } 4911 if !p.BLOCK.Equals(other.BLOCK) { return false } 4912 return true 4913} 4914 4915func (p *BloomFilterAlgorithm) String() string { 4916 if p == nil { 4917 return "<nil>" 4918 } 4919 return fmt.Sprintf("BloomFilterAlgorithm(%+v)", *p) 4920} 4921 4922// Hash strategy type annotation. xxHash is an extremely fast non-cryptographic hash 4923// algorithm. It uses 64 bits version of xxHash. 4924// 4925type XxHash struct { 4926} 4927 4928func NewXxHash() *XxHash { 4929 return &XxHash{} 4930} 4931 4932func (p *XxHash) Read(ctx context.Context, iprot thrift.TProtocol) error { 4933 if _, err := iprot.ReadStructBegin(ctx); err != nil { 4934 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 4935 } 4936 4937 4938 for { 4939 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 4940 if err != nil { 4941 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 4942 } 4943 if fieldTypeId == thrift.STOP { break; } 4944 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4945 return err 4946 } 4947 if err := iprot.ReadFieldEnd(ctx); err != nil { 4948 return err 4949 } 4950 } 4951 if err := iprot.ReadStructEnd(ctx); err != nil { 4952 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4953 } 4954 return nil 4955} 4956 4957func (p *XxHash) Write(ctx context.Context, oprot thrift.TProtocol) error { 4958 if err := oprot.WriteStructBegin(ctx, "XxHash"); err != nil { 4959 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 4960 if p != nil { 4961 } 4962 if err := oprot.WriteFieldStop(ctx); err != nil { 4963 return thrift.PrependError("write field stop error: ", err) } 4964 if err := oprot.WriteStructEnd(ctx); err != nil { 4965 return thrift.PrependError("write struct stop error: ", err) } 4966 return nil 4967} 4968 4969func (p *XxHash) Equals(other *XxHash) bool { 4970 if p == other { 4971 return true 4972 } else if p == nil || other == nil { 4973 return false 4974 } 4975 return true 4976} 4977 4978func (p *XxHash) String() string { 4979 if p == nil { 4980 return "<nil>" 4981 } 4982 return fmt.Sprintf("XxHash(%+v)", *p) 4983} 4984 4985// The hash function used in Bloom filter. This function takes the hash of a column value 4986// using plain encoding. 4987// 4988// 4989// Attributes: 4990// - XXHASH: xxHash Strategy. * 4991type BloomFilterHash struct { 4992 XXHASH *XxHash `thrift:"XXHASH,1" db:"XXHASH" json:"XXHASH,omitempty"` 4993} 4994 4995func NewBloomFilterHash() *BloomFilterHash { 4996 return &BloomFilterHash{} 4997} 4998 4999var BloomFilterHash_XXHASH_DEFAULT *XxHash 5000func (p *BloomFilterHash) GetXXHASH() *XxHash { 5001 if !p.IsSetXXHASH() { 5002 return BloomFilterHash_XXHASH_DEFAULT 5003 } 5004return p.XXHASH 5005} 5006func (p *BloomFilterHash) CountSetFieldsBloomFilterHash() int { 5007 count := 0 5008 if (p.IsSetXXHASH()) { 5009 count++ 5010 } 5011 return count 5012 5013} 5014 5015func (p *BloomFilterHash) IsSetXXHASH() bool { 5016 return p.XXHASH != nil 5017} 5018 5019func (p *BloomFilterHash) Read(ctx context.Context, iprot thrift.TProtocol) error { 5020 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5021 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5022 } 5023 5024 5025 for { 5026 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5027 if err != nil { 5028 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5029 } 5030 if fieldTypeId == thrift.STOP { break; } 5031 switch fieldId { 5032 case 1: 5033 if fieldTypeId == thrift.STRUCT { 5034 if err := p.ReadField1(ctx, iprot); err != nil { 5035 return err 5036 } 5037 } else { 5038 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5039 return err 5040 } 5041 } 5042 default: 5043 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5044 return err 5045 } 5046 } 5047 if err := iprot.ReadFieldEnd(ctx); err != nil { 5048 return err 5049 } 5050 } 5051 if err := iprot.ReadStructEnd(ctx); err != nil { 5052 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5053 } 5054 return nil 5055} 5056 5057func (p *BloomFilterHash) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 5058 p.XXHASH = &XxHash{} 5059 if err := p.XXHASH.Read(ctx, iprot); err != nil { 5060 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.XXHASH), err) 5061 } 5062 return nil 5063} 5064 5065func (p *BloomFilterHash) Write(ctx context.Context, oprot thrift.TProtocol) error { 5066 if c := p.CountSetFieldsBloomFilterHash(); c != 1 { 5067 return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) 5068 } 5069 if err := oprot.WriteStructBegin(ctx, "BloomFilterHash"); err != nil { 5070 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 5071 if p != nil { 5072 if err := p.writeField1(ctx, oprot); err != nil { return err } 5073 } 5074 if err := oprot.WriteFieldStop(ctx); err != nil { 5075 return thrift.PrependError("write field stop error: ", err) } 5076 if err := oprot.WriteStructEnd(ctx); err != nil { 5077 return thrift.PrependError("write struct stop error: ", err) } 5078 return nil 5079} 5080 5081func (p *BloomFilterHash) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 5082 if p.IsSetXXHASH() { 5083 if err := oprot.WriteFieldBegin(ctx, "XXHASH", thrift.STRUCT, 1); err != nil { 5084 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:XXHASH: ", p), err) } 5085 if err := p.XXHASH.Write(ctx, oprot); err != nil { 5086 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.XXHASH), err) 5087 } 5088 if err := oprot.WriteFieldEnd(ctx); err != nil { 5089 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:XXHASH: ", p), err) } 5090 } 5091 return err 5092} 5093 5094func (p *BloomFilterHash) Equals(other *BloomFilterHash) bool { 5095 if p == other { 5096 return true 5097 } else if p == nil || other == nil { 5098 return false 5099 } 5100 if !p.XXHASH.Equals(other.XXHASH) { return false } 5101 return true 5102} 5103 5104func (p *BloomFilterHash) String() string { 5105 if p == nil { 5106 return "<nil>" 5107 } 5108 return fmt.Sprintf("BloomFilterHash(%+v)", *p) 5109} 5110 5111// The compression used in the Bloom filter. 5112// 5113type Uncompressed struct { 5114} 5115 5116func NewUncompressed() *Uncompressed { 5117 return &Uncompressed{} 5118} 5119 5120func (p *Uncompressed) Read(ctx context.Context, iprot thrift.TProtocol) error { 5121 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5122 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5123 } 5124 5125 5126 for { 5127 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5128 if err != nil { 5129 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5130 } 5131 if fieldTypeId == thrift.STOP { break; } 5132 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5133 return err 5134 } 5135 if err := iprot.ReadFieldEnd(ctx); err != nil { 5136 return err 5137 } 5138 } 5139 if err := iprot.ReadStructEnd(ctx); err != nil { 5140 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5141 } 5142 return nil 5143} 5144 5145func (p *Uncompressed) Write(ctx context.Context, oprot thrift.TProtocol) error { 5146 if err := oprot.WriteStructBegin(ctx, "Uncompressed"); err != nil { 5147 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 5148 if p != nil { 5149 } 5150 if err := oprot.WriteFieldStop(ctx); err != nil { 5151 return thrift.PrependError("write field stop error: ", err) } 5152 if err := oprot.WriteStructEnd(ctx); err != nil { 5153 return thrift.PrependError("write struct stop error: ", err) } 5154 return nil 5155} 5156 5157func (p *Uncompressed) Equals(other *Uncompressed) bool { 5158 if p == other { 5159 return true 5160 } else if p == nil || other == nil { 5161 return false 5162 } 5163 return true 5164} 5165 5166func (p *Uncompressed) String() string { 5167 if p == nil { 5168 return "<nil>" 5169 } 5170 return fmt.Sprintf("Uncompressed(%+v)", *p) 5171} 5172 5173// Attributes: 5174// - UNCOMPRESSED 5175type BloomFilterCompression struct { 5176 UNCOMPRESSED *Uncompressed `thrift:"UNCOMPRESSED,1" db:"UNCOMPRESSED" json:"UNCOMPRESSED,omitempty"` 5177} 5178 5179func NewBloomFilterCompression() *BloomFilterCompression { 5180 return &BloomFilterCompression{} 5181} 5182 5183var BloomFilterCompression_UNCOMPRESSED_DEFAULT *Uncompressed 5184func (p *BloomFilterCompression) GetUNCOMPRESSED() *Uncompressed { 5185 if !p.IsSetUNCOMPRESSED() { 5186 return BloomFilterCompression_UNCOMPRESSED_DEFAULT 5187 } 5188return p.UNCOMPRESSED 5189} 5190func (p *BloomFilterCompression) CountSetFieldsBloomFilterCompression() int { 5191 count := 0 5192 if (p.IsSetUNCOMPRESSED()) { 5193 count++ 5194 } 5195 return count 5196 5197} 5198 5199func (p *BloomFilterCompression) IsSetUNCOMPRESSED() bool { 5200 return p.UNCOMPRESSED != nil 5201} 5202 5203func (p *BloomFilterCompression) Read(ctx context.Context, iprot thrift.TProtocol) error { 5204 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5205 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5206 } 5207 5208 5209 for { 5210 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5211 if err != nil { 5212 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5213 } 5214 if fieldTypeId == thrift.STOP { break; } 5215 switch fieldId { 5216 case 1: 5217 if fieldTypeId == thrift.STRUCT { 5218 if err := p.ReadField1(ctx, iprot); err != nil { 5219 return err 5220 } 5221 } else { 5222 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5223 return err 5224 } 5225 } 5226 default: 5227 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5228 return err 5229 } 5230 } 5231 if err := iprot.ReadFieldEnd(ctx); err != nil { 5232 return err 5233 } 5234 } 5235 if err := iprot.ReadStructEnd(ctx); err != nil { 5236 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5237 } 5238 return nil 5239} 5240 5241func (p *BloomFilterCompression) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 5242 p.UNCOMPRESSED = &Uncompressed{} 5243 if err := p.UNCOMPRESSED.Read(ctx, iprot); err != nil { 5244 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.UNCOMPRESSED), err) 5245 } 5246 return nil 5247} 5248 5249func (p *BloomFilterCompression) Write(ctx context.Context, oprot thrift.TProtocol) error { 5250 if c := p.CountSetFieldsBloomFilterCompression(); c != 1 { 5251 return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) 5252 } 5253 if err := oprot.WriteStructBegin(ctx, "BloomFilterCompression"); err != nil { 5254 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 5255 if p != nil { 5256 if err := p.writeField1(ctx, oprot); err != nil { return err } 5257 } 5258 if err := oprot.WriteFieldStop(ctx); err != nil { 5259 return thrift.PrependError("write field stop error: ", err) } 5260 if err := oprot.WriteStructEnd(ctx); err != nil { 5261 return thrift.PrependError("write struct stop error: ", err) } 5262 return nil 5263} 5264 5265func (p *BloomFilterCompression) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 5266 if p.IsSetUNCOMPRESSED() { 5267 if err := oprot.WriteFieldBegin(ctx, "UNCOMPRESSED", thrift.STRUCT, 1); err != nil { 5268 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:UNCOMPRESSED: ", p), err) } 5269 if err := p.UNCOMPRESSED.Write(ctx, oprot); err != nil { 5270 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.UNCOMPRESSED), err) 5271 } 5272 if err := oprot.WriteFieldEnd(ctx); err != nil { 5273 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:UNCOMPRESSED: ", p), err) } 5274 } 5275 return err 5276} 5277 5278func (p *BloomFilterCompression) Equals(other *BloomFilterCompression) bool { 5279 if p == other { 5280 return true 5281 } else if p == nil || other == nil { 5282 return false 5283 } 5284 if !p.UNCOMPRESSED.Equals(other.UNCOMPRESSED) { return false } 5285 return true 5286} 5287 5288func (p *BloomFilterCompression) String() string { 5289 if p == nil { 5290 return "<nil>" 5291 } 5292 return fmt.Sprintf("BloomFilterCompression(%+v)", *p) 5293} 5294 5295// Bloom filter header is stored at beginning of Bloom filter data of each column 5296// and followed by its bitset. 5297// 5298// 5299// Attributes: 5300// - NumBytes: The size of bitset in bytes * 5301// - Algorithm: The algorithm for setting bits. * 5302// - Hash: The hash function used for Bloom filter. * 5303// - Compression: The compression used in the Bloom filter * 5304type BloomFilterHeader struct { 5305 NumBytes int32 `thrift:"numBytes,1,required" db:"numBytes" json:"numBytes"` 5306 Algorithm *BloomFilterAlgorithm `thrift:"algorithm,2,required" db:"algorithm" json:"algorithm"` 5307 Hash *BloomFilterHash `thrift:"hash,3,required" db:"hash" json:"hash"` 5308 Compression *BloomFilterCompression `thrift:"compression,4,required" db:"compression" json:"compression"` 5309} 5310 5311func NewBloomFilterHeader() *BloomFilterHeader { 5312 return &BloomFilterHeader{} 5313} 5314 5315 5316func (p *BloomFilterHeader) GetNumBytes() int32 { 5317 return p.NumBytes 5318} 5319var BloomFilterHeader_Algorithm_DEFAULT *BloomFilterAlgorithm 5320func (p *BloomFilterHeader) GetAlgorithm() *BloomFilterAlgorithm { 5321 if !p.IsSetAlgorithm() { 5322 return BloomFilterHeader_Algorithm_DEFAULT 5323 } 5324return p.Algorithm 5325} 5326var BloomFilterHeader_Hash_DEFAULT *BloomFilterHash 5327func (p *BloomFilterHeader) GetHash() *BloomFilterHash { 5328 if !p.IsSetHash() { 5329 return BloomFilterHeader_Hash_DEFAULT 5330 } 5331return p.Hash 5332} 5333var BloomFilterHeader_Compression_DEFAULT *BloomFilterCompression 5334func (p *BloomFilterHeader) GetCompression() *BloomFilterCompression { 5335 if !p.IsSetCompression() { 5336 return BloomFilterHeader_Compression_DEFAULT 5337 } 5338return p.Compression 5339} 5340func (p *BloomFilterHeader) IsSetAlgorithm() bool { 5341 return p.Algorithm != nil 5342} 5343 5344func (p *BloomFilterHeader) IsSetHash() bool { 5345 return p.Hash != nil 5346} 5347 5348func (p *BloomFilterHeader) IsSetCompression() bool { 5349 return p.Compression != nil 5350} 5351 5352func (p *BloomFilterHeader) Read(ctx context.Context, iprot thrift.TProtocol) error { 5353 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5354 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5355 } 5356 5357 var issetNumBytes bool = false; 5358 var issetAlgorithm bool = false; 5359 var issetHash bool = false; 5360 var issetCompression bool = false; 5361 5362 for { 5363 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5364 if err != nil { 5365 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5366 } 5367 if fieldTypeId == thrift.STOP { break; } 5368 switch fieldId { 5369 case 1: 5370 if fieldTypeId == thrift.I32 { 5371 if err := p.ReadField1(ctx, iprot); err != nil { 5372 return err 5373 } 5374 issetNumBytes = true 5375 } else { 5376 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5377 return err 5378 } 5379 } 5380 case 2: 5381 if fieldTypeId == thrift.STRUCT { 5382 if err := p.ReadField2(ctx, iprot); err != nil { 5383 return err 5384 } 5385 issetAlgorithm = true 5386 } else { 5387 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5388 return err 5389 } 5390 } 5391 case 3: 5392 if fieldTypeId == thrift.STRUCT { 5393 if err := p.ReadField3(ctx, iprot); err != nil { 5394 return err 5395 } 5396 issetHash = true 5397 } else { 5398 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5399 return err 5400 } 5401 } 5402 case 4: 5403 if fieldTypeId == thrift.STRUCT { 5404 if err := p.ReadField4(ctx, iprot); err != nil { 5405 return err 5406 } 5407 issetCompression = true 5408 } else { 5409 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5410 return err 5411 } 5412 } 5413 default: 5414 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5415 return err 5416 } 5417 } 5418 if err := iprot.ReadFieldEnd(ctx); err != nil { 5419 return err 5420 } 5421 } 5422 if err := iprot.ReadStructEnd(ctx); err != nil { 5423 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5424 } 5425 if !issetNumBytes{ 5426 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumBytes is not set")); 5427 } 5428 if !issetAlgorithm{ 5429 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Algorithm is not set")); 5430 } 5431 if !issetHash{ 5432 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Hash is not set")); 5433 } 5434 if !issetCompression{ 5435 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Compression is not set")); 5436 } 5437 return nil 5438} 5439 5440func (p *BloomFilterHeader) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 5441 if v, err := iprot.ReadI32(ctx); err != nil { 5442 return thrift.PrependError("error reading field 1: ", err) 5443} else { 5444 p.NumBytes = v 5445} 5446 return nil 5447} 5448 5449func (p *BloomFilterHeader) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 5450 p.Algorithm = &BloomFilterAlgorithm{} 5451 if err := p.Algorithm.Read(ctx, iprot); err != nil { 5452 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Algorithm), err) 5453 } 5454 return nil 5455} 5456 5457func (p *BloomFilterHeader) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 5458 p.Hash = &BloomFilterHash{} 5459 if err := p.Hash.Read(ctx, iprot); err != nil { 5460 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hash), err) 5461 } 5462 return nil 5463} 5464 5465func (p *BloomFilterHeader) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 5466 p.Compression = &BloomFilterCompression{} 5467 if err := p.Compression.Read(ctx, iprot); err != nil { 5468 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Compression), err) 5469 } 5470 return nil 5471} 5472 5473func (p *BloomFilterHeader) Write(ctx context.Context, oprot thrift.TProtocol) error { 5474 if err := oprot.WriteStructBegin(ctx, "BloomFilterHeader"); err != nil { 5475 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 5476 if p != nil { 5477 if err := p.writeField1(ctx, oprot); err != nil { return err } 5478 if err := p.writeField2(ctx, oprot); err != nil { return err } 5479 if err := p.writeField3(ctx, oprot); err != nil { return err } 5480 if err := p.writeField4(ctx, oprot); err != nil { return err } 5481 } 5482 if err := oprot.WriteFieldStop(ctx); err != nil { 5483 return thrift.PrependError("write field stop error: ", err) } 5484 if err := oprot.WriteStructEnd(ctx); err != nil { 5485 return thrift.PrependError("write struct stop error: ", err) } 5486 return nil 5487} 5488 5489func (p *BloomFilterHeader) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 5490 if err := oprot.WriteFieldBegin(ctx, "numBytes", thrift.I32, 1); err != nil { 5491 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:numBytes: ", p), err) } 5492 if err := oprot.WriteI32(ctx, int32(p.NumBytes)); err != nil { 5493 return thrift.PrependError(fmt.Sprintf("%T.numBytes (1) field write error: ", p), err) } 5494 if err := oprot.WriteFieldEnd(ctx); err != nil { 5495 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:numBytes: ", p), err) } 5496 return err 5497} 5498 5499func (p *BloomFilterHeader) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 5500 if err := oprot.WriteFieldBegin(ctx, "algorithm", thrift.STRUCT, 2); err != nil { 5501 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:algorithm: ", p), err) } 5502 if err := p.Algorithm.Write(ctx, oprot); err != nil { 5503 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Algorithm), err) 5504 } 5505 if err := oprot.WriteFieldEnd(ctx); err != nil { 5506 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:algorithm: ", p), err) } 5507 return err 5508} 5509 5510func (p *BloomFilterHeader) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 5511 if err := oprot.WriteFieldBegin(ctx, "hash", thrift.STRUCT, 3); err != nil { 5512 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:hash: ", p), err) } 5513 if err := p.Hash.Write(ctx, oprot); err != nil { 5514 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hash), err) 5515 } 5516 if err := oprot.WriteFieldEnd(ctx); err != nil { 5517 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:hash: ", p), err) } 5518 return err 5519} 5520 5521func (p *BloomFilterHeader) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 5522 if err := oprot.WriteFieldBegin(ctx, "compression", thrift.STRUCT, 4); err != nil { 5523 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:compression: ", p), err) } 5524 if err := p.Compression.Write(ctx, oprot); err != nil { 5525 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Compression), err) 5526 } 5527 if err := oprot.WriteFieldEnd(ctx); err != nil { 5528 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:compression: ", p), err) } 5529 return err 5530} 5531 5532func (p *BloomFilterHeader) Equals(other *BloomFilterHeader) bool { 5533 if p == other { 5534 return true 5535 } else if p == nil || other == nil { 5536 return false 5537 } 5538 if p.NumBytes != other.NumBytes { return false } 5539 if !p.Algorithm.Equals(other.Algorithm) { return false } 5540 if !p.Hash.Equals(other.Hash) { return false } 5541 if !p.Compression.Equals(other.Compression) { return false } 5542 return true 5543} 5544 5545func (p *BloomFilterHeader) String() string { 5546 if p == nil { 5547 return "<nil>" 5548 } 5549 return fmt.Sprintf("BloomFilterHeader(%+v)", *p) 5550} 5551 5552// Attributes: 5553// - Type: the type of the page: indicates which of the *_header fields is set * 5554// - UncompressedPageSize: Uncompressed page size in bytes (not including this header) * 5555// - CompressedPageSize: Compressed (and potentially encrypted) page size in bytes, not including this header * 5556// - Crc: The 32bit CRC for the page, to be be calculated as follows: 5557// - Using the standard CRC32 algorithm 5558// - On the data only, i.e. this header should not be included. 'Data' 5559// hereby refers to the concatenation of the repetition levels, the 5560// definition levels and the column value, in this exact order. 5561// - On the encoded versions of the repetition levels, definition levels and 5562// column values 5563// - On the compressed versions of the repetition levels, definition levels 5564// and column values where possible; 5565// - For v1 data pages, the repetition levels, definition levels and column 5566// values are always compressed together. If a compression scheme is 5567// specified, the CRC shall be calculated on the compressed version of 5568// this concatenation. If no compression scheme is specified, the CRC 5569// shall be calculated on the uncompressed version of this concatenation. 5570// - For v2 data pages, the repetition levels and definition levels are 5571// handled separately from the data and are never compressed (only 5572// encoded). If a compression scheme is specified, the CRC shall be 5573// calculated on the concatenation of the uncompressed repetition levels, 5574// uncompressed definition levels and the compressed column values. 5575// If no compression scheme is specified, the CRC shall be calculated on 5576// the uncompressed concatenation. 5577// If enabled, this allows for disabling checksumming in HDFS if only a few 5578// pages need to be read. 5579// 5580// - DataPageHeader 5581// - IndexPageHeader 5582// - DictionaryPageHeader 5583// - DataPageHeaderV2 5584type PageHeader struct { 5585 Type PageType `thrift:"type,1,required" db:"type" json:"type"` 5586 UncompressedPageSize int32 `thrift:"uncompressed_page_size,2,required" db:"uncompressed_page_size" json:"uncompressed_page_size"` 5587 CompressedPageSize int32 `thrift:"compressed_page_size,3,required" db:"compressed_page_size" json:"compressed_page_size"` 5588 Crc *int32 `thrift:"crc,4" db:"crc" json:"crc,omitempty"` 5589 DataPageHeader *DataPageHeader `thrift:"data_page_header,5" db:"data_page_header" json:"data_page_header,omitempty"` 5590 IndexPageHeader *IndexPageHeader `thrift:"index_page_header,6" db:"index_page_header" json:"index_page_header,omitempty"` 5591 DictionaryPageHeader *DictionaryPageHeader `thrift:"dictionary_page_header,7" db:"dictionary_page_header" json:"dictionary_page_header,omitempty"` 5592 DataPageHeaderV2 *DataPageHeaderV2 `thrift:"data_page_header_v2,8" db:"data_page_header_v2" json:"data_page_header_v2,omitempty"` 5593} 5594 5595func NewPageHeader() *PageHeader { 5596 return &PageHeader{} 5597} 5598 5599 5600func (p *PageHeader) GetType() PageType { 5601 return p.Type 5602} 5603 5604func (p *PageHeader) GetUncompressedPageSize() int32 { 5605 return p.UncompressedPageSize 5606} 5607 5608func (p *PageHeader) GetCompressedPageSize() int32 { 5609 return p.CompressedPageSize 5610} 5611var PageHeader_Crc_DEFAULT int32 5612func (p *PageHeader) GetCrc() int32 { 5613 if !p.IsSetCrc() { 5614 return PageHeader_Crc_DEFAULT 5615 } 5616return *p.Crc 5617} 5618var PageHeader_DataPageHeader_DEFAULT *DataPageHeader 5619func (p *PageHeader) GetDataPageHeader() *DataPageHeader { 5620 if !p.IsSetDataPageHeader() { 5621 return PageHeader_DataPageHeader_DEFAULT 5622 } 5623return p.DataPageHeader 5624} 5625var PageHeader_IndexPageHeader_DEFAULT *IndexPageHeader 5626func (p *PageHeader) GetIndexPageHeader() *IndexPageHeader { 5627 if !p.IsSetIndexPageHeader() { 5628 return PageHeader_IndexPageHeader_DEFAULT 5629 } 5630return p.IndexPageHeader 5631} 5632var PageHeader_DictionaryPageHeader_DEFAULT *DictionaryPageHeader 5633func (p *PageHeader) GetDictionaryPageHeader() *DictionaryPageHeader { 5634 if !p.IsSetDictionaryPageHeader() { 5635 return PageHeader_DictionaryPageHeader_DEFAULT 5636 } 5637return p.DictionaryPageHeader 5638} 5639var PageHeader_DataPageHeaderV2_DEFAULT *DataPageHeaderV2 5640func (p *PageHeader) GetDataPageHeaderV2() *DataPageHeaderV2 { 5641 if !p.IsSetDataPageHeaderV2() { 5642 return PageHeader_DataPageHeaderV2_DEFAULT 5643 } 5644return p.DataPageHeaderV2 5645} 5646func (p *PageHeader) IsSetCrc() bool { 5647 return p.Crc != nil 5648} 5649 5650func (p *PageHeader) IsSetDataPageHeader() bool { 5651 return p.DataPageHeader != nil 5652} 5653 5654func (p *PageHeader) IsSetIndexPageHeader() bool { 5655 return p.IndexPageHeader != nil 5656} 5657 5658func (p *PageHeader) IsSetDictionaryPageHeader() bool { 5659 return p.DictionaryPageHeader != nil 5660} 5661 5662func (p *PageHeader) IsSetDataPageHeaderV2() bool { 5663 return p.DataPageHeaderV2 != nil 5664} 5665 5666func (p *PageHeader) Read(ctx context.Context, iprot thrift.TProtocol) error { 5667 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5668 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5669 } 5670 5671 var issetType bool = false; 5672 var issetUncompressedPageSize bool = false; 5673 var issetCompressedPageSize bool = false; 5674 5675 for { 5676 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5677 if err != nil { 5678 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5679 } 5680 if fieldTypeId == thrift.STOP { break; } 5681 switch fieldId { 5682 case 1: 5683 if fieldTypeId == thrift.I32 { 5684 if err := p.ReadField1(ctx, iprot); err != nil { 5685 return err 5686 } 5687 issetType = true 5688 } else { 5689 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5690 return err 5691 } 5692 } 5693 case 2: 5694 if fieldTypeId == thrift.I32 { 5695 if err := p.ReadField2(ctx, iprot); err != nil { 5696 return err 5697 } 5698 issetUncompressedPageSize = true 5699 } else { 5700 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5701 return err 5702 } 5703 } 5704 case 3: 5705 if fieldTypeId == thrift.I32 { 5706 if err := p.ReadField3(ctx, iprot); err != nil { 5707 return err 5708 } 5709 issetCompressedPageSize = true 5710 } else { 5711 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5712 return err 5713 } 5714 } 5715 case 4: 5716 if fieldTypeId == thrift.I32 { 5717 if err := p.ReadField4(ctx, iprot); err != nil { 5718 return err 5719 } 5720 } else { 5721 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5722 return err 5723 } 5724 } 5725 case 5: 5726 if fieldTypeId == thrift.STRUCT { 5727 if err := p.ReadField5(ctx, iprot); err != nil { 5728 return err 5729 } 5730 } else { 5731 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5732 return err 5733 } 5734 } 5735 case 6: 5736 if fieldTypeId == thrift.STRUCT { 5737 if err := p.ReadField6(ctx, iprot); err != nil { 5738 return err 5739 } 5740 } else { 5741 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5742 return err 5743 } 5744 } 5745 case 7: 5746 if fieldTypeId == thrift.STRUCT { 5747 if err := p.ReadField7(ctx, iprot); err != nil { 5748 return err 5749 } 5750 } else { 5751 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5752 return err 5753 } 5754 } 5755 case 8: 5756 if fieldTypeId == thrift.STRUCT { 5757 if err := p.ReadField8(ctx, iprot); err != nil { 5758 return err 5759 } 5760 } else { 5761 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5762 return err 5763 } 5764 } 5765 default: 5766 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5767 return err 5768 } 5769 } 5770 if err := iprot.ReadFieldEnd(ctx); err != nil { 5771 return err 5772 } 5773 } 5774 if err := iprot.ReadStructEnd(ctx); err != nil { 5775 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5776 } 5777 if !issetType{ 5778 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")); 5779 } 5780 if !issetUncompressedPageSize{ 5781 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field UncompressedPageSize is not set")); 5782 } 5783 if !issetCompressedPageSize{ 5784 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field CompressedPageSize is not set")); 5785 } 5786 return nil 5787} 5788 5789func (p *PageHeader) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 5790 if v, err := iprot.ReadI32(ctx); err != nil { 5791 return thrift.PrependError("error reading field 1: ", err) 5792} else { 5793 temp := PageType(v) 5794 p.Type = temp 5795} 5796 return nil 5797} 5798 5799func (p *PageHeader) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 5800 if v, err := iprot.ReadI32(ctx); err != nil { 5801 return thrift.PrependError("error reading field 2: ", err) 5802} else { 5803 p.UncompressedPageSize = v 5804} 5805 return nil 5806} 5807 5808func (p *PageHeader) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 5809 if v, err := iprot.ReadI32(ctx); err != nil { 5810 return thrift.PrependError("error reading field 3: ", err) 5811} else { 5812 p.CompressedPageSize = v 5813} 5814 return nil 5815} 5816 5817func (p *PageHeader) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 5818 if v, err := iprot.ReadI32(ctx); err != nil { 5819 return thrift.PrependError("error reading field 4: ", err) 5820} else { 5821 p.Crc = &v 5822} 5823 return nil 5824} 5825 5826func (p *PageHeader) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 5827 p.DataPageHeader = &DataPageHeader{} 5828 if err := p.DataPageHeader.Read(ctx, iprot); err != nil { 5829 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DataPageHeader), err) 5830 } 5831 return nil 5832} 5833 5834func (p *PageHeader) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 5835 p.IndexPageHeader = &IndexPageHeader{} 5836 if err := p.IndexPageHeader.Read(ctx, iprot); err != nil { 5837 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.IndexPageHeader), err) 5838 } 5839 return nil 5840} 5841 5842func (p *PageHeader) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 5843 p.DictionaryPageHeader = &DictionaryPageHeader{} 5844 if err := p.DictionaryPageHeader.Read(ctx, iprot); err != nil { 5845 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DictionaryPageHeader), err) 5846 } 5847 return nil 5848} 5849 5850func (p *PageHeader) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 5851 p.DataPageHeaderV2 = &DataPageHeaderV2{ 5852 IsCompressed: true, 5853} 5854 if err := p.DataPageHeaderV2.Read(ctx, iprot); err != nil { 5855 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DataPageHeaderV2), err) 5856 } 5857 return nil 5858} 5859 5860func (p *PageHeader) Write(ctx context.Context, oprot thrift.TProtocol) error { 5861 if err := oprot.WriteStructBegin(ctx, "PageHeader"); err != nil { 5862 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 5863 if p != nil { 5864 if err := p.writeField1(ctx, oprot); err != nil { return err } 5865 if err := p.writeField2(ctx, oprot); err != nil { return err } 5866 if err := p.writeField3(ctx, oprot); err != nil { return err } 5867 if err := p.writeField4(ctx, oprot); err != nil { return err } 5868 if err := p.writeField5(ctx, oprot); err != nil { return err } 5869 if err := p.writeField6(ctx, oprot); err != nil { return err } 5870 if err := p.writeField7(ctx, oprot); err != nil { return err } 5871 if err := p.writeField8(ctx, oprot); err != nil { return err } 5872 } 5873 if err := oprot.WriteFieldStop(ctx); err != nil { 5874 return thrift.PrependError("write field stop error: ", err) } 5875 if err := oprot.WriteStructEnd(ctx); err != nil { 5876 return thrift.PrependError("write struct stop error: ", err) } 5877 return nil 5878} 5879 5880func (p *PageHeader) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 5881 if err := oprot.WriteFieldBegin(ctx, "type", thrift.I32, 1); err != nil { 5882 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:type: ", p), err) } 5883 if err := oprot.WriteI32(ctx, int32(p.Type)); err != nil { 5884 return thrift.PrependError(fmt.Sprintf("%T.type (1) field write error: ", p), err) } 5885 if err := oprot.WriteFieldEnd(ctx); err != nil { 5886 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:type: ", p), err) } 5887 return err 5888} 5889 5890func (p *PageHeader) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 5891 if err := oprot.WriteFieldBegin(ctx, "uncompressed_page_size", thrift.I32, 2); err != nil { 5892 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:uncompressed_page_size: ", p), err) } 5893 if err := oprot.WriteI32(ctx, int32(p.UncompressedPageSize)); err != nil { 5894 return thrift.PrependError(fmt.Sprintf("%T.uncompressed_page_size (2) field write error: ", p), err) } 5895 if err := oprot.WriteFieldEnd(ctx); err != nil { 5896 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:uncompressed_page_size: ", p), err) } 5897 return err 5898} 5899 5900func (p *PageHeader) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 5901 if err := oprot.WriteFieldBegin(ctx, "compressed_page_size", thrift.I32, 3); err != nil { 5902 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:compressed_page_size: ", p), err) } 5903 if err := oprot.WriteI32(ctx, int32(p.CompressedPageSize)); err != nil { 5904 return thrift.PrependError(fmt.Sprintf("%T.compressed_page_size (3) field write error: ", p), err) } 5905 if err := oprot.WriteFieldEnd(ctx); err != nil { 5906 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:compressed_page_size: ", p), err) } 5907 return err 5908} 5909 5910func (p *PageHeader) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 5911 if p.IsSetCrc() { 5912 if err := oprot.WriteFieldBegin(ctx, "crc", thrift.I32, 4); err != nil { 5913 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:crc: ", p), err) } 5914 if err := oprot.WriteI32(ctx, int32(*p.Crc)); err != nil { 5915 return thrift.PrependError(fmt.Sprintf("%T.crc (4) field write error: ", p), err) } 5916 if err := oprot.WriteFieldEnd(ctx); err != nil { 5917 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:crc: ", p), err) } 5918 } 5919 return err 5920} 5921 5922func (p *PageHeader) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 5923 if p.IsSetDataPageHeader() { 5924 if err := oprot.WriteFieldBegin(ctx, "data_page_header", thrift.STRUCT, 5); err != nil { 5925 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:data_page_header: ", p), err) } 5926 if err := p.DataPageHeader.Write(ctx, oprot); err != nil { 5927 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DataPageHeader), err) 5928 } 5929 if err := oprot.WriteFieldEnd(ctx); err != nil { 5930 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:data_page_header: ", p), err) } 5931 } 5932 return err 5933} 5934 5935func (p *PageHeader) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 5936 if p.IsSetIndexPageHeader() { 5937 if err := oprot.WriteFieldBegin(ctx, "index_page_header", thrift.STRUCT, 6); err != nil { 5938 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:index_page_header: ", p), err) } 5939 if err := p.IndexPageHeader.Write(ctx, oprot); err != nil { 5940 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.IndexPageHeader), err) 5941 } 5942 if err := oprot.WriteFieldEnd(ctx); err != nil { 5943 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:index_page_header: ", p), err) } 5944 } 5945 return err 5946} 5947 5948func (p *PageHeader) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 5949 if p.IsSetDictionaryPageHeader() { 5950 if err := oprot.WriteFieldBegin(ctx, "dictionary_page_header", thrift.STRUCT, 7); err != nil { 5951 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:dictionary_page_header: ", p), err) } 5952 if err := p.DictionaryPageHeader.Write(ctx, oprot); err != nil { 5953 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DictionaryPageHeader), err) 5954 } 5955 if err := oprot.WriteFieldEnd(ctx); err != nil { 5956 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:dictionary_page_header: ", p), err) } 5957 } 5958 return err 5959} 5960 5961func (p *PageHeader) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 5962 if p.IsSetDataPageHeaderV2() { 5963 if err := oprot.WriteFieldBegin(ctx, "data_page_header_v2", thrift.STRUCT, 8); err != nil { 5964 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:data_page_header_v2: ", p), err) } 5965 if err := p.DataPageHeaderV2.Write(ctx, oprot); err != nil { 5966 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DataPageHeaderV2), err) 5967 } 5968 if err := oprot.WriteFieldEnd(ctx); err != nil { 5969 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:data_page_header_v2: ", p), err) } 5970 } 5971 return err 5972} 5973 5974func (p *PageHeader) Equals(other *PageHeader) bool { 5975 if p == other { 5976 return true 5977 } else if p == nil || other == nil { 5978 return false 5979 } 5980 if p.Type != other.Type { return false } 5981 if p.UncompressedPageSize != other.UncompressedPageSize { return false } 5982 if p.CompressedPageSize != other.CompressedPageSize { return false } 5983 if p.Crc != other.Crc { 5984 if p.Crc == nil || other.Crc == nil { 5985 return false 5986 } 5987 if (*p.Crc) != (*other.Crc) { return false } 5988 } 5989 if !p.DataPageHeader.Equals(other.DataPageHeader) { return false } 5990 if !p.IndexPageHeader.Equals(other.IndexPageHeader) { return false } 5991 if !p.DictionaryPageHeader.Equals(other.DictionaryPageHeader) { return false } 5992 if !p.DataPageHeaderV2.Equals(other.DataPageHeaderV2) { return false } 5993 return true 5994} 5995 5996func (p *PageHeader) String() string { 5997 if p == nil { 5998 return "<nil>" 5999 } 6000 return fmt.Sprintf("PageHeader(%+v)", *p) 6001} 6002 6003// Wrapper struct to store key values 6004// 6005// Attributes: 6006// - Key 6007// - Value 6008type KeyValue struct { 6009 Key string `thrift:"key,1,required" db:"key" json:"key"` 6010 Value *string `thrift:"value,2" db:"value" json:"value,omitempty"` 6011} 6012 6013func NewKeyValue() *KeyValue { 6014 return &KeyValue{} 6015} 6016 6017 6018func (p *KeyValue) GetKey() string { 6019 return p.Key 6020} 6021var KeyValue_Value_DEFAULT string 6022func (p *KeyValue) GetValue() string { 6023 if !p.IsSetValue() { 6024 return KeyValue_Value_DEFAULT 6025 } 6026return *p.Value 6027} 6028func (p *KeyValue) IsSetValue() bool { 6029 return p.Value != nil 6030} 6031 6032func (p *KeyValue) Read(ctx context.Context, iprot thrift.TProtocol) error { 6033 if _, err := iprot.ReadStructBegin(ctx); err != nil { 6034 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 6035 } 6036 6037 var issetKey bool = false; 6038 6039 for { 6040 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 6041 if err != nil { 6042 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 6043 } 6044 if fieldTypeId == thrift.STOP { break; } 6045 switch fieldId { 6046 case 1: 6047 if fieldTypeId == thrift.STRING { 6048 if err := p.ReadField1(ctx, iprot); err != nil { 6049 return err 6050 } 6051 issetKey = true 6052 } else { 6053 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6054 return err 6055 } 6056 } 6057 case 2: 6058 if fieldTypeId == thrift.STRING { 6059 if err := p.ReadField2(ctx, iprot); err != nil { 6060 return err 6061 } 6062 } else { 6063 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6064 return err 6065 } 6066 } 6067 default: 6068 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6069 return err 6070 } 6071 } 6072 if err := iprot.ReadFieldEnd(ctx); err != nil { 6073 return err 6074 } 6075 } 6076 if err := iprot.ReadStructEnd(ctx); err != nil { 6077 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 6078 } 6079 if !issetKey{ 6080 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Key is not set")); 6081 } 6082 return nil 6083} 6084 6085func (p *KeyValue) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 6086 if v, err := iprot.ReadString(ctx); err != nil { 6087 return thrift.PrependError("error reading field 1: ", err) 6088} else { 6089 p.Key = v 6090} 6091 return nil 6092} 6093 6094func (p *KeyValue) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 6095 if v, err := iprot.ReadString(ctx); err != nil { 6096 return thrift.PrependError("error reading field 2: ", err) 6097} else { 6098 p.Value = &v 6099} 6100 return nil 6101} 6102 6103func (p *KeyValue) Write(ctx context.Context, oprot thrift.TProtocol) error { 6104 if err := oprot.WriteStructBegin(ctx, "KeyValue"); err != nil { 6105 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 6106 if p != nil { 6107 if err := p.writeField1(ctx, oprot); err != nil { return err } 6108 if err := p.writeField2(ctx, oprot); err != nil { return err } 6109 } 6110 if err := oprot.WriteFieldStop(ctx); err != nil { 6111 return thrift.PrependError("write field stop error: ", err) } 6112 if err := oprot.WriteStructEnd(ctx); err != nil { 6113 return thrift.PrependError("write struct stop error: ", err) } 6114 return nil 6115} 6116 6117func (p *KeyValue) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 6118 if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil { 6119 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) } 6120 if err := oprot.WriteString(ctx, string(p.Key)); err != nil { 6121 return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) } 6122 if err := oprot.WriteFieldEnd(ctx); err != nil { 6123 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) } 6124 return err 6125} 6126 6127func (p *KeyValue) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 6128 if p.IsSetValue() { 6129 if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil { 6130 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) } 6131 if err := oprot.WriteString(ctx, string(*p.Value)); err != nil { 6132 return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) } 6133 if err := oprot.WriteFieldEnd(ctx); err != nil { 6134 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) } 6135 } 6136 return err 6137} 6138 6139func (p *KeyValue) Equals(other *KeyValue) bool { 6140 if p == other { 6141 return true 6142 } else if p == nil || other == nil { 6143 return false 6144 } 6145 if p.Key != other.Key { return false } 6146 if p.Value != other.Value { 6147 if p.Value == nil || other.Value == nil { 6148 return false 6149 } 6150 if (*p.Value) != (*other.Value) { return false } 6151 } 6152 return true 6153} 6154 6155func (p *KeyValue) String() string { 6156 if p == nil { 6157 return "<nil>" 6158 } 6159 return fmt.Sprintf("KeyValue(%+v)", *p) 6160} 6161 6162// Wrapper struct to specify sort order 6163// 6164// Attributes: 6165// - ColumnIdx: The column index (in this row group) * 6166// - Descending: If true, indicates this column is sorted in descending order. * 6167// - NullsFirst: If true, nulls will come before non-null values, otherwise, 6168// nulls go at the end. 6169type SortingColumn struct { 6170 ColumnIdx int32 `thrift:"column_idx,1,required" db:"column_idx" json:"column_idx"` 6171 Descending bool `thrift:"descending,2,required" db:"descending" json:"descending"` 6172 NullsFirst bool `thrift:"nulls_first,3,required" db:"nulls_first" json:"nulls_first"` 6173} 6174 6175func NewSortingColumn() *SortingColumn { 6176 return &SortingColumn{} 6177} 6178 6179 6180func (p *SortingColumn) GetColumnIdx() int32 { 6181 return p.ColumnIdx 6182} 6183 6184func (p *SortingColumn) GetDescending() bool { 6185 return p.Descending 6186} 6187 6188func (p *SortingColumn) GetNullsFirst() bool { 6189 return p.NullsFirst 6190} 6191func (p *SortingColumn) Read(ctx context.Context, iprot thrift.TProtocol) error { 6192 if _, err := iprot.ReadStructBegin(ctx); err != nil { 6193 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 6194 } 6195 6196 var issetColumnIdx bool = false; 6197 var issetDescending bool = false; 6198 var issetNullsFirst bool = false; 6199 6200 for { 6201 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 6202 if err != nil { 6203 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 6204 } 6205 if fieldTypeId == thrift.STOP { break; } 6206 switch fieldId { 6207 case 1: 6208 if fieldTypeId == thrift.I32 { 6209 if err := p.ReadField1(ctx, iprot); err != nil { 6210 return err 6211 } 6212 issetColumnIdx = true 6213 } else { 6214 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6215 return err 6216 } 6217 } 6218 case 2: 6219 if fieldTypeId == thrift.BOOL { 6220 if err := p.ReadField2(ctx, iprot); err != nil { 6221 return err 6222 } 6223 issetDescending = true 6224 } else { 6225 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6226 return err 6227 } 6228 } 6229 case 3: 6230 if fieldTypeId == thrift.BOOL { 6231 if err := p.ReadField3(ctx, iprot); err != nil { 6232 return err 6233 } 6234 issetNullsFirst = true 6235 } else { 6236 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6237 return err 6238 } 6239 } 6240 default: 6241 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6242 return err 6243 } 6244 } 6245 if err := iprot.ReadFieldEnd(ctx); err != nil { 6246 return err 6247 } 6248 } 6249 if err := iprot.ReadStructEnd(ctx); err != nil { 6250 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 6251 } 6252 if !issetColumnIdx{ 6253 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ColumnIdx is not set")); 6254 } 6255 if !issetDescending{ 6256 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Descending is not set")); 6257 } 6258 if !issetNullsFirst{ 6259 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NullsFirst is not set")); 6260 } 6261 return nil 6262} 6263 6264func (p *SortingColumn) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 6265 if v, err := iprot.ReadI32(ctx); err != nil { 6266 return thrift.PrependError("error reading field 1: ", err) 6267} else { 6268 p.ColumnIdx = v 6269} 6270 return nil 6271} 6272 6273func (p *SortingColumn) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 6274 if v, err := iprot.ReadBool(ctx); err != nil { 6275 return thrift.PrependError("error reading field 2: ", err) 6276} else { 6277 p.Descending = v 6278} 6279 return nil 6280} 6281 6282func (p *SortingColumn) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 6283 if v, err := iprot.ReadBool(ctx); err != nil { 6284 return thrift.PrependError("error reading field 3: ", err) 6285} else { 6286 p.NullsFirst = v 6287} 6288 return nil 6289} 6290 6291func (p *SortingColumn) Write(ctx context.Context, oprot thrift.TProtocol) error { 6292 if err := oprot.WriteStructBegin(ctx, "SortingColumn"); err != nil { 6293 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 6294 if p != nil { 6295 if err := p.writeField1(ctx, oprot); err != nil { return err } 6296 if err := p.writeField2(ctx, oprot); err != nil { return err } 6297 if err := p.writeField3(ctx, oprot); err != nil { return err } 6298 } 6299 if err := oprot.WriteFieldStop(ctx); err != nil { 6300 return thrift.PrependError("write field stop error: ", err) } 6301 if err := oprot.WriteStructEnd(ctx); err != nil { 6302 return thrift.PrependError("write struct stop error: ", err) } 6303 return nil 6304} 6305 6306func (p *SortingColumn) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 6307 if err := oprot.WriteFieldBegin(ctx, "column_idx", thrift.I32, 1); err != nil { 6308 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:column_idx: ", p), err) } 6309 if err := oprot.WriteI32(ctx, int32(p.ColumnIdx)); err != nil { 6310 return thrift.PrependError(fmt.Sprintf("%T.column_idx (1) field write error: ", p), err) } 6311 if err := oprot.WriteFieldEnd(ctx); err != nil { 6312 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:column_idx: ", p), err) } 6313 return err 6314} 6315 6316func (p *SortingColumn) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 6317 if err := oprot.WriteFieldBegin(ctx, "descending", thrift.BOOL, 2); err != nil { 6318 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:descending: ", p), err) } 6319 if err := oprot.WriteBool(ctx, bool(p.Descending)); err != nil { 6320 return thrift.PrependError(fmt.Sprintf("%T.descending (2) field write error: ", p), err) } 6321 if err := oprot.WriteFieldEnd(ctx); err != nil { 6322 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:descending: ", p), err) } 6323 return err 6324} 6325 6326func (p *SortingColumn) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 6327 if err := oprot.WriteFieldBegin(ctx, "nulls_first", thrift.BOOL, 3); err != nil { 6328 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:nulls_first: ", p), err) } 6329 if err := oprot.WriteBool(ctx, bool(p.NullsFirst)); err != nil { 6330 return thrift.PrependError(fmt.Sprintf("%T.nulls_first (3) field write error: ", p), err) } 6331 if err := oprot.WriteFieldEnd(ctx); err != nil { 6332 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:nulls_first: ", p), err) } 6333 return err 6334} 6335 6336func (p *SortingColumn) Equals(other *SortingColumn) bool { 6337 if p == other { 6338 return true 6339 } else if p == nil || other == nil { 6340 return false 6341 } 6342 if p.ColumnIdx != other.ColumnIdx { return false } 6343 if p.Descending != other.Descending { return false } 6344 if p.NullsFirst != other.NullsFirst { return false } 6345 return true 6346} 6347 6348func (p *SortingColumn) String() string { 6349 if p == nil { 6350 return "<nil>" 6351 } 6352 return fmt.Sprintf("SortingColumn(%+v)", *p) 6353} 6354 6355// statistics of a given page type and encoding 6356// 6357// Attributes: 6358// - PageType: the page type (data/dic/...) * 6359// - Encoding: encoding of the page * 6360// - Count: number of pages of this type with this encoding * 6361type PageEncodingStats struct { 6362 PageType PageType `thrift:"page_type,1,required" db:"page_type" json:"page_type"` 6363 Encoding Encoding `thrift:"encoding,2,required" db:"encoding" json:"encoding"` 6364 Count int32 `thrift:"count,3,required" db:"count" json:"count"` 6365} 6366 6367func NewPageEncodingStats() *PageEncodingStats { 6368 return &PageEncodingStats{} 6369} 6370 6371 6372func (p *PageEncodingStats) GetPageType() PageType { 6373 return p.PageType 6374} 6375 6376func (p *PageEncodingStats) GetEncoding() Encoding { 6377 return p.Encoding 6378} 6379 6380func (p *PageEncodingStats) GetCount() int32 { 6381 return p.Count 6382} 6383func (p *PageEncodingStats) Read(ctx context.Context, iprot thrift.TProtocol) error { 6384 if _, err := iprot.ReadStructBegin(ctx); err != nil { 6385 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 6386 } 6387 6388 var issetPageType bool = false; 6389 var issetEncoding bool = false; 6390 var issetCount bool = false; 6391 6392 for { 6393 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 6394 if err != nil { 6395 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 6396 } 6397 if fieldTypeId == thrift.STOP { break; } 6398 switch fieldId { 6399 case 1: 6400 if fieldTypeId == thrift.I32 { 6401 if err := p.ReadField1(ctx, iprot); err != nil { 6402 return err 6403 } 6404 issetPageType = true 6405 } else { 6406 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6407 return err 6408 } 6409 } 6410 case 2: 6411 if fieldTypeId == thrift.I32 { 6412 if err := p.ReadField2(ctx, iprot); err != nil { 6413 return err 6414 } 6415 issetEncoding = true 6416 } else { 6417 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6418 return err 6419 } 6420 } 6421 case 3: 6422 if fieldTypeId == thrift.I32 { 6423 if err := p.ReadField3(ctx, iprot); err != nil { 6424 return err 6425 } 6426 issetCount = true 6427 } else { 6428 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6429 return err 6430 } 6431 } 6432 default: 6433 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6434 return err 6435 } 6436 } 6437 if err := iprot.ReadFieldEnd(ctx); err != nil { 6438 return err 6439 } 6440 } 6441 if err := iprot.ReadStructEnd(ctx); err != nil { 6442 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 6443 } 6444 if !issetPageType{ 6445 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PageType is not set")); 6446 } 6447 if !issetEncoding{ 6448 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encoding is not set")); 6449 } 6450 if !issetCount{ 6451 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Count is not set")); 6452 } 6453 return nil 6454} 6455 6456func (p *PageEncodingStats) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 6457 if v, err := iprot.ReadI32(ctx); err != nil { 6458 return thrift.PrependError("error reading field 1: ", err) 6459} else { 6460 temp := PageType(v) 6461 p.PageType = temp 6462} 6463 return nil 6464} 6465 6466func (p *PageEncodingStats) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 6467 if v, err := iprot.ReadI32(ctx); err != nil { 6468 return thrift.PrependError("error reading field 2: ", err) 6469} else { 6470 temp := Encoding(v) 6471 p.Encoding = temp 6472} 6473 return nil 6474} 6475 6476func (p *PageEncodingStats) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 6477 if v, err := iprot.ReadI32(ctx); err != nil { 6478 return thrift.PrependError("error reading field 3: ", err) 6479} else { 6480 p.Count = v 6481} 6482 return nil 6483} 6484 6485func (p *PageEncodingStats) Write(ctx context.Context, oprot thrift.TProtocol) error { 6486 if err := oprot.WriteStructBegin(ctx, "PageEncodingStats"); err != nil { 6487 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 6488 if p != nil { 6489 if err := p.writeField1(ctx, oprot); err != nil { return err } 6490 if err := p.writeField2(ctx, oprot); err != nil { return err } 6491 if err := p.writeField3(ctx, oprot); err != nil { return err } 6492 } 6493 if err := oprot.WriteFieldStop(ctx); err != nil { 6494 return thrift.PrependError("write field stop error: ", err) } 6495 if err := oprot.WriteStructEnd(ctx); err != nil { 6496 return thrift.PrependError("write struct stop error: ", err) } 6497 return nil 6498} 6499 6500func (p *PageEncodingStats) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 6501 if err := oprot.WriteFieldBegin(ctx, "page_type", thrift.I32, 1); err != nil { 6502 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:page_type: ", p), err) } 6503 if err := oprot.WriteI32(ctx, int32(p.PageType)); err != nil { 6504 return thrift.PrependError(fmt.Sprintf("%T.page_type (1) field write error: ", p), err) } 6505 if err := oprot.WriteFieldEnd(ctx); err != nil { 6506 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:page_type: ", p), err) } 6507 return err 6508} 6509 6510func (p *PageEncodingStats) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 6511 if err := oprot.WriteFieldBegin(ctx, "encoding", thrift.I32, 2); err != nil { 6512 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:encoding: ", p), err) } 6513 if err := oprot.WriteI32(ctx, int32(p.Encoding)); err != nil { 6514 return thrift.PrependError(fmt.Sprintf("%T.encoding (2) field write error: ", p), err) } 6515 if err := oprot.WriteFieldEnd(ctx); err != nil { 6516 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:encoding: ", p), err) } 6517 return err 6518} 6519 6520func (p *PageEncodingStats) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 6521 if err := oprot.WriteFieldBegin(ctx, "count", thrift.I32, 3); err != nil { 6522 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:count: ", p), err) } 6523 if err := oprot.WriteI32(ctx, int32(p.Count)); err != nil { 6524 return thrift.PrependError(fmt.Sprintf("%T.count (3) field write error: ", p), err) } 6525 if err := oprot.WriteFieldEnd(ctx); err != nil { 6526 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:count: ", p), err) } 6527 return err 6528} 6529 6530func (p *PageEncodingStats) Equals(other *PageEncodingStats) bool { 6531 if p == other { 6532 return true 6533 } else if p == nil || other == nil { 6534 return false 6535 } 6536 if p.PageType != other.PageType { return false } 6537 if p.Encoding != other.Encoding { return false } 6538 if p.Count != other.Count { return false } 6539 return true 6540} 6541 6542func (p *PageEncodingStats) String() string { 6543 if p == nil { 6544 return "<nil>" 6545 } 6546 return fmt.Sprintf("PageEncodingStats(%+v)", *p) 6547} 6548 6549// Description for column metadata 6550// 6551// Attributes: 6552// - Type: Type of this column * 6553// - Encodings: Set of all encodings used for this column. The purpose is to validate 6554// whether we can decode those pages. * 6555// - PathInSchema: Path in schema * 6556// - Codec: Compression codec * 6557// - NumValues: Number of values in this column * 6558// - TotalUncompressedSize: total byte size of all uncompressed pages in this column chunk (including the headers) * 6559// - TotalCompressedSize: total byte size of all compressed, and potentially encrypted, pages 6560// in this column chunk (including the headers) * 6561// - KeyValueMetadata: Optional key/value metadata * 6562// - DataPageOffset: Byte offset from beginning of file to first data page * 6563// - IndexPageOffset: Byte offset from beginning of file to root index page * 6564// - DictionaryPageOffset: Byte offset from the beginning of file to first (only) dictionary page * 6565// - Statistics: optional statistics for this column chunk 6566// - EncodingStats: Set of all encodings used for pages in this column chunk. 6567// This information can be used to determine if all data pages are 6568// dictionary encoded for example * 6569// - BloomFilterOffset: Byte offset from beginning of file to Bloom filter data. * 6570type ColumnMetaData struct { 6571 Type Type `thrift:"type,1,required" db:"type" json:"type"` 6572 Encodings []Encoding `thrift:"encodings,2,required" db:"encodings" json:"encodings"` 6573 PathInSchema []string `thrift:"path_in_schema,3,required" db:"path_in_schema" json:"path_in_schema"` 6574 Codec CompressionCodec `thrift:"codec,4,required" db:"codec" json:"codec"` 6575 NumValues int64 `thrift:"num_values,5,required" db:"num_values" json:"num_values"` 6576 TotalUncompressedSize int64 `thrift:"total_uncompressed_size,6,required" db:"total_uncompressed_size" json:"total_uncompressed_size"` 6577 TotalCompressedSize int64 `thrift:"total_compressed_size,7,required" db:"total_compressed_size" json:"total_compressed_size"` 6578 KeyValueMetadata []*KeyValue `thrift:"key_value_metadata,8" db:"key_value_metadata" json:"key_value_metadata,omitempty"` 6579 DataPageOffset int64 `thrift:"data_page_offset,9,required" db:"data_page_offset" json:"data_page_offset"` 6580 IndexPageOffset *int64 `thrift:"index_page_offset,10" db:"index_page_offset" json:"index_page_offset,omitempty"` 6581 DictionaryPageOffset *int64 `thrift:"dictionary_page_offset,11" db:"dictionary_page_offset" json:"dictionary_page_offset,omitempty"` 6582 Statistics *Statistics `thrift:"statistics,12" db:"statistics" json:"statistics,omitempty"` 6583 EncodingStats []*PageEncodingStats `thrift:"encoding_stats,13" db:"encoding_stats" json:"encoding_stats,omitempty"` 6584 BloomFilterOffset *int64 `thrift:"bloom_filter_offset,14" db:"bloom_filter_offset" json:"bloom_filter_offset,omitempty"` 6585} 6586 6587func NewColumnMetaData() *ColumnMetaData { 6588 return &ColumnMetaData{} 6589} 6590 6591 6592func (p *ColumnMetaData) GetType() Type { 6593 return p.Type 6594} 6595 6596func (p *ColumnMetaData) GetEncodings() []Encoding { 6597 return p.Encodings 6598} 6599 6600func (p *ColumnMetaData) GetPathInSchema() []string { 6601 return p.PathInSchema 6602} 6603 6604func (p *ColumnMetaData) GetCodec() CompressionCodec { 6605 return p.Codec 6606} 6607 6608func (p *ColumnMetaData) GetNumValues() int64 { 6609 return p.NumValues 6610} 6611 6612func (p *ColumnMetaData) GetTotalUncompressedSize() int64 { 6613 return p.TotalUncompressedSize 6614} 6615 6616func (p *ColumnMetaData) GetTotalCompressedSize() int64 { 6617 return p.TotalCompressedSize 6618} 6619var ColumnMetaData_KeyValueMetadata_DEFAULT []*KeyValue 6620 6621func (p *ColumnMetaData) GetKeyValueMetadata() []*KeyValue { 6622 return p.KeyValueMetadata 6623} 6624 6625func (p *ColumnMetaData) GetDataPageOffset() int64 { 6626 return p.DataPageOffset 6627} 6628var ColumnMetaData_IndexPageOffset_DEFAULT int64 6629func (p *ColumnMetaData) GetIndexPageOffset() int64 { 6630 if !p.IsSetIndexPageOffset() { 6631 return ColumnMetaData_IndexPageOffset_DEFAULT 6632 } 6633return *p.IndexPageOffset 6634} 6635var ColumnMetaData_DictionaryPageOffset_DEFAULT int64 6636func (p *ColumnMetaData) GetDictionaryPageOffset() int64 { 6637 if !p.IsSetDictionaryPageOffset() { 6638 return ColumnMetaData_DictionaryPageOffset_DEFAULT 6639 } 6640return *p.DictionaryPageOffset 6641} 6642var ColumnMetaData_Statistics_DEFAULT *Statistics 6643func (p *ColumnMetaData) GetStatistics() *Statistics { 6644 if !p.IsSetStatistics() { 6645 return ColumnMetaData_Statistics_DEFAULT 6646 } 6647return p.Statistics 6648} 6649var ColumnMetaData_EncodingStats_DEFAULT []*PageEncodingStats 6650 6651func (p *ColumnMetaData) GetEncodingStats() []*PageEncodingStats { 6652 return p.EncodingStats 6653} 6654var ColumnMetaData_BloomFilterOffset_DEFAULT int64 6655func (p *ColumnMetaData) GetBloomFilterOffset() int64 { 6656 if !p.IsSetBloomFilterOffset() { 6657 return ColumnMetaData_BloomFilterOffset_DEFAULT 6658 } 6659return *p.BloomFilterOffset 6660} 6661func (p *ColumnMetaData) IsSetKeyValueMetadata() bool { 6662 return p.KeyValueMetadata != nil 6663} 6664 6665func (p *ColumnMetaData) IsSetIndexPageOffset() bool { 6666 return p.IndexPageOffset != nil 6667} 6668 6669func (p *ColumnMetaData) IsSetDictionaryPageOffset() bool { 6670 return p.DictionaryPageOffset != nil 6671} 6672 6673func (p *ColumnMetaData) IsSetStatistics() bool { 6674 return p.Statistics != nil 6675} 6676 6677func (p *ColumnMetaData) IsSetEncodingStats() bool { 6678 return p.EncodingStats != nil 6679} 6680 6681func (p *ColumnMetaData) IsSetBloomFilterOffset() bool { 6682 return p.BloomFilterOffset != nil 6683} 6684 6685func (p *ColumnMetaData) Read(ctx context.Context, iprot thrift.TProtocol) error { 6686 if _, err := iprot.ReadStructBegin(ctx); err != nil { 6687 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 6688 } 6689 6690 var issetType bool = false; 6691 var issetEncodings bool = false; 6692 var issetPathInSchema bool = false; 6693 var issetCodec bool = false; 6694 var issetNumValues bool = false; 6695 var issetTotalUncompressedSize bool = false; 6696 var issetTotalCompressedSize bool = false; 6697 var issetDataPageOffset bool = false; 6698 6699 for { 6700 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 6701 if err != nil { 6702 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 6703 } 6704 if fieldTypeId == thrift.STOP { break; } 6705 switch fieldId { 6706 case 1: 6707 if fieldTypeId == thrift.I32 { 6708 if err := p.ReadField1(ctx, iprot); err != nil { 6709 return err 6710 } 6711 issetType = true 6712 } else { 6713 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6714 return err 6715 } 6716 } 6717 case 2: 6718 if fieldTypeId == thrift.LIST { 6719 if err := p.ReadField2(ctx, iprot); err != nil { 6720 return err 6721 } 6722 issetEncodings = true 6723 } else { 6724 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6725 return err 6726 } 6727 } 6728 case 3: 6729 if fieldTypeId == thrift.LIST { 6730 if err := p.ReadField3(ctx, iprot); err != nil { 6731 return err 6732 } 6733 issetPathInSchema = true 6734 } else { 6735 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6736 return err 6737 } 6738 } 6739 case 4: 6740 if fieldTypeId == thrift.I32 { 6741 if err := p.ReadField4(ctx, iprot); err != nil { 6742 return err 6743 } 6744 issetCodec = true 6745 } else { 6746 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6747 return err 6748 } 6749 } 6750 case 5: 6751 if fieldTypeId == thrift.I64 { 6752 if err := p.ReadField5(ctx, iprot); err != nil { 6753 return err 6754 } 6755 issetNumValues = true 6756 } else { 6757 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6758 return err 6759 } 6760 } 6761 case 6: 6762 if fieldTypeId == thrift.I64 { 6763 if err := p.ReadField6(ctx, iprot); err != nil { 6764 return err 6765 } 6766 issetTotalUncompressedSize = true 6767 } else { 6768 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6769 return err 6770 } 6771 } 6772 case 7: 6773 if fieldTypeId == thrift.I64 { 6774 if err := p.ReadField7(ctx, iprot); err != nil { 6775 return err 6776 } 6777 issetTotalCompressedSize = true 6778 } else { 6779 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6780 return err 6781 } 6782 } 6783 case 8: 6784 if fieldTypeId == thrift.LIST { 6785 if err := p.ReadField8(ctx, iprot); err != nil { 6786 return err 6787 } 6788 } else { 6789 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6790 return err 6791 } 6792 } 6793 case 9: 6794 if fieldTypeId == thrift.I64 { 6795 if err := p.ReadField9(ctx, iprot); err != nil { 6796 return err 6797 } 6798 issetDataPageOffset = true 6799 } else { 6800 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6801 return err 6802 } 6803 } 6804 case 10: 6805 if fieldTypeId == thrift.I64 { 6806 if err := p.ReadField10(ctx, iprot); err != nil { 6807 return err 6808 } 6809 } else { 6810 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6811 return err 6812 } 6813 } 6814 case 11: 6815 if fieldTypeId == thrift.I64 { 6816 if err := p.ReadField11(ctx, iprot); err != nil { 6817 return err 6818 } 6819 } else { 6820 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6821 return err 6822 } 6823 } 6824 case 12: 6825 if fieldTypeId == thrift.STRUCT { 6826 if err := p.ReadField12(ctx, iprot); err != nil { 6827 return err 6828 } 6829 } else { 6830 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6831 return err 6832 } 6833 } 6834 case 13: 6835 if fieldTypeId == thrift.LIST { 6836 if err := p.ReadField13(ctx, iprot); err != nil { 6837 return err 6838 } 6839 } else { 6840 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6841 return err 6842 } 6843 } 6844 case 14: 6845 if fieldTypeId == thrift.I64 { 6846 if err := p.ReadField14(ctx, iprot); err != nil { 6847 return err 6848 } 6849 } else { 6850 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6851 return err 6852 } 6853 } 6854 default: 6855 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6856 return err 6857 } 6858 } 6859 if err := iprot.ReadFieldEnd(ctx); err != nil { 6860 return err 6861 } 6862 } 6863 if err := iprot.ReadStructEnd(ctx); err != nil { 6864 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 6865 } 6866 if !issetType{ 6867 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")); 6868 } 6869 if !issetEncodings{ 6870 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encodings is not set")); 6871 } 6872 if !issetPathInSchema{ 6873 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PathInSchema is not set")); 6874 } 6875 if !issetCodec{ 6876 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Codec is not set")); 6877 } 6878 if !issetNumValues{ 6879 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumValues is not set")); 6880 } 6881 if !issetTotalUncompressedSize{ 6882 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TotalUncompressedSize is not set")); 6883 } 6884 if !issetTotalCompressedSize{ 6885 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TotalCompressedSize is not set")); 6886 } 6887 if !issetDataPageOffset{ 6888 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataPageOffset is not set")); 6889 } 6890 return nil 6891} 6892 6893func (p *ColumnMetaData) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 6894 if v, err := iprot.ReadI32(ctx); err != nil { 6895 return thrift.PrependError("error reading field 1: ", err) 6896} else { 6897 temp := Type(v) 6898 p.Type = temp 6899} 6900 return nil 6901} 6902 6903func (p *ColumnMetaData) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 6904 _, size, err := iprot.ReadListBegin(ctx) 6905 if err != nil { 6906 return thrift.PrependError("error reading list begin: ", err) 6907 } 6908 tSlice := make([]Encoding, 0, size) 6909 p.Encodings = tSlice 6910 for i := 0; i < size; i ++ { 6911var _elem0 Encoding 6912 if v, err := iprot.ReadI32(ctx); err != nil { 6913 return thrift.PrependError("error reading field 0: ", err) 6914} else { 6915 temp := Encoding(v) 6916 _elem0 = temp 6917} 6918 p.Encodings = append(p.Encodings, _elem0) 6919 } 6920 if err := iprot.ReadListEnd(ctx); err != nil { 6921 return thrift.PrependError("error reading list end: ", err) 6922 } 6923 return nil 6924} 6925 6926func (p *ColumnMetaData) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 6927 _, size, err := iprot.ReadListBegin(ctx) 6928 if err != nil { 6929 return thrift.PrependError("error reading list begin: ", err) 6930 } 6931 tSlice := make([]string, 0, size) 6932 p.PathInSchema = tSlice 6933 for i := 0; i < size; i ++ { 6934var _elem1 string 6935 if v, err := iprot.ReadString(ctx); err != nil { 6936 return thrift.PrependError("error reading field 0: ", err) 6937} else { 6938 _elem1 = v 6939} 6940 p.PathInSchema = append(p.PathInSchema, _elem1) 6941 } 6942 if err := iprot.ReadListEnd(ctx); err != nil { 6943 return thrift.PrependError("error reading list end: ", err) 6944 } 6945 return nil 6946} 6947 6948func (p *ColumnMetaData) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 6949 if v, err := iprot.ReadI32(ctx); err != nil { 6950 return thrift.PrependError("error reading field 4: ", err) 6951} else { 6952 temp := CompressionCodec(v) 6953 p.Codec = temp 6954} 6955 return nil 6956} 6957 6958func (p *ColumnMetaData) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 6959 if v, err := iprot.ReadI64(ctx); err != nil { 6960 return thrift.PrependError("error reading field 5: ", err) 6961} else { 6962 p.NumValues = v 6963} 6964 return nil 6965} 6966 6967func (p *ColumnMetaData) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 6968 if v, err := iprot.ReadI64(ctx); err != nil { 6969 return thrift.PrependError("error reading field 6: ", err) 6970} else { 6971 p.TotalUncompressedSize = v 6972} 6973 return nil 6974} 6975 6976func (p *ColumnMetaData) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 6977 if v, err := iprot.ReadI64(ctx); err != nil { 6978 return thrift.PrependError("error reading field 7: ", err) 6979} else { 6980 p.TotalCompressedSize = v 6981} 6982 return nil 6983} 6984 6985func (p *ColumnMetaData) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 6986 _, size, err := iprot.ReadListBegin(ctx) 6987 if err != nil { 6988 return thrift.PrependError("error reading list begin: ", err) 6989 } 6990 tSlice := make([]*KeyValue, 0, size) 6991 p.KeyValueMetadata = tSlice 6992 for i := 0; i < size; i ++ { 6993 _elem2 := &KeyValue{} 6994 if err := _elem2.Read(ctx, iprot); err != nil { 6995 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err) 6996 } 6997 p.KeyValueMetadata = append(p.KeyValueMetadata, _elem2) 6998 } 6999 if err := iprot.ReadListEnd(ctx); err != nil { 7000 return thrift.PrependError("error reading list end: ", err) 7001 } 7002 return nil 7003} 7004 7005func (p *ColumnMetaData) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { 7006 if v, err := iprot.ReadI64(ctx); err != nil { 7007 return thrift.PrependError("error reading field 9: ", err) 7008} else { 7009 p.DataPageOffset = v 7010} 7011 return nil 7012} 7013 7014func (p *ColumnMetaData) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { 7015 if v, err := iprot.ReadI64(ctx); err != nil { 7016 return thrift.PrependError("error reading field 10: ", err) 7017} else { 7018 p.IndexPageOffset = &v 7019} 7020 return nil 7021} 7022 7023func (p *ColumnMetaData) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { 7024 if v, err := iprot.ReadI64(ctx); err != nil { 7025 return thrift.PrependError("error reading field 11: ", err) 7026} else { 7027 p.DictionaryPageOffset = &v 7028} 7029 return nil 7030} 7031 7032func (p *ColumnMetaData) ReadField12(ctx context.Context, iprot thrift.TProtocol) error { 7033 p.Statistics = &Statistics{} 7034 if err := p.Statistics.Read(ctx, iprot); err != nil { 7035 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Statistics), err) 7036 } 7037 return nil 7038} 7039 7040func (p *ColumnMetaData) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { 7041 _, size, err := iprot.ReadListBegin(ctx) 7042 if err != nil { 7043 return thrift.PrependError("error reading list begin: ", err) 7044 } 7045 tSlice := make([]*PageEncodingStats, 0, size) 7046 p.EncodingStats = tSlice 7047 for i := 0; i < size; i ++ { 7048 _elem3 := &PageEncodingStats{} 7049 if err := _elem3.Read(ctx, iprot); err != nil { 7050 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err) 7051 } 7052 p.EncodingStats = append(p.EncodingStats, _elem3) 7053 } 7054 if err := iprot.ReadListEnd(ctx); err != nil { 7055 return thrift.PrependError("error reading list end: ", err) 7056 } 7057 return nil 7058} 7059 7060func (p *ColumnMetaData) ReadField14(ctx context.Context, iprot thrift.TProtocol) error { 7061 if v, err := iprot.ReadI64(ctx); err != nil { 7062 return thrift.PrependError("error reading field 14: ", err) 7063} else { 7064 p.BloomFilterOffset = &v 7065} 7066 return nil 7067} 7068 7069func (p *ColumnMetaData) Write(ctx context.Context, oprot thrift.TProtocol) error { 7070 if err := oprot.WriteStructBegin(ctx, "ColumnMetaData"); err != nil { 7071 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 7072 if p != nil { 7073 if err := p.writeField1(ctx, oprot); err != nil { return err } 7074 if err := p.writeField2(ctx, oprot); err != nil { return err } 7075 if err := p.writeField3(ctx, oprot); err != nil { return err } 7076 if err := p.writeField4(ctx, oprot); err != nil { return err } 7077 if err := p.writeField5(ctx, oprot); err != nil { return err } 7078 if err := p.writeField6(ctx, oprot); err != nil { return err } 7079 if err := p.writeField7(ctx, oprot); err != nil { return err } 7080 if err := p.writeField8(ctx, oprot); err != nil { return err } 7081 if err := p.writeField9(ctx, oprot); err != nil { return err } 7082 if err := p.writeField10(ctx, oprot); err != nil { return err } 7083 if err := p.writeField11(ctx, oprot); err != nil { return err } 7084 if err := p.writeField12(ctx, oprot); err != nil { return err } 7085 if err := p.writeField13(ctx, oprot); err != nil { return err } 7086 if err := p.writeField14(ctx, oprot); err != nil { return err } 7087 } 7088 if err := oprot.WriteFieldStop(ctx); err != nil { 7089 return thrift.PrependError("write field stop error: ", err) } 7090 if err := oprot.WriteStructEnd(ctx); err != nil { 7091 return thrift.PrependError("write struct stop error: ", err) } 7092 return nil 7093} 7094 7095func (p *ColumnMetaData) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 7096 if err := oprot.WriteFieldBegin(ctx, "type", thrift.I32, 1); err != nil { 7097 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:type: ", p), err) } 7098 if err := oprot.WriteI32(ctx, int32(p.Type)); err != nil { 7099 return thrift.PrependError(fmt.Sprintf("%T.type (1) field write error: ", p), err) } 7100 if err := oprot.WriteFieldEnd(ctx); err != nil { 7101 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:type: ", p), err) } 7102 return err 7103} 7104 7105func (p *ColumnMetaData) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 7106 if err := oprot.WriteFieldBegin(ctx, "encodings", thrift.LIST, 2); err != nil { 7107 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:encodings: ", p), err) } 7108 if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Encodings)); err != nil { 7109 return thrift.PrependError("error writing list begin: ", err) 7110 } 7111 for _, v := range p.Encodings { 7112 if err := oprot.WriteI32(ctx, int32(v)); err != nil { 7113 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } 7114 } 7115 if err := oprot.WriteListEnd(ctx); err != nil { 7116 return thrift.PrependError("error writing list end: ", err) 7117 } 7118 if err := oprot.WriteFieldEnd(ctx); err != nil { 7119 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:encodings: ", p), err) } 7120 return err 7121} 7122 7123func (p *ColumnMetaData) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 7124 if err := oprot.WriteFieldBegin(ctx, "path_in_schema", thrift.LIST, 3); err != nil { 7125 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:path_in_schema: ", p), err) } 7126 if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.PathInSchema)); err != nil { 7127 return thrift.PrependError("error writing list begin: ", err) 7128 } 7129 for _, v := range p.PathInSchema { 7130 if err := oprot.WriteString(ctx, string(v)); err != nil { 7131 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } 7132 } 7133 if err := oprot.WriteListEnd(ctx); err != nil { 7134 return thrift.PrependError("error writing list end: ", err) 7135 } 7136 if err := oprot.WriteFieldEnd(ctx); err != nil { 7137 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:path_in_schema: ", p), err) } 7138 return err 7139} 7140 7141func (p *ColumnMetaData) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 7142 if err := oprot.WriteFieldBegin(ctx, "codec", thrift.I32, 4); err != nil { 7143 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:codec: ", p), err) } 7144 if err := oprot.WriteI32(ctx, int32(p.Codec)); err != nil { 7145 return thrift.PrependError(fmt.Sprintf("%T.codec (4) field write error: ", p), err) } 7146 if err := oprot.WriteFieldEnd(ctx); err != nil { 7147 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:codec: ", p), err) } 7148 return err 7149} 7150 7151func (p *ColumnMetaData) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 7152 if err := oprot.WriteFieldBegin(ctx, "num_values", thrift.I64, 5); err != nil { 7153 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:num_values: ", p), err) } 7154 if err := oprot.WriteI64(ctx, int64(p.NumValues)); err != nil { 7155 return thrift.PrependError(fmt.Sprintf("%T.num_values (5) field write error: ", p), err) } 7156 if err := oprot.WriteFieldEnd(ctx); err != nil { 7157 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:num_values: ", p), err) } 7158 return err 7159} 7160 7161func (p *ColumnMetaData) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 7162 if err := oprot.WriteFieldBegin(ctx, "total_uncompressed_size", thrift.I64, 6); err != nil { 7163 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:total_uncompressed_size: ", p), err) } 7164 if err := oprot.WriteI64(ctx, int64(p.TotalUncompressedSize)); err != nil { 7165 return thrift.PrependError(fmt.Sprintf("%T.total_uncompressed_size (6) field write error: ", p), err) } 7166 if err := oprot.WriteFieldEnd(ctx); err != nil { 7167 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:total_uncompressed_size: ", p), err) } 7168 return err 7169} 7170 7171func (p *ColumnMetaData) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 7172 if err := oprot.WriteFieldBegin(ctx, "total_compressed_size", thrift.I64, 7); err != nil { 7173 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:total_compressed_size: ", p), err) } 7174 if err := oprot.WriteI64(ctx, int64(p.TotalCompressedSize)); err != nil { 7175 return thrift.PrependError(fmt.Sprintf("%T.total_compressed_size (7) field write error: ", p), err) } 7176 if err := oprot.WriteFieldEnd(ctx); err != nil { 7177 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:total_compressed_size: ", p), err) } 7178 return err 7179} 7180 7181func (p *ColumnMetaData) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 7182 if p.IsSetKeyValueMetadata() { 7183 if err := oprot.WriteFieldBegin(ctx, "key_value_metadata", thrift.LIST, 8); err != nil { 7184 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:key_value_metadata: ", p), err) } 7185 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.KeyValueMetadata)); err != nil { 7186 return thrift.PrependError("error writing list begin: ", err) 7187 } 7188 for _, v := range p.KeyValueMetadata { 7189 if err := v.Write(ctx, oprot); err != nil { 7190 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 7191 } 7192 } 7193 if err := oprot.WriteListEnd(ctx); err != nil { 7194 return thrift.PrependError("error writing list end: ", err) 7195 } 7196 if err := oprot.WriteFieldEnd(ctx); err != nil { 7197 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:key_value_metadata: ", p), err) } 7198 } 7199 return err 7200} 7201 7202func (p *ColumnMetaData) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { 7203 if err := oprot.WriteFieldBegin(ctx, "data_page_offset", thrift.I64, 9); err != nil { 7204 return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:data_page_offset: ", p), err) } 7205 if err := oprot.WriteI64(ctx, int64(p.DataPageOffset)); err != nil { 7206 return thrift.PrependError(fmt.Sprintf("%T.data_page_offset (9) field write error: ", p), err) } 7207 if err := oprot.WriteFieldEnd(ctx); err != nil { 7208 return thrift.PrependError(fmt.Sprintf("%T write field end error 9:data_page_offset: ", p), err) } 7209 return err 7210} 7211 7212func (p *ColumnMetaData) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { 7213 if p.IsSetIndexPageOffset() { 7214 if err := oprot.WriteFieldBegin(ctx, "index_page_offset", thrift.I64, 10); err != nil { 7215 return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:index_page_offset: ", p), err) } 7216 if err := oprot.WriteI64(ctx, int64(*p.IndexPageOffset)); err != nil { 7217 return thrift.PrependError(fmt.Sprintf("%T.index_page_offset (10) field write error: ", p), err) } 7218 if err := oprot.WriteFieldEnd(ctx); err != nil { 7219 return thrift.PrependError(fmt.Sprintf("%T write field end error 10:index_page_offset: ", p), err) } 7220 } 7221 return err 7222} 7223 7224func (p *ColumnMetaData) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { 7225 if p.IsSetDictionaryPageOffset() { 7226 if err := oprot.WriteFieldBegin(ctx, "dictionary_page_offset", thrift.I64, 11); err != nil { 7227 return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:dictionary_page_offset: ", p), err) } 7228 if err := oprot.WriteI64(ctx, int64(*p.DictionaryPageOffset)); err != nil { 7229 return thrift.PrependError(fmt.Sprintf("%T.dictionary_page_offset (11) field write error: ", p), err) } 7230 if err := oprot.WriteFieldEnd(ctx); err != nil { 7231 return thrift.PrependError(fmt.Sprintf("%T write field end error 11:dictionary_page_offset: ", p), err) } 7232 } 7233 return err 7234} 7235 7236func (p *ColumnMetaData) writeField12(ctx context.Context, oprot thrift.TProtocol) (err error) { 7237 if p.IsSetStatistics() { 7238 if err := oprot.WriteFieldBegin(ctx, "statistics", thrift.STRUCT, 12); err != nil { 7239 return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:statistics: ", p), err) } 7240 if err := p.Statistics.Write(ctx, oprot); err != nil { 7241 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Statistics), err) 7242 } 7243 if err := oprot.WriteFieldEnd(ctx); err != nil { 7244 return thrift.PrependError(fmt.Sprintf("%T write field end error 12:statistics: ", p), err) } 7245 } 7246 return err 7247} 7248 7249func (p *ColumnMetaData) writeField13(ctx context.Context, oprot thrift.TProtocol) (err error) { 7250 if p.IsSetEncodingStats() { 7251 if err := oprot.WriteFieldBegin(ctx, "encoding_stats", thrift.LIST, 13); err != nil { 7252 return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:encoding_stats: ", p), err) } 7253 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.EncodingStats)); err != nil { 7254 return thrift.PrependError("error writing list begin: ", err) 7255 } 7256 for _, v := range p.EncodingStats { 7257 if err := v.Write(ctx, oprot); err != nil { 7258 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 7259 } 7260 } 7261 if err := oprot.WriteListEnd(ctx); err != nil { 7262 return thrift.PrependError("error writing list end: ", err) 7263 } 7264 if err := oprot.WriteFieldEnd(ctx); err != nil { 7265 return thrift.PrependError(fmt.Sprintf("%T write field end error 13:encoding_stats: ", p), err) } 7266 } 7267 return err 7268} 7269 7270func (p *ColumnMetaData) writeField14(ctx context.Context, oprot thrift.TProtocol) (err error) { 7271 if p.IsSetBloomFilterOffset() { 7272 if err := oprot.WriteFieldBegin(ctx, "bloom_filter_offset", thrift.I64, 14); err != nil { 7273 return thrift.PrependError(fmt.Sprintf("%T write field begin error 14:bloom_filter_offset: ", p), err) } 7274 if err := oprot.WriteI64(ctx, int64(*p.BloomFilterOffset)); err != nil { 7275 return thrift.PrependError(fmt.Sprintf("%T.bloom_filter_offset (14) field write error: ", p), err) } 7276 if err := oprot.WriteFieldEnd(ctx); err != nil { 7277 return thrift.PrependError(fmt.Sprintf("%T write field end error 14:bloom_filter_offset: ", p), err) } 7278 } 7279 return err 7280} 7281 7282func (p *ColumnMetaData) Equals(other *ColumnMetaData) bool { 7283 if p == other { 7284 return true 7285 } else if p == nil || other == nil { 7286 return false 7287 } 7288 if p.Type != other.Type { return false } 7289 if len(p.Encodings) != len(other.Encodings) { return false } 7290 for i, _tgt := range p.Encodings { 7291 _src4 := other.Encodings[i] 7292 if _tgt != _src4 { return false } 7293 } 7294 if len(p.PathInSchema) != len(other.PathInSchema) { return false } 7295 for i, _tgt := range p.PathInSchema { 7296 _src5 := other.PathInSchema[i] 7297 if _tgt != _src5 { return false } 7298 } 7299 if p.Codec != other.Codec { return false } 7300 if p.NumValues != other.NumValues { return false } 7301 if p.TotalUncompressedSize != other.TotalUncompressedSize { return false } 7302 if p.TotalCompressedSize != other.TotalCompressedSize { return false } 7303 if len(p.KeyValueMetadata) != len(other.KeyValueMetadata) { return false } 7304 for i, _tgt := range p.KeyValueMetadata { 7305 _src6 := other.KeyValueMetadata[i] 7306 if !_tgt.Equals(_src6) { return false } 7307 } 7308 if p.DataPageOffset != other.DataPageOffset { return false } 7309 if p.IndexPageOffset != other.IndexPageOffset { 7310 if p.IndexPageOffset == nil || other.IndexPageOffset == nil { 7311 return false 7312 } 7313 if (*p.IndexPageOffset) != (*other.IndexPageOffset) { return false } 7314 } 7315 if p.DictionaryPageOffset != other.DictionaryPageOffset { 7316 if p.DictionaryPageOffset == nil || other.DictionaryPageOffset == nil { 7317 return false 7318 } 7319 if (*p.DictionaryPageOffset) != (*other.DictionaryPageOffset) { return false } 7320 } 7321 if !p.Statistics.Equals(other.Statistics) { return false } 7322 if len(p.EncodingStats) != len(other.EncodingStats) { return false } 7323 for i, _tgt := range p.EncodingStats { 7324 _src7 := other.EncodingStats[i] 7325 if !_tgt.Equals(_src7) { return false } 7326 } 7327 if p.BloomFilterOffset != other.BloomFilterOffset { 7328 if p.BloomFilterOffset == nil || other.BloomFilterOffset == nil { 7329 return false 7330 } 7331 if (*p.BloomFilterOffset) != (*other.BloomFilterOffset) { return false } 7332 } 7333 return true 7334} 7335 7336func (p *ColumnMetaData) String() string { 7337 if p == nil { 7338 return "<nil>" 7339 } 7340 return fmt.Sprintf("ColumnMetaData(%+v)", *p) 7341} 7342 7343type EncryptionWithFooterKey struct { 7344} 7345 7346func NewEncryptionWithFooterKey() *EncryptionWithFooterKey { 7347 return &EncryptionWithFooterKey{} 7348} 7349 7350func (p *EncryptionWithFooterKey) Read(ctx context.Context, iprot thrift.TProtocol) error { 7351 if _, err := iprot.ReadStructBegin(ctx); err != nil { 7352 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 7353 } 7354 7355 7356 for { 7357 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 7358 if err != nil { 7359 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 7360 } 7361 if fieldTypeId == thrift.STOP { break; } 7362 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7363 return err 7364 } 7365 if err := iprot.ReadFieldEnd(ctx); err != nil { 7366 return err 7367 } 7368 } 7369 if err := iprot.ReadStructEnd(ctx); err != nil { 7370 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 7371 } 7372 return nil 7373} 7374 7375func (p *EncryptionWithFooterKey) Write(ctx context.Context, oprot thrift.TProtocol) error { 7376 if err := oprot.WriteStructBegin(ctx, "EncryptionWithFooterKey"); err != nil { 7377 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 7378 if p != nil { 7379 } 7380 if err := oprot.WriteFieldStop(ctx); err != nil { 7381 return thrift.PrependError("write field stop error: ", err) } 7382 if err := oprot.WriteStructEnd(ctx); err != nil { 7383 return thrift.PrependError("write struct stop error: ", err) } 7384 return nil 7385} 7386 7387func (p *EncryptionWithFooterKey) Equals(other *EncryptionWithFooterKey) bool { 7388 if p == other { 7389 return true 7390 } else if p == nil || other == nil { 7391 return false 7392 } 7393 return true 7394} 7395 7396func (p *EncryptionWithFooterKey) String() string { 7397 if p == nil { 7398 return "<nil>" 7399 } 7400 return fmt.Sprintf("EncryptionWithFooterKey(%+v)", *p) 7401} 7402 7403// Attributes: 7404// - PathInSchema: Column path in schema * 7405// - KeyMetadata: Retrieval metadata of column encryption key * 7406type EncryptionWithColumnKey struct { 7407 PathInSchema []string `thrift:"path_in_schema,1,required" db:"path_in_schema" json:"path_in_schema"` 7408 KeyMetadata []byte `thrift:"key_metadata,2" db:"key_metadata" json:"key_metadata,omitempty"` 7409} 7410 7411func NewEncryptionWithColumnKey() *EncryptionWithColumnKey { 7412 return &EncryptionWithColumnKey{} 7413} 7414 7415 7416func (p *EncryptionWithColumnKey) GetPathInSchema() []string { 7417 return p.PathInSchema 7418} 7419var EncryptionWithColumnKey_KeyMetadata_DEFAULT []byte 7420 7421func (p *EncryptionWithColumnKey) GetKeyMetadata() []byte { 7422 return p.KeyMetadata 7423} 7424func (p *EncryptionWithColumnKey) IsSetKeyMetadata() bool { 7425 return p.KeyMetadata != nil 7426} 7427 7428func (p *EncryptionWithColumnKey) Read(ctx context.Context, iprot thrift.TProtocol) error { 7429 if _, err := iprot.ReadStructBegin(ctx); err != nil { 7430 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 7431 } 7432 7433 var issetPathInSchema bool = false; 7434 7435 for { 7436 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 7437 if err != nil { 7438 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 7439 } 7440 if fieldTypeId == thrift.STOP { break; } 7441 switch fieldId { 7442 case 1: 7443 if fieldTypeId == thrift.LIST { 7444 if err := p.ReadField1(ctx, iprot); err != nil { 7445 return err 7446 } 7447 issetPathInSchema = true 7448 } else { 7449 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7450 return err 7451 } 7452 } 7453 case 2: 7454 if fieldTypeId == thrift.STRING { 7455 if err := p.ReadField2(ctx, iprot); err != nil { 7456 return err 7457 } 7458 } else { 7459 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7460 return err 7461 } 7462 } 7463 default: 7464 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7465 return err 7466 } 7467 } 7468 if err := iprot.ReadFieldEnd(ctx); err != nil { 7469 return err 7470 } 7471 } 7472 if err := iprot.ReadStructEnd(ctx); err != nil { 7473 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 7474 } 7475 if !issetPathInSchema{ 7476 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PathInSchema is not set")); 7477 } 7478 return nil 7479} 7480 7481func (p *EncryptionWithColumnKey) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 7482 _, size, err := iprot.ReadListBegin(ctx) 7483 if err != nil { 7484 return thrift.PrependError("error reading list begin: ", err) 7485 } 7486 tSlice := make([]string, 0, size) 7487 p.PathInSchema = tSlice 7488 for i := 0; i < size; i ++ { 7489var _elem8 string 7490 if v, err := iprot.ReadString(ctx); err != nil { 7491 return thrift.PrependError("error reading field 0: ", err) 7492} else { 7493 _elem8 = v 7494} 7495 p.PathInSchema = append(p.PathInSchema, _elem8) 7496 } 7497 if err := iprot.ReadListEnd(ctx); err != nil { 7498 return thrift.PrependError("error reading list end: ", err) 7499 } 7500 return nil 7501} 7502 7503func (p *EncryptionWithColumnKey) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 7504 if v, err := iprot.ReadBinary(ctx); err != nil { 7505 return thrift.PrependError("error reading field 2: ", err) 7506} else { 7507 p.KeyMetadata = v 7508} 7509 return nil 7510} 7511 7512func (p *EncryptionWithColumnKey) Write(ctx context.Context, oprot thrift.TProtocol) error { 7513 if err := oprot.WriteStructBegin(ctx, "EncryptionWithColumnKey"); err != nil { 7514 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 7515 if p != nil { 7516 if err := p.writeField1(ctx, oprot); err != nil { return err } 7517 if err := p.writeField2(ctx, oprot); err != nil { return err } 7518 } 7519 if err := oprot.WriteFieldStop(ctx); err != nil { 7520 return thrift.PrependError("write field stop error: ", err) } 7521 if err := oprot.WriteStructEnd(ctx); err != nil { 7522 return thrift.PrependError("write struct stop error: ", err) } 7523 return nil 7524} 7525 7526func (p *EncryptionWithColumnKey) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 7527 if err := oprot.WriteFieldBegin(ctx, "path_in_schema", thrift.LIST, 1); err != nil { 7528 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:path_in_schema: ", p), err) } 7529 if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.PathInSchema)); err != nil { 7530 return thrift.PrependError("error writing list begin: ", err) 7531 } 7532 for _, v := range p.PathInSchema { 7533 if err := oprot.WriteString(ctx, string(v)); err != nil { 7534 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } 7535 } 7536 if err := oprot.WriteListEnd(ctx); err != nil { 7537 return thrift.PrependError("error writing list end: ", err) 7538 } 7539 if err := oprot.WriteFieldEnd(ctx); err != nil { 7540 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:path_in_schema: ", p), err) } 7541 return err 7542} 7543 7544func (p *EncryptionWithColumnKey) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 7545 if p.IsSetKeyMetadata() { 7546 if err := oprot.WriteFieldBegin(ctx, "key_metadata", thrift.STRING, 2); err != nil { 7547 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:key_metadata: ", p), err) } 7548 if err := oprot.WriteBinary(ctx, p.KeyMetadata); err != nil { 7549 return thrift.PrependError(fmt.Sprintf("%T.key_metadata (2) field write error: ", p), err) } 7550 if err := oprot.WriteFieldEnd(ctx); err != nil { 7551 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:key_metadata: ", p), err) } 7552 } 7553 return err 7554} 7555 7556func (p *EncryptionWithColumnKey) Equals(other *EncryptionWithColumnKey) bool { 7557 if p == other { 7558 return true 7559 } else if p == nil || other == nil { 7560 return false 7561 } 7562 if len(p.PathInSchema) != len(other.PathInSchema) { return false } 7563 for i, _tgt := range p.PathInSchema { 7564 _src9 := other.PathInSchema[i] 7565 if _tgt != _src9 { return false } 7566 } 7567 if bytes.Compare(p.KeyMetadata, other.KeyMetadata) != 0 { return false } 7568 return true 7569} 7570 7571func (p *EncryptionWithColumnKey) String() string { 7572 if p == nil { 7573 return "<nil>" 7574 } 7575 return fmt.Sprintf("EncryptionWithColumnKey(%+v)", *p) 7576} 7577 7578// Attributes: 7579// - ENCRYPTION_WITH_FOOTER_KEY 7580// - ENCRYPTION_WITH_COLUMN_KEY 7581type ColumnCryptoMetaData struct { 7582 ENCRYPTION_WITH_FOOTER_KEY *EncryptionWithFooterKey `thrift:"ENCRYPTION_WITH_FOOTER_KEY,1" db:"ENCRYPTION_WITH_FOOTER_KEY" json:"ENCRYPTION_WITH_FOOTER_KEY,omitempty"` 7583 ENCRYPTION_WITH_COLUMN_KEY *EncryptionWithColumnKey `thrift:"ENCRYPTION_WITH_COLUMN_KEY,2" db:"ENCRYPTION_WITH_COLUMN_KEY" json:"ENCRYPTION_WITH_COLUMN_KEY,omitempty"` 7584} 7585 7586func NewColumnCryptoMetaData() *ColumnCryptoMetaData { 7587 return &ColumnCryptoMetaData{} 7588} 7589 7590var ColumnCryptoMetaData_ENCRYPTION_WITH_FOOTER_KEY_DEFAULT *EncryptionWithFooterKey 7591func (p *ColumnCryptoMetaData) GetENCRYPTION_WITH_FOOTER_KEY() *EncryptionWithFooterKey { 7592 if !p.IsSetENCRYPTION_WITH_FOOTER_KEY() { 7593 return ColumnCryptoMetaData_ENCRYPTION_WITH_FOOTER_KEY_DEFAULT 7594 } 7595return p.ENCRYPTION_WITH_FOOTER_KEY 7596} 7597var ColumnCryptoMetaData_ENCRYPTION_WITH_COLUMN_KEY_DEFAULT *EncryptionWithColumnKey 7598func (p *ColumnCryptoMetaData) GetENCRYPTION_WITH_COLUMN_KEY() *EncryptionWithColumnKey { 7599 if !p.IsSetENCRYPTION_WITH_COLUMN_KEY() { 7600 return ColumnCryptoMetaData_ENCRYPTION_WITH_COLUMN_KEY_DEFAULT 7601 } 7602return p.ENCRYPTION_WITH_COLUMN_KEY 7603} 7604func (p *ColumnCryptoMetaData) CountSetFieldsColumnCryptoMetaData() int { 7605 count := 0 7606 if (p.IsSetENCRYPTION_WITH_FOOTER_KEY()) { 7607 count++ 7608 } 7609 if (p.IsSetENCRYPTION_WITH_COLUMN_KEY()) { 7610 count++ 7611 } 7612 return count 7613 7614} 7615 7616func (p *ColumnCryptoMetaData) IsSetENCRYPTION_WITH_FOOTER_KEY() bool { 7617 return p.ENCRYPTION_WITH_FOOTER_KEY != nil 7618} 7619 7620func (p *ColumnCryptoMetaData) IsSetENCRYPTION_WITH_COLUMN_KEY() bool { 7621 return p.ENCRYPTION_WITH_COLUMN_KEY != nil 7622} 7623 7624func (p *ColumnCryptoMetaData) Read(ctx context.Context, iprot thrift.TProtocol) error { 7625 if _, err := iprot.ReadStructBegin(ctx); err != nil { 7626 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 7627 } 7628 7629 7630 for { 7631 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 7632 if err != nil { 7633 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 7634 } 7635 if fieldTypeId == thrift.STOP { break; } 7636 switch fieldId { 7637 case 1: 7638 if fieldTypeId == thrift.STRUCT { 7639 if err := p.ReadField1(ctx, iprot); err != nil { 7640 return err 7641 } 7642 } else { 7643 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7644 return err 7645 } 7646 } 7647 case 2: 7648 if fieldTypeId == thrift.STRUCT { 7649 if err := p.ReadField2(ctx, iprot); err != nil { 7650 return err 7651 } 7652 } else { 7653 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7654 return err 7655 } 7656 } 7657 default: 7658 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7659 return err 7660 } 7661 } 7662 if err := iprot.ReadFieldEnd(ctx); err != nil { 7663 return err 7664 } 7665 } 7666 if err := iprot.ReadStructEnd(ctx); err != nil { 7667 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 7668 } 7669 return nil 7670} 7671 7672func (p *ColumnCryptoMetaData) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 7673 p.ENCRYPTION_WITH_FOOTER_KEY = &EncryptionWithFooterKey{} 7674 if err := p.ENCRYPTION_WITH_FOOTER_KEY.Read(ctx, iprot); err != nil { 7675 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ENCRYPTION_WITH_FOOTER_KEY), err) 7676 } 7677 return nil 7678} 7679 7680func (p *ColumnCryptoMetaData) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 7681 p.ENCRYPTION_WITH_COLUMN_KEY = &EncryptionWithColumnKey{} 7682 if err := p.ENCRYPTION_WITH_COLUMN_KEY.Read(ctx, iprot); err != nil { 7683 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ENCRYPTION_WITH_COLUMN_KEY), err) 7684 } 7685 return nil 7686} 7687 7688func (p *ColumnCryptoMetaData) Write(ctx context.Context, oprot thrift.TProtocol) error { 7689 if c := p.CountSetFieldsColumnCryptoMetaData(); c != 1 { 7690 return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) 7691 } 7692 if err := oprot.WriteStructBegin(ctx, "ColumnCryptoMetaData"); err != nil { 7693 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 7694 if p != nil { 7695 if err := p.writeField1(ctx, oprot); err != nil { return err } 7696 if err := p.writeField2(ctx, oprot); err != nil { return err } 7697 } 7698 if err := oprot.WriteFieldStop(ctx); err != nil { 7699 return thrift.PrependError("write field stop error: ", err) } 7700 if err := oprot.WriteStructEnd(ctx); err != nil { 7701 return thrift.PrependError("write struct stop error: ", err) } 7702 return nil 7703} 7704 7705func (p *ColumnCryptoMetaData) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 7706 if p.IsSetENCRYPTION_WITH_FOOTER_KEY() { 7707 if err := oprot.WriteFieldBegin(ctx, "ENCRYPTION_WITH_FOOTER_KEY", thrift.STRUCT, 1); err != nil { 7708 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ENCRYPTION_WITH_FOOTER_KEY: ", p), err) } 7709 if err := p.ENCRYPTION_WITH_FOOTER_KEY.Write(ctx, oprot); err != nil { 7710 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ENCRYPTION_WITH_FOOTER_KEY), err) 7711 } 7712 if err := oprot.WriteFieldEnd(ctx); err != nil { 7713 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ENCRYPTION_WITH_FOOTER_KEY: ", p), err) } 7714 } 7715 return err 7716} 7717 7718func (p *ColumnCryptoMetaData) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 7719 if p.IsSetENCRYPTION_WITH_COLUMN_KEY() { 7720 if err := oprot.WriteFieldBegin(ctx, "ENCRYPTION_WITH_COLUMN_KEY", thrift.STRUCT, 2); err != nil { 7721 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:ENCRYPTION_WITH_COLUMN_KEY: ", p), err) } 7722 if err := p.ENCRYPTION_WITH_COLUMN_KEY.Write(ctx, oprot); err != nil { 7723 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ENCRYPTION_WITH_COLUMN_KEY), err) 7724 } 7725 if err := oprot.WriteFieldEnd(ctx); err != nil { 7726 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:ENCRYPTION_WITH_COLUMN_KEY: ", p), err) } 7727 } 7728 return err 7729} 7730 7731func (p *ColumnCryptoMetaData) Equals(other *ColumnCryptoMetaData) bool { 7732 if p == other { 7733 return true 7734 } else if p == nil || other == nil { 7735 return false 7736 } 7737 if !p.ENCRYPTION_WITH_FOOTER_KEY.Equals(other.ENCRYPTION_WITH_FOOTER_KEY) { return false } 7738 if !p.ENCRYPTION_WITH_COLUMN_KEY.Equals(other.ENCRYPTION_WITH_COLUMN_KEY) { return false } 7739 return true 7740} 7741 7742func (p *ColumnCryptoMetaData) String() string { 7743 if p == nil { 7744 return "<nil>" 7745 } 7746 return fmt.Sprintf("ColumnCryptoMetaData(%+v)", *p) 7747} 7748 7749// Attributes: 7750// - FilePath: File where column data is stored. If not set, assumed to be same file as 7751// metadata. This path is relative to the current file. 7752// 7753// - FileOffset: Byte offset in file_path to the ColumnMetaData * 7754// - MetaData: Column metadata for this chunk. This is the same content as what is at 7755// file_path/file_offset. Having it here has it replicated in the file 7756// metadata. 7757// 7758// - OffsetIndexOffset: File offset of ColumnChunk's OffsetIndex * 7759// - OffsetIndexLength: Size of ColumnChunk's OffsetIndex, in bytes * 7760// - ColumnIndexOffset: File offset of ColumnChunk's ColumnIndex * 7761// - ColumnIndexLength: Size of ColumnChunk's ColumnIndex, in bytes * 7762// - CryptoMetadata: Crypto metadata of encrypted columns * 7763// - EncryptedColumnMetadata: Encrypted column metadata for this chunk * 7764type ColumnChunk struct { 7765 FilePath *string `thrift:"file_path,1" db:"file_path" json:"file_path,omitempty"` 7766 FileOffset int64 `thrift:"file_offset,2,required" db:"file_offset" json:"file_offset"` 7767 MetaData *ColumnMetaData `thrift:"meta_data,3" db:"meta_data" json:"meta_data,omitempty"` 7768 OffsetIndexOffset *int64 `thrift:"offset_index_offset,4" db:"offset_index_offset" json:"offset_index_offset,omitempty"` 7769 OffsetIndexLength *int32 `thrift:"offset_index_length,5" db:"offset_index_length" json:"offset_index_length,omitempty"` 7770 ColumnIndexOffset *int64 `thrift:"column_index_offset,6" db:"column_index_offset" json:"column_index_offset,omitempty"` 7771 ColumnIndexLength *int32 `thrift:"column_index_length,7" db:"column_index_length" json:"column_index_length,omitempty"` 7772 CryptoMetadata *ColumnCryptoMetaData `thrift:"crypto_metadata,8" db:"crypto_metadata" json:"crypto_metadata,omitempty"` 7773 EncryptedColumnMetadata []byte `thrift:"encrypted_column_metadata,9" db:"encrypted_column_metadata" json:"encrypted_column_metadata,omitempty"` 7774} 7775 7776func NewColumnChunk() *ColumnChunk { 7777 return &ColumnChunk{} 7778} 7779 7780var ColumnChunk_FilePath_DEFAULT string 7781func (p *ColumnChunk) GetFilePath() string { 7782 if !p.IsSetFilePath() { 7783 return ColumnChunk_FilePath_DEFAULT 7784 } 7785return *p.FilePath 7786} 7787 7788func (p *ColumnChunk) GetFileOffset() int64 { 7789 return p.FileOffset 7790} 7791var ColumnChunk_MetaData_DEFAULT *ColumnMetaData 7792func (p *ColumnChunk) GetMetaData() *ColumnMetaData { 7793 if !p.IsSetMetaData() { 7794 return ColumnChunk_MetaData_DEFAULT 7795 } 7796return p.MetaData 7797} 7798var ColumnChunk_OffsetIndexOffset_DEFAULT int64 7799func (p *ColumnChunk) GetOffsetIndexOffset() int64 { 7800 if !p.IsSetOffsetIndexOffset() { 7801 return ColumnChunk_OffsetIndexOffset_DEFAULT 7802 } 7803return *p.OffsetIndexOffset 7804} 7805var ColumnChunk_OffsetIndexLength_DEFAULT int32 7806func (p *ColumnChunk) GetOffsetIndexLength() int32 { 7807 if !p.IsSetOffsetIndexLength() { 7808 return ColumnChunk_OffsetIndexLength_DEFAULT 7809 } 7810return *p.OffsetIndexLength 7811} 7812var ColumnChunk_ColumnIndexOffset_DEFAULT int64 7813func (p *ColumnChunk) GetColumnIndexOffset() int64 { 7814 if !p.IsSetColumnIndexOffset() { 7815 return ColumnChunk_ColumnIndexOffset_DEFAULT 7816 } 7817return *p.ColumnIndexOffset 7818} 7819var ColumnChunk_ColumnIndexLength_DEFAULT int32 7820func (p *ColumnChunk) GetColumnIndexLength() int32 { 7821 if !p.IsSetColumnIndexLength() { 7822 return ColumnChunk_ColumnIndexLength_DEFAULT 7823 } 7824return *p.ColumnIndexLength 7825} 7826var ColumnChunk_CryptoMetadata_DEFAULT *ColumnCryptoMetaData 7827func (p *ColumnChunk) GetCryptoMetadata() *ColumnCryptoMetaData { 7828 if !p.IsSetCryptoMetadata() { 7829 return ColumnChunk_CryptoMetadata_DEFAULT 7830 } 7831return p.CryptoMetadata 7832} 7833var ColumnChunk_EncryptedColumnMetadata_DEFAULT []byte 7834 7835func (p *ColumnChunk) GetEncryptedColumnMetadata() []byte { 7836 return p.EncryptedColumnMetadata 7837} 7838func (p *ColumnChunk) IsSetFilePath() bool { 7839 return p.FilePath != nil 7840} 7841 7842func (p *ColumnChunk) IsSetMetaData() bool { 7843 return p.MetaData != nil 7844} 7845 7846func (p *ColumnChunk) IsSetOffsetIndexOffset() bool { 7847 return p.OffsetIndexOffset != nil 7848} 7849 7850func (p *ColumnChunk) IsSetOffsetIndexLength() bool { 7851 return p.OffsetIndexLength != nil 7852} 7853 7854func (p *ColumnChunk) IsSetColumnIndexOffset() bool { 7855 return p.ColumnIndexOffset != nil 7856} 7857 7858func (p *ColumnChunk) IsSetColumnIndexLength() bool { 7859 return p.ColumnIndexLength != nil 7860} 7861 7862func (p *ColumnChunk) IsSetCryptoMetadata() bool { 7863 return p.CryptoMetadata != nil 7864} 7865 7866func (p *ColumnChunk) IsSetEncryptedColumnMetadata() bool { 7867 return p.EncryptedColumnMetadata != nil 7868} 7869 7870func (p *ColumnChunk) Read(ctx context.Context, iprot thrift.TProtocol) error { 7871 if _, err := iprot.ReadStructBegin(ctx); err != nil { 7872 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 7873 } 7874 7875 var issetFileOffset bool = false; 7876 7877 for { 7878 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 7879 if err != nil { 7880 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 7881 } 7882 if fieldTypeId == thrift.STOP { break; } 7883 switch fieldId { 7884 case 1: 7885 if fieldTypeId == thrift.STRING { 7886 if err := p.ReadField1(ctx, iprot); err != nil { 7887 return err 7888 } 7889 } else { 7890 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7891 return err 7892 } 7893 } 7894 case 2: 7895 if fieldTypeId == thrift.I64 { 7896 if err := p.ReadField2(ctx, iprot); err != nil { 7897 return err 7898 } 7899 issetFileOffset = true 7900 } else { 7901 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7902 return err 7903 } 7904 } 7905 case 3: 7906 if fieldTypeId == thrift.STRUCT { 7907 if err := p.ReadField3(ctx, iprot); err != nil { 7908 return err 7909 } 7910 } else { 7911 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7912 return err 7913 } 7914 } 7915 case 4: 7916 if fieldTypeId == thrift.I64 { 7917 if err := p.ReadField4(ctx, iprot); err != nil { 7918 return err 7919 } 7920 } else { 7921 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7922 return err 7923 } 7924 } 7925 case 5: 7926 if fieldTypeId == thrift.I32 { 7927 if err := p.ReadField5(ctx, iprot); err != nil { 7928 return err 7929 } 7930 } else { 7931 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7932 return err 7933 } 7934 } 7935 case 6: 7936 if fieldTypeId == thrift.I64 { 7937 if err := p.ReadField6(ctx, iprot); err != nil { 7938 return err 7939 } 7940 } else { 7941 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7942 return err 7943 } 7944 } 7945 case 7: 7946 if fieldTypeId == thrift.I32 { 7947 if err := p.ReadField7(ctx, iprot); err != nil { 7948 return err 7949 } 7950 } else { 7951 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7952 return err 7953 } 7954 } 7955 case 8: 7956 if fieldTypeId == thrift.STRUCT { 7957 if err := p.ReadField8(ctx, iprot); err != nil { 7958 return err 7959 } 7960 } else { 7961 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7962 return err 7963 } 7964 } 7965 case 9: 7966 if fieldTypeId == thrift.STRING { 7967 if err := p.ReadField9(ctx, iprot); err != nil { 7968 return err 7969 } 7970 } else { 7971 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7972 return err 7973 } 7974 } 7975 default: 7976 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7977 return err 7978 } 7979 } 7980 if err := iprot.ReadFieldEnd(ctx); err != nil { 7981 return err 7982 } 7983 } 7984 if err := iprot.ReadStructEnd(ctx); err != nil { 7985 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 7986 } 7987 if !issetFileOffset{ 7988 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FileOffset is not set")); 7989 } 7990 return nil 7991} 7992 7993func (p *ColumnChunk) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 7994 if v, err := iprot.ReadString(ctx); err != nil { 7995 return thrift.PrependError("error reading field 1: ", err) 7996} else { 7997 p.FilePath = &v 7998} 7999 return nil 8000} 8001 8002func (p *ColumnChunk) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 8003 if v, err := iprot.ReadI64(ctx); err != nil { 8004 return thrift.PrependError("error reading field 2: ", err) 8005} else { 8006 p.FileOffset = v 8007} 8008 return nil 8009} 8010 8011func (p *ColumnChunk) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 8012 p.MetaData = &ColumnMetaData{} 8013 if err := p.MetaData.Read(ctx, iprot); err != nil { 8014 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.MetaData), err) 8015 } 8016 return nil 8017} 8018 8019func (p *ColumnChunk) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 8020 if v, err := iprot.ReadI64(ctx); err != nil { 8021 return thrift.PrependError("error reading field 4: ", err) 8022} else { 8023 p.OffsetIndexOffset = &v 8024} 8025 return nil 8026} 8027 8028func (p *ColumnChunk) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 8029 if v, err := iprot.ReadI32(ctx); err != nil { 8030 return thrift.PrependError("error reading field 5: ", err) 8031} else { 8032 p.OffsetIndexLength = &v 8033} 8034 return nil 8035} 8036 8037func (p *ColumnChunk) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 8038 if v, err := iprot.ReadI64(ctx); err != nil { 8039 return thrift.PrependError("error reading field 6: ", err) 8040} else { 8041 p.ColumnIndexOffset = &v 8042} 8043 return nil 8044} 8045 8046func (p *ColumnChunk) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 8047 if v, err := iprot.ReadI32(ctx); err != nil { 8048 return thrift.PrependError("error reading field 7: ", err) 8049} else { 8050 p.ColumnIndexLength = &v 8051} 8052 return nil 8053} 8054 8055func (p *ColumnChunk) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 8056 p.CryptoMetadata = &ColumnCryptoMetaData{} 8057 if err := p.CryptoMetadata.Read(ctx, iprot); err != nil { 8058 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.CryptoMetadata), err) 8059 } 8060 return nil 8061} 8062 8063func (p *ColumnChunk) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { 8064 if v, err := iprot.ReadBinary(ctx); err != nil { 8065 return thrift.PrependError("error reading field 9: ", err) 8066} else { 8067 p.EncryptedColumnMetadata = v 8068} 8069 return nil 8070} 8071 8072func (p *ColumnChunk) Write(ctx context.Context, oprot thrift.TProtocol) error { 8073 if err := oprot.WriteStructBegin(ctx, "ColumnChunk"); err != nil { 8074 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 8075 if p != nil { 8076 if err := p.writeField1(ctx, oprot); err != nil { return err } 8077 if err := p.writeField2(ctx, oprot); err != nil { return err } 8078 if err := p.writeField3(ctx, oprot); err != nil { return err } 8079 if err := p.writeField4(ctx, oprot); err != nil { return err } 8080 if err := p.writeField5(ctx, oprot); err != nil { return err } 8081 if err := p.writeField6(ctx, oprot); err != nil { return err } 8082 if err := p.writeField7(ctx, oprot); err != nil { return err } 8083 if err := p.writeField8(ctx, oprot); err != nil { return err } 8084 if err := p.writeField9(ctx, oprot); err != nil { return err } 8085 } 8086 if err := oprot.WriteFieldStop(ctx); err != nil { 8087 return thrift.PrependError("write field stop error: ", err) } 8088 if err := oprot.WriteStructEnd(ctx); err != nil { 8089 return thrift.PrependError("write struct stop error: ", err) } 8090 return nil 8091} 8092 8093func (p *ColumnChunk) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 8094 if p.IsSetFilePath() { 8095 if err := oprot.WriteFieldBegin(ctx, "file_path", thrift.STRING, 1); err != nil { 8096 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:file_path: ", p), err) } 8097 if err := oprot.WriteString(ctx, string(*p.FilePath)); err != nil { 8098 return thrift.PrependError(fmt.Sprintf("%T.file_path (1) field write error: ", p), err) } 8099 if err := oprot.WriteFieldEnd(ctx); err != nil { 8100 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:file_path: ", p), err) } 8101 } 8102 return err 8103} 8104 8105func (p *ColumnChunk) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 8106 if err := oprot.WriteFieldBegin(ctx, "file_offset", thrift.I64, 2); err != nil { 8107 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:file_offset: ", p), err) } 8108 if err := oprot.WriteI64(ctx, int64(p.FileOffset)); err != nil { 8109 return thrift.PrependError(fmt.Sprintf("%T.file_offset (2) field write error: ", p), err) } 8110 if err := oprot.WriteFieldEnd(ctx); err != nil { 8111 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:file_offset: ", p), err) } 8112 return err 8113} 8114 8115func (p *ColumnChunk) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 8116 if p.IsSetMetaData() { 8117 if err := oprot.WriteFieldBegin(ctx, "meta_data", thrift.STRUCT, 3); err != nil { 8118 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:meta_data: ", p), err) } 8119 if err := p.MetaData.Write(ctx, oprot); err != nil { 8120 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.MetaData), err) 8121 } 8122 if err := oprot.WriteFieldEnd(ctx); err != nil { 8123 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:meta_data: ", p), err) } 8124 } 8125 return err 8126} 8127 8128func (p *ColumnChunk) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 8129 if p.IsSetOffsetIndexOffset() { 8130 if err := oprot.WriteFieldBegin(ctx, "offset_index_offset", thrift.I64, 4); err != nil { 8131 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:offset_index_offset: ", p), err) } 8132 if err := oprot.WriteI64(ctx, int64(*p.OffsetIndexOffset)); err != nil { 8133 return thrift.PrependError(fmt.Sprintf("%T.offset_index_offset (4) field write error: ", p), err) } 8134 if err := oprot.WriteFieldEnd(ctx); err != nil { 8135 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:offset_index_offset: ", p), err) } 8136 } 8137 return err 8138} 8139 8140func (p *ColumnChunk) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 8141 if p.IsSetOffsetIndexLength() { 8142 if err := oprot.WriteFieldBegin(ctx, "offset_index_length", thrift.I32, 5); err != nil { 8143 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:offset_index_length: ", p), err) } 8144 if err := oprot.WriteI32(ctx, int32(*p.OffsetIndexLength)); err != nil { 8145 return thrift.PrependError(fmt.Sprintf("%T.offset_index_length (5) field write error: ", p), err) } 8146 if err := oprot.WriteFieldEnd(ctx); err != nil { 8147 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:offset_index_length: ", p), err) } 8148 } 8149 return err 8150} 8151 8152func (p *ColumnChunk) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 8153 if p.IsSetColumnIndexOffset() { 8154 if err := oprot.WriteFieldBegin(ctx, "column_index_offset", thrift.I64, 6); err != nil { 8155 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:column_index_offset: ", p), err) } 8156 if err := oprot.WriteI64(ctx, int64(*p.ColumnIndexOffset)); err != nil { 8157 return thrift.PrependError(fmt.Sprintf("%T.column_index_offset (6) field write error: ", p), err) } 8158 if err := oprot.WriteFieldEnd(ctx); err != nil { 8159 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:column_index_offset: ", p), err) } 8160 } 8161 return err 8162} 8163 8164func (p *ColumnChunk) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 8165 if p.IsSetColumnIndexLength() { 8166 if err := oprot.WriteFieldBegin(ctx, "column_index_length", thrift.I32, 7); err != nil { 8167 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:column_index_length: ", p), err) } 8168 if err := oprot.WriteI32(ctx, int32(*p.ColumnIndexLength)); err != nil { 8169 return thrift.PrependError(fmt.Sprintf("%T.column_index_length (7) field write error: ", p), err) } 8170 if err := oprot.WriteFieldEnd(ctx); err != nil { 8171 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:column_index_length: ", p), err) } 8172 } 8173 return err 8174} 8175 8176func (p *ColumnChunk) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 8177 if p.IsSetCryptoMetadata() { 8178 if err := oprot.WriteFieldBegin(ctx, "crypto_metadata", thrift.STRUCT, 8); err != nil { 8179 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:crypto_metadata: ", p), err) } 8180 if err := p.CryptoMetadata.Write(ctx, oprot); err != nil { 8181 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.CryptoMetadata), err) 8182 } 8183 if err := oprot.WriteFieldEnd(ctx); err != nil { 8184 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:crypto_metadata: ", p), err) } 8185 } 8186 return err 8187} 8188 8189func (p *ColumnChunk) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { 8190 if p.IsSetEncryptedColumnMetadata() { 8191 if err := oprot.WriteFieldBegin(ctx, "encrypted_column_metadata", thrift.STRING, 9); err != nil { 8192 return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:encrypted_column_metadata: ", p), err) } 8193 if err := oprot.WriteBinary(ctx, p.EncryptedColumnMetadata); err != nil { 8194 return thrift.PrependError(fmt.Sprintf("%T.encrypted_column_metadata (9) field write error: ", p), err) } 8195 if err := oprot.WriteFieldEnd(ctx); err != nil { 8196 return thrift.PrependError(fmt.Sprintf("%T write field end error 9:encrypted_column_metadata: ", p), err) } 8197 } 8198 return err 8199} 8200 8201func (p *ColumnChunk) Equals(other *ColumnChunk) bool { 8202 if p == other { 8203 return true 8204 } else if p == nil || other == nil { 8205 return false 8206 } 8207 if p.FilePath != other.FilePath { 8208 if p.FilePath == nil || other.FilePath == nil { 8209 return false 8210 } 8211 if (*p.FilePath) != (*other.FilePath) { return false } 8212 } 8213 if p.FileOffset != other.FileOffset { return false } 8214 if !p.MetaData.Equals(other.MetaData) { return false } 8215 if p.OffsetIndexOffset != other.OffsetIndexOffset { 8216 if p.OffsetIndexOffset == nil || other.OffsetIndexOffset == nil { 8217 return false 8218 } 8219 if (*p.OffsetIndexOffset) != (*other.OffsetIndexOffset) { return false } 8220 } 8221 if p.OffsetIndexLength != other.OffsetIndexLength { 8222 if p.OffsetIndexLength == nil || other.OffsetIndexLength == nil { 8223 return false 8224 } 8225 if (*p.OffsetIndexLength) != (*other.OffsetIndexLength) { return false } 8226 } 8227 if p.ColumnIndexOffset != other.ColumnIndexOffset { 8228 if p.ColumnIndexOffset == nil || other.ColumnIndexOffset == nil { 8229 return false 8230 } 8231 if (*p.ColumnIndexOffset) != (*other.ColumnIndexOffset) { return false } 8232 } 8233 if p.ColumnIndexLength != other.ColumnIndexLength { 8234 if p.ColumnIndexLength == nil || other.ColumnIndexLength == nil { 8235 return false 8236 } 8237 if (*p.ColumnIndexLength) != (*other.ColumnIndexLength) { return false } 8238 } 8239 if !p.CryptoMetadata.Equals(other.CryptoMetadata) { return false } 8240 if bytes.Compare(p.EncryptedColumnMetadata, other.EncryptedColumnMetadata) != 0 { return false } 8241 return true 8242} 8243 8244func (p *ColumnChunk) String() string { 8245 if p == nil { 8246 return "<nil>" 8247 } 8248 return fmt.Sprintf("ColumnChunk(%+v)", *p) 8249} 8250 8251// Attributes: 8252// - Columns: Metadata for each column chunk in this row group. 8253// This list must have the same order as the SchemaElement list in FileMetaData. 8254// 8255// - TotalByteSize: Total byte size of all the uncompressed column data in this row group * 8256// - NumRows: Number of rows in this row group * 8257// - SortingColumns: If set, specifies a sort ordering of the rows in this RowGroup. 8258// The sorting columns can be a subset of all the columns. 8259// - FileOffset: Byte offset from beginning of file to first page (data or dictionary) 8260// in this row group * 8261// - TotalCompressedSize: Total byte size of all compressed (and potentially encrypted) column data 8262// in this row group * 8263// - Ordinal: Row group ordinal in the file * 8264type RowGroup struct { 8265 Columns []*ColumnChunk `thrift:"columns,1,required" db:"columns" json:"columns"` 8266 TotalByteSize int64 `thrift:"total_byte_size,2,required" db:"total_byte_size" json:"total_byte_size"` 8267 NumRows int64 `thrift:"num_rows,3,required" db:"num_rows" json:"num_rows"` 8268 SortingColumns []*SortingColumn `thrift:"sorting_columns,4" db:"sorting_columns" json:"sorting_columns,omitempty"` 8269 FileOffset *int64 `thrift:"file_offset,5" db:"file_offset" json:"file_offset,omitempty"` 8270 TotalCompressedSize *int64 `thrift:"total_compressed_size,6" db:"total_compressed_size" json:"total_compressed_size,omitempty"` 8271 Ordinal *int16 `thrift:"ordinal,7" db:"ordinal" json:"ordinal,omitempty"` 8272} 8273 8274func NewRowGroup() *RowGroup { 8275 return &RowGroup{} 8276} 8277 8278 8279func (p *RowGroup) GetColumns() []*ColumnChunk { 8280 return p.Columns 8281} 8282 8283func (p *RowGroup) GetTotalByteSize() int64 { 8284 return p.TotalByteSize 8285} 8286 8287func (p *RowGroup) GetNumRows() int64 { 8288 return p.NumRows 8289} 8290var RowGroup_SortingColumns_DEFAULT []*SortingColumn 8291 8292func (p *RowGroup) GetSortingColumns() []*SortingColumn { 8293 return p.SortingColumns 8294} 8295var RowGroup_FileOffset_DEFAULT int64 8296func (p *RowGroup) GetFileOffset() int64 { 8297 if !p.IsSetFileOffset() { 8298 return RowGroup_FileOffset_DEFAULT 8299 } 8300return *p.FileOffset 8301} 8302var RowGroup_TotalCompressedSize_DEFAULT int64 8303func (p *RowGroup) GetTotalCompressedSize() int64 { 8304 if !p.IsSetTotalCompressedSize() { 8305 return RowGroup_TotalCompressedSize_DEFAULT 8306 } 8307return *p.TotalCompressedSize 8308} 8309var RowGroup_Ordinal_DEFAULT int16 8310func (p *RowGroup) GetOrdinal() int16 { 8311 if !p.IsSetOrdinal() { 8312 return RowGroup_Ordinal_DEFAULT 8313 } 8314return *p.Ordinal 8315} 8316func (p *RowGroup) IsSetSortingColumns() bool { 8317 return p.SortingColumns != nil 8318} 8319 8320func (p *RowGroup) IsSetFileOffset() bool { 8321 return p.FileOffset != nil 8322} 8323 8324func (p *RowGroup) IsSetTotalCompressedSize() bool { 8325 return p.TotalCompressedSize != nil 8326} 8327 8328func (p *RowGroup) IsSetOrdinal() bool { 8329 return p.Ordinal != nil 8330} 8331 8332func (p *RowGroup) Read(ctx context.Context, iprot thrift.TProtocol) error { 8333 if _, err := iprot.ReadStructBegin(ctx); err != nil { 8334 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 8335 } 8336 8337 var issetColumns bool = false; 8338 var issetTotalByteSize bool = false; 8339 var issetNumRows bool = false; 8340 8341 for { 8342 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 8343 if err != nil { 8344 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 8345 } 8346 if fieldTypeId == thrift.STOP { break; } 8347 switch fieldId { 8348 case 1: 8349 if fieldTypeId == thrift.LIST { 8350 if err := p.ReadField1(ctx, iprot); err != nil { 8351 return err 8352 } 8353 issetColumns = true 8354 } else { 8355 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8356 return err 8357 } 8358 } 8359 case 2: 8360 if fieldTypeId == thrift.I64 { 8361 if err := p.ReadField2(ctx, iprot); err != nil { 8362 return err 8363 } 8364 issetTotalByteSize = true 8365 } else { 8366 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8367 return err 8368 } 8369 } 8370 case 3: 8371 if fieldTypeId == thrift.I64 { 8372 if err := p.ReadField3(ctx, iprot); err != nil { 8373 return err 8374 } 8375 issetNumRows = true 8376 } else { 8377 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8378 return err 8379 } 8380 } 8381 case 4: 8382 if fieldTypeId == thrift.LIST { 8383 if err := p.ReadField4(ctx, iprot); err != nil { 8384 return err 8385 } 8386 } else { 8387 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8388 return err 8389 } 8390 } 8391 case 5: 8392 if fieldTypeId == thrift.I64 { 8393 if err := p.ReadField5(ctx, iprot); err != nil { 8394 return err 8395 } 8396 } else { 8397 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8398 return err 8399 } 8400 } 8401 case 6: 8402 if fieldTypeId == thrift.I64 { 8403 if err := p.ReadField6(ctx, iprot); err != nil { 8404 return err 8405 } 8406 } else { 8407 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8408 return err 8409 } 8410 } 8411 case 7: 8412 if fieldTypeId == thrift.I16 { 8413 if err := p.ReadField7(ctx, iprot); err != nil { 8414 return err 8415 } 8416 } else { 8417 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8418 return err 8419 } 8420 } 8421 default: 8422 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8423 return err 8424 } 8425 } 8426 if err := iprot.ReadFieldEnd(ctx); err != nil { 8427 return err 8428 } 8429 } 8430 if err := iprot.ReadStructEnd(ctx); err != nil { 8431 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 8432 } 8433 if !issetColumns{ 8434 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Columns is not set")); 8435 } 8436 if !issetTotalByteSize{ 8437 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TotalByteSize is not set")); 8438 } 8439 if !issetNumRows{ 8440 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumRows is not set")); 8441 } 8442 return nil 8443} 8444 8445func (p *RowGroup) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 8446 _, size, err := iprot.ReadListBegin(ctx) 8447 if err != nil { 8448 return thrift.PrependError("error reading list begin: ", err) 8449 } 8450 tSlice := make([]*ColumnChunk, 0, size) 8451 p.Columns = tSlice 8452 for i := 0; i < size; i ++ { 8453 _elem10 := &ColumnChunk{} 8454 if err := _elem10.Read(ctx, iprot); err != nil { 8455 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) 8456 } 8457 p.Columns = append(p.Columns, _elem10) 8458 } 8459 if err := iprot.ReadListEnd(ctx); err != nil { 8460 return thrift.PrependError("error reading list end: ", err) 8461 } 8462 return nil 8463} 8464 8465func (p *RowGroup) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 8466 if v, err := iprot.ReadI64(ctx); err != nil { 8467 return thrift.PrependError("error reading field 2: ", err) 8468} else { 8469 p.TotalByteSize = v 8470} 8471 return nil 8472} 8473 8474func (p *RowGroup) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 8475 if v, err := iprot.ReadI64(ctx); err != nil { 8476 return thrift.PrependError("error reading field 3: ", err) 8477} else { 8478 p.NumRows = v 8479} 8480 return nil 8481} 8482 8483func (p *RowGroup) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 8484 _, size, err := iprot.ReadListBegin(ctx) 8485 if err != nil { 8486 return thrift.PrependError("error reading list begin: ", err) 8487 } 8488 tSlice := make([]*SortingColumn, 0, size) 8489 p.SortingColumns = tSlice 8490 for i := 0; i < size; i ++ { 8491 _elem11 := &SortingColumn{} 8492 if err := _elem11.Read(ctx, iprot); err != nil { 8493 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem11), err) 8494 } 8495 p.SortingColumns = append(p.SortingColumns, _elem11) 8496 } 8497 if err := iprot.ReadListEnd(ctx); err != nil { 8498 return thrift.PrependError("error reading list end: ", err) 8499 } 8500 return nil 8501} 8502 8503func (p *RowGroup) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 8504 if v, err := iprot.ReadI64(ctx); err != nil { 8505 return thrift.PrependError("error reading field 5: ", err) 8506} else { 8507 p.FileOffset = &v 8508} 8509 return nil 8510} 8511 8512func (p *RowGroup) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 8513 if v, err := iprot.ReadI64(ctx); err != nil { 8514 return thrift.PrependError("error reading field 6: ", err) 8515} else { 8516 p.TotalCompressedSize = &v 8517} 8518 return nil 8519} 8520 8521func (p *RowGroup) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 8522 if v, err := iprot.ReadI16(ctx); err != nil { 8523 return thrift.PrependError("error reading field 7: ", err) 8524} else { 8525 p.Ordinal = &v 8526} 8527 return nil 8528} 8529 8530func (p *RowGroup) Write(ctx context.Context, oprot thrift.TProtocol) error { 8531 if err := oprot.WriteStructBegin(ctx, "RowGroup"); err != nil { 8532 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 8533 if p != nil { 8534 if err := p.writeField1(ctx, oprot); err != nil { return err } 8535 if err := p.writeField2(ctx, oprot); err != nil { return err } 8536 if err := p.writeField3(ctx, oprot); err != nil { return err } 8537 if err := p.writeField4(ctx, oprot); err != nil { return err } 8538 if err := p.writeField5(ctx, oprot); err != nil { return err } 8539 if err := p.writeField6(ctx, oprot); err != nil { return err } 8540 if err := p.writeField7(ctx, oprot); err != nil { return err } 8541 } 8542 if err := oprot.WriteFieldStop(ctx); err != nil { 8543 return thrift.PrependError("write field stop error: ", err) } 8544 if err := oprot.WriteStructEnd(ctx); err != nil { 8545 return thrift.PrependError("write struct stop error: ", err) } 8546 return nil 8547} 8548 8549func (p *RowGroup) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 8550 if err := oprot.WriteFieldBegin(ctx, "columns", thrift.LIST, 1); err != nil { 8551 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:columns: ", p), err) } 8552 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Columns)); err != nil { 8553 return thrift.PrependError("error writing list begin: ", err) 8554 } 8555 for _, v := range p.Columns { 8556 if err := v.Write(ctx, oprot); err != nil { 8557 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 8558 } 8559 } 8560 if err := oprot.WriteListEnd(ctx); err != nil { 8561 return thrift.PrependError("error writing list end: ", err) 8562 } 8563 if err := oprot.WriteFieldEnd(ctx); err != nil { 8564 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:columns: ", p), err) } 8565 return err 8566} 8567 8568func (p *RowGroup) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 8569 if err := oprot.WriteFieldBegin(ctx, "total_byte_size", thrift.I64, 2); err != nil { 8570 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:total_byte_size: ", p), err) } 8571 if err := oprot.WriteI64(ctx, int64(p.TotalByteSize)); err != nil { 8572 return thrift.PrependError(fmt.Sprintf("%T.total_byte_size (2) field write error: ", p), err) } 8573 if err := oprot.WriteFieldEnd(ctx); err != nil { 8574 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:total_byte_size: ", p), err) } 8575 return err 8576} 8577 8578func (p *RowGroup) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 8579 if err := oprot.WriteFieldBegin(ctx, "num_rows", thrift.I64, 3); err != nil { 8580 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:num_rows: ", p), err) } 8581 if err := oprot.WriteI64(ctx, int64(p.NumRows)); err != nil { 8582 return thrift.PrependError(fmt.Sprintf("%T.num_rows (3) field write error: ", p), err) } 8583 if err := oprot.WriteFieldEnd(ctx); err != nil { 8584 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:num_rows: ", p), err) } 8585 return err 8586} 8587 8588func (p *RowGroup) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 8589 if p.IsSetSortingColumns() { 8590 if err := oprot.WriteFieldBegin(ctx, "sorting_columns", thrift.LIST, 4); err != nil { 8591 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:sorting_columns: ", p), err) } 8592 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.SortingColumns)); err != nil { 8593 return thrift.PrependError("error writing list begin: ", err) 8594 } 8595 for _, v := range p.SortingColumns { 8596 if err := v.Write(ctx, oprot); err != nil { 8597 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 8598 } 8599 } 8600 if err := oprot.WriteListEnd(ctx); err != nil { 8601 return thrift.PrependError("error writing list end: ", err) 8602 } 8603 if err := oprot.WriteFieldEnd(ctx); err != nil { 8604 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:sorting_columns: ", p), err) } 8605 } 8606 return err 8607} 8608 8609func (p *RowGroup) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 8610 if p.IsSetFileOffset() { 8611 if err := oprot.WriteFieldBegin(ctx, "file_offset", thrift.I64, 5); err != nil { 8612 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:file_offset: ", p), err) } 8613 if err := oprot.WriteI64(ctx, int64(*p.FileOffset)); err != nil { 8614 return thrift.PrependError(fmt.Sprintf("%T.file_offset (5) field write error: ", p), err) } 8615 if err := oprot.WriteFieldEnd(ctx); err != nil { 8616 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:file_offset: ", p), err) } 8617 } 8618 return err 8619} 8620 8621func (p *RowGroup) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 8622 if p.IsSetTotalCompressedSize() { 8623 if err := oprot.WriteFieldBegin(ctx, "total_compressed_size", thrift.I64, 6); err != nil { 8624 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:total_compressed_size: ", p), err) } 8625 if err := oprot.WriteI64(ctx, int64(*p.TotalCompressedSize)); err != nil { 8626 return thrift.PrependError(fmt.Sprintf("%T.total_compressed_size (6) field write error: ", p), err) } 8627 if err := oprot.WriteFieldEnd(ctx); err != nil { 8628 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:total_compressed_size: ", p), err) } 8629 } 8630 return err 8631} 8632 8633func (p *RowGroup) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 8634 if p.IsSetOrdinal() { 8635 if err := oprot.WriteFieldBegin(ctx, "ordinal", thrift.I16, 7); err != nil { 8636 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:ordinal: ", p), err) } 8637 if err := oprot.WriteI16(ctx, int16(*p.Ordinal)); err != nil { 8638 return thrift.PrependError(fmt.Sprintf("%T.ordinal (7) field write error: ", p), err) } 8639 if err := oprot.WriteFieldEnd(ctx); err != nil { 8640 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:ordinal: ", p), err) } 8641 } 8642 return err 8643} 8644 8645func (p *RowGroup) Equals(other *RowGroup) bool { 8646 if p == other { 8647 return true 8648 } else if p == nil || other == nil { 8649 return false 8650 } 8651 if len(p.Columns) != len(other.Columns) { return false } 8652 for i, _tgt := range p.Columns { 8653 _src12 := other.Columns[i] 8654 if !_tgt.Equals(_src12) { return false } 8655 } 8656 if p.TotalByteSize != other.TotalByteSize { return false } 8657 if p.NumRows != other.NumRows { return false } 8658 if len(p.SortingColumns) != len(other.SortingColumns) { return false } 8659 for i, _tgt := range p.SortingColumns { 8660 _src13 := other.SortingColumns[i] 8661 if !_tgt.Equals(_src13) { return false } 8662 } 8663 if p.FileOffset != other.FileOffset { 8664 if p.FileOffset == nil || other.FileOffset == nil { 8665 return false 8666 } 8667 if (*p.FileOffset) != (*other.FileOffset) { return false } 8668 } 8669 if p.TotalCompressedSize != other.TotalCompressedSize { 8670 if p.TotalCompressedSize == nil || other.TotalCompressedSize == nil { 8671 return false 8672 } 8673 if (*p.TotalCompressedSize) != (*other.TotalCompressedSize) { return false } 8674 } 8675 if p.Ordinal != other.Ordinal { 8676 if p.Ordinal == nil || other.Ordinal == nil { 8677 return false 8678 } 8679 if (*p.Ordinal) != (*other.Ordinal) { return false } 8680 } 8681 return true 8682} 8683 8684func (p *RowGroup) String() string { 8685 if p == nil { 8686 return "<nil>" 8687 } 8688 return fmt.Sprintf("RowGroup(%+v)", *p) 8689} 8690 8691// Empty struct to signal the order defined by the physical or logical type 8692type TypeDefinedOrder struct { 8693} 8694 8695func NewTypeDefinedOrder() *TypeDefinedOrder { 8696 return &TypeDefinedOrder{} 8697} 8698 8699func (p *TypeDefinedOrder) Read(ctx context.Context, iprot thrift.TProtocol) error { 8700 if _, err := iprot.ReadStructBegin(ctx); err != nil { 8701 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 8702 } 8703 8704 8705 for { 8706 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 8707 if err != nil { 8708 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 8709 } 8710 if fieldTypeId == thrift.STOP { break; } 8711 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8712 return err 8713 } 8714 if err := iprot.ReadFieldEnd(ctx); err != nil { 8715 return err 8716 } 8717 } 8718 if err := iprot.ReadStructEnd(ctx); err != nil { 8719 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 8720 } 8721 return nil 8722} 8723 8724func (p *TypeDefinedOrder) Write(ctx context.Context, oprot thrift.TProtocol) error { 8725 if err := oprot.WriteStructBegin(ctx, "TypeDefinedOrder"); err != nil { 8726 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 8727 if p != nil { 8728 } 8729 if err := oprot.WriteFieldStop(ctx); err != nil { 8730 return thrift.PrependError("write field stop error: ", err) } 8731 if err := oprot.WriteStructEnd(ctx); err != nil { 8732 return thrift.PrependError("write struct stop error: ", err) } 8733 return nil 8734} 8735 8736func (p *TypeDefinedOrder) Equals(other *TypeDefinedOrder) bool { 8737 if p == other { 8738 return true 8739 } else if p == nil || other == nil { 8740 return false 8741 } 8742 return true 8743} 8744 8745func (p *TypeDefinedOrder) String() string { 8746 if p == nil { 8747 return "<nil>" 8748 } 8749 return fmt.Sprintf("TypeDefinedOrder(%+v)", *p) 8750} 8751 8752// Union to specify the order used for the min_value and max_value fields for a 8753// column. This union takes the role of an enhanced enum that allows rich 8754// elements (which will be needed for a collation-based ordering in the future). 8755// 8756// Possible values are: 8757// * TypeDefinedOrder - the column uses the order defined by its logical or 8758// physical type (if there is no logical type). 8759// 8760// If the reader does not support the value of this union, min and max stats 8761// for this column should be ignored. 8762// 8763// Attributes: 8764// - TYPE_ORDER: The sort orders for logical types are: 8765// UTF8 - unsigned byte-wise comparison 8766// INT8 - signed comparison 8767// INT16 - signed comparison 8768// INT32 - signed comparison 8769// INT64 - signed comparison 8770// UINT8 - unsigned comparison 8771// UINT16 - unsigned comparison 8772// UINT32 - unsigned comparison 8773// UINT64 - unsigned comparison 8774// DECIMAL - signed comparison of the represented value 8775// DATE - signed comparison 8776// TIME_MILLIS - signed comparison 8777// TIME_MICROS - signed comparison 8778// TIMESTAMP_MILLIS - signed comparison 8779// TIMESTAMP_MICROS - signed comparison 8780// INTERVAL - unsigned comparison 8781// JSON - unsigned byte-wise comparison 8782// BSON - unsigned byte-wise comparison 8783// ENUM - unsigned byte-wise comparison 8784// LIST - undefined 8785// MAP - undefined 8786// 8787// In the absence of logical types, the sort order is determined by the physical type: 8788// BOOLEAN - false, true 8789// INT32 - signed comparison 8790// INT64 - signed comparison 8791// INT96 (only used for legacy timestamps) - undefined 8792// FLOAT - signed comparison of the represented value (*) 8793// DOUBLE - signed comparison of the represented value (*) 8794// BYTE_ARRAY - unsigned byte-wise comparison 8795// FIXED_LEN_BYTE_ARRAY - unsigned byte-wise comparison 8796// 8797// (*) Because the sorting order is not specified properly for floating 8798// point values (relations vs. total ordering) the following 8799// compatibility rules should be applied when reading statistics: 8800// - If the min is a NaN, it should be ignored. 8801// - If the max is a NaN, it should be ignored. 8802// - If the min is +0, the row group may contain -0 values as well. 8803// - If the max is -0, the row group may contain +0 values as well. 8804// - When looking for NaN values, min and max should be ignored. 8805type ColumnOrder struct { 8806 TYPE_ORDER *TypeDefinedOrder `thrift:"TYPE_ORDER,1" db:"TYPE_ORDER" json:"TYPE_ORDER,omitempty"` 8807} 8808 8809func NewColumnOrder() *ColumnOrder { 8810 return &ColumnOrder{} 8811} 8812 8813var ColumnOrder_TYPE_ORDER_DEFAULT *TypeDefinedOrder 8814func (p *ColumnOrder) GetTYPE_ORDER() *TypeDefinedOrder { 8815 if !p.IsSetTYPE_ORDER() { 8816 return ColumnOrder_TYPE_ORDER_DEFAULT 8817 } 8818return p.TYPE_ORDER 8819} 8820func (p *ColumnOrder) CountSetFieldsColumnOrder() int { 8821 count := 0 8822 if (p.IsSetTYPE_ORDER()) { 8823 count++ 8824 } 8825 return count 8826 8827} 8828 8829func (p *ColumnOrder) IsSetTYPE_ORDER() bool { 8830 return p.TYPE_ORDER != nil 8831} 8832 8833func (p *ColumnOrder) Read(ctx context.Context, iprot thrift.TProtocol) error { 8834 if _, err := iprot.ReadStructBegin(ctx); err != nil { 8835 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 8836 } 8837 8838 8839 for { 8840 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 8841 if err != nil { 8842 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 8843 } 8844 if fieldTypeId == thrift.STOP { break; } 8845 switch fieldId { 8846 case 1: 8847 if fieldTypeId == thrift.STRUCT { 8848 if err := p.ReadField1(ctx, iprot); err != nil { 8849 return err 8850 } 8851 } else { 8852 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8853 return err 8854 } 8855 } 8856 default: 8857 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8858 return err 8859 } 8860 } 8861 if err := iprot.ReadFieldEnd(ctx); err != nil { 8862 return err 8863 } 8864 } 8865 if err := iprot.ReadStructEnd(ctx); err != nil { 8866 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 8867 } 8868 return nil 8869} 8870 8871func (p *ColumnOrder) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 8872 p.TYPE_ORDER = &TypeDefinedOrder{} 8873 if err := p.TYPE_ORDER.Read(ctx, iprot); err != nil { 8874 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TYPE_ORDER), err) 8875 } 8876 return nil 8877} 8878 8879func (p *ColumnOrder) Write(ctx context.Context, oprot thrift.TProtocol) error { 8880 if c := p.CountSetFieldsColumnOrder(); c != 1 { 8881 return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) 8882 } 8883 if err := oprot.WriteStructBegin(ctx, "ColumnOrder"); err != nil { 8884 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 8885 if p != nil { 8886 if err := p.writeField1(ctx, oprot); err != nil { return err } 8887 } 8888 if err := oprot.WriteFieldStop(ctx); err != nil { 8889 return thrift.PrependError("write field stop error: ", err) } 8890 if err := oprot.WriteStructEnd(ctx); err != nil { 8891 return thrift.PrependError("write struct stop error: ", err) } 8892 return nil 8893} 8894 8895func (p *ColumnOrder) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 8896 if p.IsSetTYPE_ORDER() { 8897 if err := oprot.WriteFieldBegin(ctx, "TYPE_ORDER", thrift.STRUCT, 1); err != nil { 8898 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:TYPE_ORDER: ", p), err) } 8899 if err := p.TYPE_ORDER.Write(ctx, oprot); err != nil { 8900 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TYPE_ORDER), err) 8901 } 8902 if err := oprot.WriteFieldEnd(ctx); err != nil { 8903 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:TYPE_ORDER: ", p), err) } 8904 } 8905 return err 8906} 8907 8908func (p *ColumnOrder) Equals(other *ColumnOrder) bool { 8909 if p == other { 8910 return true 8911 } else if p == nil || other == nil { 8912 return false 8913 } 8914 if !p.TYPE_ORDER.Equals(other.TYPE_ORDER) { return false } 8915 return true 8916} 8917 8918func (p *ColumnOrder) String() string { 8919 if p == nil { 8920 return "<nil>" 8921 } 8922 return fmt.Sprintf("ColumnOrder(%+v)", *p) 8923} 8924 8925// Attributes: 8926// - Offset: Offset of the page in the file * 8927// - CompressedPageSize: Size of the page, including header. Sum of compressed_page_size and header 8928// length 8929// - FirstRowIndex: Index within the RowGroup of the first row of the page; this means pages 8930// change on record boundaries (r = 0). 8931type PageLocation struct { 8932 Offset int64 `thrift:"offset,1,required" db:"offset" json:"offset"` 8933 CompressedPageSize int32 `thrift:"compressed_page_size,2,required" db:"compressed_page_size" json:"compressed_page_size"` 8934 FirstRowIndex int64 `thrift:"first_row_index,3,required" db:"first_row_index" json:"first_row_index"` 8935} 8936 8937func NewPageLocation() *PageLocation { 8938 return &PageLocation{} 8939} 8940 8941 8942func (p *PageLocation) GetOffset() int64 { 8943 return p.Offset 8944} 8945 8946func (p *PageLocation) GetCompressedPageSize() int32 { 8947 return p.CompressedPageSize 8948} 8949 8950func (p *PageLocation) GetFirstRowIndex() int64 { 8951 return p.FirstRowIndex 8952} 8953func (p *PageLocation) Read(ctx context.Context, iprot thrift.TProtocol) error { 8954 if _, err := iprot.ReadStructBegin(ctx); err != nil { 8955 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 8956 } 8957 8958 var issetOffset bool = false; 8959 var issetCompressedPageSize bool = false; 8960 var issetFirstRowIndex bool = false; 8961 8962 for { 8963 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 8964 if err != nil { 8965 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 8966 } 8967 if fieldTypeId == thrift.STOP { break; } 8968 switch fieldId { 8969 case 1: 8970 if fieldTypeId == thrift.I64 { 8971 if err := p.ReadField1(ctx, iprot); err != nil { 8972 return err 8973 } 8974 issetOffset = true 8975 } else { 8976 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8977 return err 8978 } 8979 } 8980 case 2: 8981 if fieldTypeId == thrift.I32 { 8982 if err := p.ReadField2(ctx, iprot); err != nil { 8983 return err 8984 } 8985 issetCompressedPageSize = true 8986 } else { 8987 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8988 return err 8989 } 8990 } 8991 case 3: 8992 if fieldTypeId == thrift.I64 { 8993 if err := p.ReadField3(ctx, iprot); err != nil { 8994 return err 8995 } 8996 issetFirstRowIndex = true 8997 } else { 8998 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8999 return err 9000 } 9001 } 9002 default: 9003 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9004 return err 9005 } 9006 } 9007 if err := iprot.ReadFieldEnd(ctx); err != nil { 9008 return err 9009 } 9010 } 9011 if err := iprot.ReadStructEnd(ctx); err != nil { 9012 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 9013 } 9014 if !issetOffset{ 9015 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Offset is not set")); 9016 } 9017 if !issetCompressedPageSize{ 9018 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field CompressedPageSize is not set")); 9019 } 9020 if !issetFirstRowIndex{ 9021 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FirstRowIndex is not set")); 9022 } 9023 return nil 9024} 9025 9026func (p *PageLocation) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 9027 if v, err := iprot.ReadI64(ctx); err != nil { 9028 return thrift.PrependError("error reading field 1: ", err) 9029} else { 9030 p.Offset = v 9031} 9032 return nil 9033} 9034 9035func (p *PageLocation) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 9036 if v, err := iprot.ReadI32(ctx); err != nil { 9037 return thrift.PrependError("error reading field 2: ", err) 9038} else { 9039 p.CompressedPageSize = v 9040} 9041 return nil 9042} 9043 9044func (p *PageLocation) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 9045 if v, err := iprot.ReadI64(ctx); err != nil { 9046 return thrift.PrependError("error reading field 3: ", err) 9047} else { 9048 p.FirstRowIndex = v 9049} 9050 return nil 9051} 9052 9053func (p *PageLocation) Write(ctx context.Context, oprot thrift.TProtocol) error { 9054 if err := oprot.WriteStructBegin(ctx, "PageLocation"); err != nil { 9055 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 9056 if p != nil { 9057 if err := p.writeField1(ctx, oprot); err != nil { return err } 9058 if err := p.writeField2(ctx, oprot); err != nil { return err } 9059 if err := p.writeField3(ctx, oprot); err != nil { return err } 9060 } 9061 if err := oprot.WriteFieldStop(ctx); err != nil { 9062 return thrift.PrependError("write field stop error: ", err) } 9063 if err := oprot.WriteStructEnd(ctx); err != nil { 9064 return thrift.PrependError("write struct stop error: ", err) } 9065 return nil 9066} 9067 9068func (p *PageLocation) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 9069 if err := oprot.WriteFieldBegin(ctx, "offset", thrift.I64, 1); err != nil { 9070 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:offset: ", p), err) } 9071 if err := oprot.WriteI64(ctx, int64(p.Offset)); err != nil { 9072 return thrift.PrependError(fmt.Sprintf("%T.offset (1) field write error: ", p), err) } 9073 if err := oprot.WriteFieldEnd(ctx); err != nil { 9074 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:offset: ", p), err) } 9075 return err 9076} 9077 9078func (p *PageLocation) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 9079 if err := oprot.WriteFieldBegin(ctx, "compressed_page_size", thrift.I32, 2); err != nil { 9080 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:compressed_page_size: ", p), err) } 9081 if err := oprot.WriteI32(ctx, int32(p.CompressedPageSize)); err != nil { 9082 return thrift.PrependError(fmt.Sprintf("%T.compressed_page_size (2) field write error: ", p), err) } 9083 if err := oprot.WriteFieldEnd(ctx); err != nil { 9084 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:compressed_page_size: ", p), err) } 9085 return err 9086} 9087 9088func (p *PageLocation) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 9089 if err := oprot.WriteFieldBegin(ctx, "first_row_index", thrift.I64, 3); err != nil { 9090 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:first_row_index: ", p), err) } 9091 if err := oprot.WriteI64(ctx, int64(p.FirstRowIndex)); err != nil { 9092 return thrift.PrependError(fmt.Sprintf("%T.first_row_index (3) field write error: ", p), err) } 9093 if err := oprot.WriteFieldEnd(ctx); err != nil { 9094 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:first_row_index: ", p), err) } 9095 return err 9096} 9097 9098func (p *PageLocation) Equals(other *PageLocation) bool { 9099 if p == other { 9100 return true 9101 } else if p == nil || other == nil { 9102 return false 9103 } 9104 if p.Offset != other.Offset { return false } 9105 if p.CompressedPageSize != other.CompressedPageSize { return false } 9106 if p.FirstRowIndex != other.FirstRowIndex { return false } 9107 return true 9108} 9109 9110func (p *PageLocation) String() string { 9111 if p == nil { 9112 return "<nil>" 9113 } 9114 return fmt.Sprintf("PageLocation(%+v)", *p) 9115} 9116 9117// Attributes: 9118// - PageLocations: PageLocations, ordered by increasing PageLocation.offset. It is required 9119// that page_locations[i].first_row_index < page_locations[i+1].first_row_index. 9120type OffsetIndex struct { 9121 PageLocations []*PageLocation `thrift:"page_locations,1,required" db:"page_locations" json:"page_locations"` 9122} 9123 9124func NewOffsetIndex() *OffsetIndex { 9125 return &OffsetIndex{} 9126} 9127 9128 9129func (p *OffsetIndex) GetPageLocations() []*PageLocation { 9130 return p.PageLocations 9131} 9132func (p *OffsetIndex) Read(ctx context.Context, iprot thrift.TProtocol) error { 9133 if _, err := iprot.ReadStructBegin(ctx); err != nil { 9134 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 9135 } 9136 9137 var issetPageLocations bool = false; 9138 9139 for { 9140 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 9141 if err != nil { 9142 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 9143 } 9144 if fieldTypeId == thrift.STOP { break; } 9145 switch fieldId { 9146 case 1: 9147 if fieldTypeId == thrift.LIST { 9148 if err := p.ReadField1(ctx, iprot); err != nil { 9149 return err 9150 } 9151 issetPageLocations = true 9152 } else { 9153 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9154 return err 9155 } 9156 } 9157 default: 9158 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9159 return err 9160 } 9161 } 9162 if err := iprot.ReadFieldEnd(ctx); err != nil { 9163 return err 9164 } 9165 } 9166 if err := iprot.ReadStructEnd(ctx); err != nil { 9167 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 9168 } 9169 if !issetPageLocations{ 9170 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PageLocations is not set")); 9171 } 9172 return nil 9173} 9174 9175func (p *OffsetIndex) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 9176 _, size, err := iprot.ReadListBegin(ctx) 9177 if err != nil { 9178 return thrift.PrependError("error reading list begin: ", err) 9179 } 9180 tSlice := make([]*PageLocation, 0, size) 9181 p.PageLocations = tSlice 9182 for i := 0; i < size; i ++ { 9183 _elem14 := &PageLocation{} 9184 if err := _elem14.Read(ctx, iprot); err != nil { 9185 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem14), err) 9186 } 9187 p.PageLocations = append(p.PageLocations, _elem14) 9188 } 9189 if err := iprot.ReadListEnd(ctx); err != nil { 9190 return thrift.PrependError("error reading list end: ", err) 9191 } 9192 return nil 9193} 9194 9195func (p *OffsetIndex) Write(ctx context.Context, oprot thrift.TProtocol) error { 9196 if err := oprot.WriteStructBegin(ctx, "OffsetIndex"); err != nil { 9197 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 9198 if p != nil { 9199 if err := p.writeField1(ctx, oprot); err != nil { return err } 9200 } 9201 if err := oprot.WriteFieldStop(ctx); err != nil { 9202 return thrift.PrependError("write field stop error: ", err) } 9203 if err := oprot.WriteStructEnd(ctx); err != nil { 9204 return thrift.PrependError("write struct stop error: ", err) } 9205 return nil 9206} 9207 9208func (p *OffsetIndex) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 9209 if err := oprot.WriteFieldBegin(ctx, "page_locations", thrift.LIST, 1); err != nil { 9210 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:page_locations: ", p), err) } 9211 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.PageLocations)); err != nil { 9212 return thrift.PrependError("error writing list begin: ", err) 9213 } 9214 for _, v := range p.PageLocations { 9215 if err := v.Write(ctx, oprot); err != nil { 9216 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 9217 } 9218 } 9219 if err := oprot.WriteListEnd(ctx); err != nil { 9220 return thrift.PrependError("error writing list end: ", err) 9221 } 9222 if err := oprot.WriteFieldEnd(ctx); err != nil { 9223 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:page_locations: ", p), err) } 9224 return err 9225} 9226 9227func (p *OffsetIndex) Equals(other *OffsetIndex) bool { 9228 if p == other { 9229 return true 9230 } else if p == nil || other == nil { 9231 return false 9232 } 9233 if len(p.PageLocations) != len(other.PageLocations) { return false } 9234 for i, _tgt := range p.PageLocations { 9235 _src15 := other.PageLocations[i] 9236 if !_tgt.Equals(_src15) { return false } 9237 } 9238 return true 9239} 9240 9241func (p *OffsetIndex) String() string { 9242 if p == nil { 9243 return "<nil>" 9244 } 9245 return fmt.Sprintf("OffsetIndex(%+v)", *p) 9246} 9247 9248// Description for ColumnIndex. 9249// Each <array-field>[i] refers to the page at OffsetIndex.page_locations[i] 9250// 9251// Attributes: 9252// - NullPages: A list of Boolean values to determine the validity of the corresponding 9253// min and max values. If true, a page contains only null values, and writers 9254// have to set the corresponding entries in min_values and max_values to 9255// byte[0], so that all lists have the same length. If false, the 9256// corresponding entries in min_values and max_values must be valid. 9257// - MinValues: Two lists containing lower and upper bounds for the values of each page. 9258// These may be the actual minimum and maximum values found on a page, but 9259// can also be (more compact) values that do not exist on a page. For 9260// example, instead of storing ""Blart Versenwald III", a writer may set 9261// min_values[i]="B", max_values[i]="C". Such more compact values must still 9262// be valid values within the column's logical type. Readers must make sure 9263// that list entries are populated before using them by inspecting null_pages. 9264// - MaxValues 9265// - BoundaryOrder: Stores whether both min_values and max_values are ordered and if so, in 9266// which direction. This allows readers to perform binary searches in both 9267// lists. Readers cannot assume that max_values[i] <= min_values[i+1], even 9268// if the lists are ordered. 9269// - NullCounts: A list containing the number of null values for each page * 9270type ColumnIndex struct { 9271 NullPages []bool `thrift:"null_pages,1,required" db:"null_pages" json:"null_pages"` 9272 MinValues [][]byte `thrift:"min_values,2,required" db:"min_values" json:"min_values"` 9273 MaxValues [][]byte `thrift:"max_values,3,required" db:"max_values" json:"max_values"` 9274 BoundaryOrder BoundaryOrder `thrift:"boundary_order,4,required" db:"boundary_order" json:"boundary_order"` 9275 NullCounts []int64 `thrift:"null_counts,5" db:"null_counts" json:"null_counts,omitempty"` 9276} 9277 9278func NewColumnIndex() *ColumnIndex { 9279 return &ColumnIndex{} 9280} 9281 9282 9283func (p *ColumnIndex) GetNullPages() []bool { 9284 return p.NullPages 9285} 9286 9287func (p *ColumnIndex) GetMinValues() [][]byte { 9288 return p.MinValues 9289} 9290 9291func (p *ColumnIndex) GetMaxValues() [][]byte { 9292 return p.MaxValues 9293} 9294 9295func (p *ColumnIndex) GetBoundaryOrder() BoundaryOrder { 9296 return p.BoundaryOrder 9297} 9298var ColumnIndex_NullCounts_DEFAULT []int64 9299 9300func (p *ColumnIndex) GetNullCounts() []int64 { 9301 return p.NullCounts 9302} 9303func (p *ColumnIndex) IsSetNullCounts() bool { 9304 return p.NullCounts != nil 9305} 9306 9307func (p *ColumnIndex) Read(ctx context.Context, iprot thrift.TProtocol) error { 9308 if _, err := iprot.ReadStructBegin(ctx); err != nil { 9309 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 9310 } 9311 9312 var issetNullPages bool = false; 9313 var issetMinValues bool = false; 9314 var issetMaxValues bool = false; 9315 var issetBoundaryOrder bool = false; 9316 9317 for { 9318 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 9319 if err != nil { 9320 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 9321 } 9322 if fieldTypeId == thrift.STOP { break; } 9323 switch fieldId { 9324 case 1: 9325 if fieldTypeId == thrift.LIST { 9326 if err := p.ReadField1(ctx, iprot); err != nil { 9327 return err 9328 } 9329 issetNullPages = true 9330 } else { 9331 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9332 return err 9333 } 9334 } 9335 case 2: 9336 if fieldTypeId == thrift.LIST { 9337 if err := p.ReadField2(ctx, iprot); err != nil { 9338 return err 9339 } 9340 issetMinValues = true 9341 } else { 9342 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9343 return err 9344 } 9345 } 9346 case 3: 9347 if fieldTypeId == thrift.LIST { 9348 if err := p.ReadField3(ctx, iprot); err != nil { 9349 return err 9350 } 9351 issetMaxValues = true 9352 } else { 9353 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9354 return err 9355 } 9356 } 9357 case 4: 9358 if fieldTypeId == thrift.I32 { 9359 if err := p.ReadField4(ctx, iprot); err != nil { 9360 return err 9361 } 9362 issetBoundaryOrder = true 9363 } else { 9364 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9365 return err 9366 } 9367 } 9368 case 5: 9369 if fieldTypeId == thrift.LIST { 9370 if err := p.ReadField5(ctx, iprot); err != nil { 9371 return err 9372 } 9373 } else { 9374 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9375 return err 9376 } 9377 } 9378 default: 9379 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9380 return err 9381 } 9382 } 9383 if err := iprot.ReadFieldEnd(ctx); err != nil { 9384 return err 9385 } 9386 } 9387 if err := iprot.ReadStructEnd(ctx); err != nil { 9388 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 9389 } 9390 if !issetNullPages{ 9391 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NullPages is not set")); 9392 } 9393 if !issetMinValues{ 9394 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MinValues is not set")); 9395 } 9396 if !issetMaxValues{ 9397 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MaxValues is not set")); 9398 } 9399 if !issetBoundaryOrder{ 9400 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field BoundaryOrder is not set")); 9401 } 9402 return nil 9403} 9404 9405func (p *ColumnIndex) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 9406 _, size, err := iprot.ReadListBegin(ctx) 9407 if err != nil { 9408 return thrift.PrependError("error reading list begin: ", err) 9409 } 9410 tSlice := make([]bool, 0, size) 9411 p.NullPages = tSlice 9412 for i := 0; i < size; i ++ { 9413var _elem16 bool 9414 if v, err := iprot.ReadBool(ctx); err != nil { 9415 return thrift.PrependError("error reading field 0: ", err) 9416} else { 9417 _elem16 = v 9418} 9419 p.NullPages = append(p.NullPages, _elem16) 9420 } 9421 if err := iprot.ReadListEnd(ctx); err != nil { 9422 return thrift.PrependError("error reading list end: ", err) 9423 } 9424 return nil 9425} 9426 9427func (p *ColumnIndex) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 9428 _, size, err := iprot.ReadListBegin(ctx) 9429 if err != nil { 9430 return thrift.PrependError("error reading list begin: ", err) 9431 } 9432 tSlice := make([][]byte, 0, size) 9433 p.MinValues = tSlice 9434 for i := 0; i < size; i ++ { 9435var _elem17 []byte 9436 if v, err := iprot.ReadBinary(ctx); err != nil { 9437 return thrift.PrependError("error reading field 0: ", err) 9438} else { 9439 _elem17 = v 9440} 9441 p.MinValues = append(p.MinValues, _elem17) 9442 } 9443 if err := iprot.ReadListEnd(ctx); err != nil { 9444 return thrift.PrependError("error reading list end: ", err) 9445 } 9446 return nil 9447} 9448 9449func (p *ColumnIndex) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 9450 _, size, err := iprot.ReadListBegin(ctx) 9451 if err != nil { 9452 return thrift.PrependError("error reading list begin: ", err) 9453 } 9454 tSlice := make([][]byte, 0, size) 9455 p.MaxValues = tSlice 9456 for i := 0; i < size; i ++ { 9457var _elem18 []byte 9458 if v, err := iprot.ReadBinary(ctx); err != nil { 9459 return thrift.PrependError("error reading field 0: ", err) 9460} else { 9461 _elem18 = v 9462} 9463 p.MaxValues = append(p.MaxValues, _elem18) 9464 } 9465 if err := iprot.ReadListEnd(ctx); err != nil { 9466 return thrift.PrependError("error reading list end: ", err) 9467 } 9468 return nil 9469} 9470 9471func (p *ColumnIndex) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 9472 if v, err := iprot.ReadI32(ctx); err != nil { 9473 return thrift.PrependError("error reading field 4: ", err) 9474} else { 9475 temp := BoundaryOrder(v) 9476 p.BoundaryOrder = temp 9477} 9478 return nil 9479} 9480 9481func (p *ColumnIndex) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 9482 _, size, err := iprot.ReadListBegin(ctx) 9483 if err != nil { 9484 return thrift.PrependError("error reading list begin: ", err) 9485 } 9486 tSlice := make([]int64, 0, size) 9487 p.NullCounts = tSlice 9488 for i := 0; i < size; i ++ { 9489var _elem19 int64 9490 if v, err := iprot.ReadI64(ctx); err != nil { 9491 return thrift.PrependError("error reading field 0: ", err) 9492} else { 9493 _elem19 = v 9494} 9495 p.NullCounts = append(p.NullCounts, _elem19) 9496 } 9497 if err := iprot.ReadListEnd(ctx); err != nil { 9498 return thrift.PrependError("error reading list end: ", err) 9499 } 9500 return nil 9501} 9502 9503func (p *ColumnIndex) Write(ctx context.Context, oprot thrift.TProtocol) error { 9504 if err := oprot.WriteStructBegin(ctx, "ColumnIndex"); err != nil { 9505 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 9506 if p != nil { 9507 if err := p.writeField1(ctx, oprot); err != nil { return err } 9508 if err := p.writeField2(ctx, oprot); err != nil { return err } 9509 if err := p.writeField3(ctx, oprot); err != nil { return err } 9510 if err := p.writeField4(ctx, oprot); err != nil { return err } 9511 if err := p.writeField5(ctx, oprot); err != nil { return err } 9512 } 9513 if err := oprot.WriteFieldStop(ctx); err != nil { 9514 return thrift.PrependError("write field stop error: ", err) } 9515 if err := oprot.WriteStructEnd(ctx); err != nil { 9516 return thrift.PrependError("write struct stop error: ", err) } 9517 return nil 9518} 9519 9520func (p *ColumnIndex) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 9521 if err := oprot.WriteFieldBegin(ctx, "null_pages", thrift.LIST, 1); err != nil { 9522 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:null_pages: ", p), err) } 9523 if err := oprot.WriteListBegin(ctx, thrift.BOOL, len(p.NullPages)); err != nil { 9524 return thrift.PrependError("error writing list begin: ", err) 9525 } 9526 for _, v := range p.NullPages { 9527 if err := oprot.WriteBool(ctx, bool(v)); err != nil { 9528 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } 9529 } 9530 if err := oprot.WriteListEnd(ctx); err != nil { 9531 return thrift.PrependError("error writing list end: ", err) 9532 } 9533 if err := oprot.WriteFieldEnd(ctx); err != nil { 9534 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:null_pages: ", p), err) } 9535 return err 9536} 9537 9538func (p *ColumnIndex) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 9539 if err := oprot.WriteFieldBegin(ctx, "min_values", thrift.LIST, 2); err != nil { 9540 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:min_values: ", p), err) } 9541 if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.MinValues)); err != nil { 9542 return thrift.PrependError("error writing list begin: ", err) 9543 } 9544 for _, v := range p.MinValues { 9545 if err := oprot.WriteBinary(ctx, v); err != nil { 9546 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } 9547 } 9548 if err := oprot.WriteListEnd(ctx); err != nil { 9549 return thrift.PrependError("error writing list end: ", err) 9550 } 9551 if err := oprot.WriteFieldEnd(ctx); err != nil { 9552 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:min_values: ", p), err) } 9553 return err 9554} 9555 9556func (p *ColumnIndex) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 9557 if err := oprot.WriteFieldBegin(ctx, "max_values", thrift.LIST, 3); err != nil { 9558 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:max_values: ", p), err) } 9559 if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.MaxValues)); err != nil { 9560 return thrift.PrependError("error writing list begin: ", err) 9561 } 9562 for _, v := range p.MaxValues { 9563 if err := oprot.WriteBinary(ctx, v); err != nil { 9564 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } 9565 } 9566 if err := oprot.WriteListEnd(ctx); err != nil { 9567 return thrift.PrependError("error writing list end: ", err) 9568 } 9569 if err := oprot.WriteFieldEnd(ctx); err != nil { 9570 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:max_values: ", p), err) } 9571 return err 9572} 9573 9574func (p *ColumnIndex) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 9575 if err := oprot.WriteFieldBegin(ctx, "boundary_order", thrift.I32, 4); err != nil { 9576 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:boundary_order: ", p), err) } 9577 if err := oprot.WriteI32(ctx, int32(p.BoundaryOrder)); err != nil { 9578 return thrift.PrependError(fmt.Sprintf("%T.boundary_order (4) field write error: ", p), err) } 9579 if err := oprot.WriteFieldEnd(ctx); err != nil { 9580 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:boundary_order: ", p), err) } 9581 return err 9582} 9583 9584func (p *ColumnIndex) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 9585 if p.IsSetNullCounts() { 9586 if err := oprot.WriteFieldBegin(ctx, "null_counts", thrift.LIST, 5); err != nil { 9587 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:null_counts: ", p), err) } 9588 if err := oprot.WriteListBegin(ctx, thrift.I64, len(p.NullCounts)); err != nil { 9589 return thrift.PrependError("error writing list begin: ", err) 9590 } 9591 for _, v := range p.NullCounts { 9592 if err := oprot.WriteI64(ctx, int64(v)); err != nil { 9593 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } 9594 } 9595 if err := oprot.WriteListEnd(ctx); err != nil { 9596 return thrift.PrependError("error writing list end: ", err) 9597 } 9598 if err := oprot.WriteFieldEnd(ctx); err != nil { 9599 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:null_counts: ", p), err) } 9600 } 9601 return err 9602} 9603 9604func (p *ColumnIndex) Equals(other *ColumnIndex) bool { 9605 if p == other { 9606 return true 9607 } else if p == nil || other == nil { 9608 return false 9609 } 9610 if len(p.NullPages) != len(other.NullPages) { return false } 9611 for i, _tgt := range p.NullPages { 9612 _src20 := other.NullPages[i] 9613 if _tgt != _src20 { return false } 9614 } 9615 if len(p.MinValues) != len(other.MinValues) { return false } 9616 for i, _tgt := range p.MinValues { 9617 _src21 := other.MinValues[i] 9618 if bytes.Compare(_tgt, _src21) != 0 { return false } 9619 } 9620 if len(p.MaxValues) != len(other.MaxValues) { return false } 9621 for i, _tgt := range p.MaxValues { 9622 _src22 := other.MaxValues[i] 9623 if bytes.Compare(_tgt, _src22) != 0 { return false } 9624 } 9625 if p.BoundaryOrder != other.BoundaryOrder { return false } 9626 if len(p.NullCounts) != len(other.NullCounts) { return false } 9627 for i, _tgt := range p.NullCounts { 9628 _src23 := other.NullCounts[i] 9629 if _tgt != _src23 { return false } 9630 } 9631 return true 9632} 9633 9634func (p *ColumnIndex) String() string { 9635 if p == nil { 9636 return "<nil>" 9637 } 9638 return fmt.Sprintf("ColumnIndex(%+v)", *p) 9639} 9640 9641// Attributes: 9642// - AadPrefix: AAD prefix * 9643// - AadFileUnique: Unique file identifier part of AAD suffix * 9644// - SupplyAadPrefix: In files encrypted with AAD prefix without storing it, 9645// readers must supply the prefix * 9646type AesGcmV1 struct { 9647 AadPrefix []byte `thrift:"aad_prefix,1" db:"aad_prefix" json:"aad_prefix,omitempty"` 9648 AadFileUnique []byte `thrift:"aad_file_unique,2" db:"aad_file_unique" json:"aad_file_unique,omitempty"` 9649 SupplyAadPrefix *bool `thrift:"supply_aad_prefix,3" db:"supply_aad_prefix" json:"supply_aad_prefix,omitempty"` 9650} 9651 9652func NewAesGcmV1() *AesGcmV1 { 9653 return &AesGcmV1{} 9654} 9655 9656var AesGcmV1_AadPrefix_DEFAULT []byte 9657 9658func (p *AesGcmV1) GetAadPrefix() []byte { 9659 return p.AadPrefix 9660} 9661var AesGcmV1_AadFileUnique_DEFAULT []byte 9662 9663func (p *AesGcmV1) GetAadFileUnique() []byte { 9664 return p.AadFileUnique 9665} 9666var AesGcmV1_SupplyAadPrefix_DEFAULT bool 9667func (p *AesGcmV1) GetSupplyAadPrefix() bool { 9668 if !p.IsSetSupplyAadPrefix() { 9669 return AesGcmV1_SupplyAadPrefix_DEFAULT 9670 } 9671return *p.SupplyAadPrefix 9672} 9673func (p *AesGcmV1) IsSetAadPrefix() bool { 9674 return p.AadPrefix != nil 9675} 9676 9677func (p *AesGcmV1) IsSetAadFileUnique() bool { 9678 return p.AadFileUnique != nil 9679} 9680 9681func (p *AesGcmV1) IsSetSupplyAadPrefix() bool { 9682 return p.SupplyAadPrefix != nil 9683} 9684 9685func (p *AesGcmV1) Read(ctx context.Context, iprot thrift.TProtocol) error { 9686 if _, err := iprot.ReadStructBegin(ctx); err != nil { 9687 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 9688 } 9689 9690 9691 for { 9692 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 9693 if err != nil { 9694 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 9695 } 9696 if fieldTypeId == thrift.STOP { break; } 9697 switch fieldId { 9698 case 1: 9699 if fieldTypeId == thrift.STRING { 9700 if err := p.ReadField1(ctx, iprot); err != nil { 9701 return err 9702 } 9703 } else { 9704 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9705 return err 9706 } 9707 } 9708 case 2: 9709 if fieldTypeId == thrift.STRING { 9710 if err := p.ReadField2(ctx, iprot); err != nil { 9711 return err 9712 } 9713 } else { 9714 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9715 return err 9716 } 9717 } 9718 case 3: 9719 if fieldTypeId == thrift.BOOL { 9720 if err := p.ReadField3(ctx, iprot); err != nil { 9721 return err 9722 } 9723 } else { 9724 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9725 return err 9726 } 9727 } 9728 default: 9729 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9730 return err 9731 } 9732 } 9733 if err := iprot.ReadFieldEnd(ctx); err != nil { 9734 return err 9735 } 9736 } 9737 if err := iprot.ReadStructEnd(ctx); err != nil { 9738 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 9739 } 9740 return nil 9741} 9742 9743func (p *AesGcmV1) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 9744 if v, err := iprot.ReadBinary(ctx); err != nil { 9745 return thrift.PrependError("error reading field 1: ", err) 9746} else { 9747 p.AadPrefix = v 9748} 9749 return nil 9750} 9751 9752func (p *AesGcmV1) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 9753 if v, err := iprot.ReadBinary(ctx); err != nil { 9754 return thrift.PrependError("error reading field 2: ", err) 9755} else { 9756 p.AadFileUnique = v 9757} 9758 return nil 9759} 9760 9761func (p *AesGcmV1) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 9762 if v, err := iprot.ReadBool(ctx); err != nil { 9763 return thrift.PrependError("error reading field 3: ", err) 9764} else { 9765 p.SupplyAadPrefix = &v 9766} 9767 return nil 9768} 9769 9770func (p *AesGcmV1) Write(ctx context.Context, oprot thrift.TProtocol) error { 9771 if err := oprot.WriteStructBegin(ctx, "AesGcmV1"); err != nil { 9772 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 9773 if p != nil { 9774 if err := p.writeField1(ctx, oprot); err != nil { return err } 9775 if err := p.writeField2(ctx, oprot); err != nil { return err } 9776 if err := p.writeField3(ctx, oprot); err != nil { return err } 9777 } 9778 if err := oprot.WriteFieldStop(ctx); err != nil { 9779 return thrift.PrependError("write field stop error: ", err) } 9780 if err := oprot.WriteStructEnd(ctx); err != nil { 9781 return thrift.PrependError("write struct stop error: ", err) } 9782 return nil 9783} 9784 9785func (p *AesGcmV1) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 9786 if p.IsSetAadPrefix() { 9787 if err := oprot.WriteFieldBegin(ctx, "aad_prefix", thrift.STRING, 1); err != nil { 9788 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:aad_prefix: ", p), err) } 9789 if err := oprot.WriteBinary(ctx, p.AadPrefix); err != nil { 9790 return thrift.PrependError(fmt.Sprintf("%T.aad_prefix (1) field write error: ", p), err) } 9791 if err := oprot.WriteFieldEnd(ctx); err != nil { 9792 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:aad_prefix: ", p), err) } 9793 } 9794 return err 9795} 9796 9797func (p *AesGcmV1) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 9798 if p.IsSetAadFileUnique() { 9799 if err := oprot.WriteFieldBegin(ctx, "aad_file_unique", thrift.STRING, 2); err != nil { 9800 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:aad_file_unique: ", p), err) } 9801 if err := oprot.WriteBinary(ctx, p.AadFileUnique); err != nil { 9802 return thrift.PrependError(fmt.Sprintf("%T.aad_file_unique (2) field write error: ", p), err) } 9803 if err := oprot.WriteFieldEnd(ctx); err != nil { 9804 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:aad_file_unique: ", p), err) } 9805 } 9806 return err 9807} 9808 9809func (p *AesGcmV1) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 9810 if p.IsSetSupplyAadPrefix() { 9811 if err := oprot.WriteFieldBegin(ctx, "supply_aad_prefix", thrift.BOOL, 3); err != nil { 9812 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:supply_aad_prefix: ", p), err) } 9813 if err := oprot.WriteBool(ctx, bool(*p.SupplyAadPrefix)); err != nil { 9814 return thrift.PrependError(fmt.Sprintf("%T.supply_aad_prefix (3) field write error: ", p), err) } 9815 if err := oprot.WriteFieldEnd(ctx); err != nil { 9816 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:supply_aad_prefix: ", p), err) } 9817 } 9818 return err 9819} 9820 9821func (p *AesGcmV1) Equals(other *AesGcmV1) bool { 9822 if p == other { 9823 return true 9824 } else if p == nil || other == nil { 9825 return false 9826 } 9827 if bytes.Compare(p.AadPrefix, other.AadPrefix) != 0 { return false } 9828 if bytes.Compare(p.AadFileUnique, other.AadFileUnique) != 0 { return false } 9829 if p.SupplyAadPrefix != other.SupplyAadPrefix { 9830 if p.SupplyAadPrefix == nil || other.SupplyAadPrefix == nil { 9831 return false 9832 } 9833 if (*p.SupplyAadPrefix) != (*other.SupplyAadPrefix) { return false } 9834 } 9835 return true 9836} 9837 9838func (p *AesGcmV1) String() string { 9839 if p == nil { 9840 return "<nil>" 9841 } 9842 return fmt.Sprintf("AesGcmV1(%+v)", *p) 9843} 9844 9845// Attributes: 9846// - AadPrefix: AAD prefix * 9847// - AadFileUnique: Unique file identifier part of AAD suffix * 9848// - SupplyAadPrefix: In files encrypted with AAD prefix without storing it, 9849// readers must supply the prefix * 9850type AesGcmCtrV1 struct { 9851 AadPrefix []byte `thrift:"aad_prefix,1" db:"aad_prefix" json:"aad_prefix,omitempty"` 9852 AadFileUnique []byte `thrift:"aad_file_unique,2" db:"aad_file_unique" json:"aad_file_unique,omitempty"` 9853 SupplyAadPrefix *bool `thrift:"supply_aad_prefix,3" db:"supply_aad_prefix" json:"supply_aad_prefix,omitempty"` 9854} 9855 9856func NewAesGcmCtrV1() *AesGcmCtrV1 { 9857 return &AesGcmCtrV1{} 9858} 9859 9860var AesGcmCtrV1_AadPrefix_DEFAULT []byte 9861 9862func (p *AesGcmCtrV1) GetAadPrefix() []byte { 9863 return p.AadPrefix 9864} 9865var AesGcmCtrV1_AadFileUnique_DEFAULT []byte 9866 9867func (p *AesGcmCtrV1) GetAadFileUnique() []byte { 9868 return p.AadFileUnique 9869} 9870var AesGcmCtrV1_SupplyAadPrefix_DEFAULT bool 9871func (p *AesGcmCtrV1) GetSupplyAadPrefix() bool { 9872 if !p.IsSetSupplyAadPrefix() { 9873 return AesGcmCtrV1_SupplyAadPrefix_DEFAULT 9874 } 9875return *p.SupplyAadPrefix 9876} 9877func (p *AesGcmCtrV1) IsSetAadPrefix() bool { 9878 return p.AadPrefix != nil 9879} 9880 9881func (p *AesGcmCtrV1) IsSetAadFileUnique() bool { 9882 return p.AadFileUnique != nil 9883} 9884 9885func (p *AesGcmCtrV1) IsSetSupplyAadPrefix() bool { 9886 return p.SupplyAadPrefix != nil 9887} 9888 9889func (p *AesGcmCtrV1) Read(ctx context.Context, iprot thrift.TProtocol) error { 9890 if _, err := iprot.ReadStructBegin(ctx); err != nil { 9891 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 9892 } 9893 9894 9895 for { 9896 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 9897 if err != nil { 9898 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 9899 } 9900 if fieldTypeId == thrift.STOP { break; } 9901 switch fieldId { 9902 case 1: 9903 if fieldTypeId == thrift.STRING { 9904 if err := p.ReadField1(ctx, iprot); err != nil { 9905 return err 9906 } 9907 } else { 9908 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9909 return err 9910 } 9911 } 9912 case 2: 9913 if fieldTypeId == thrift.STRING { 9914 if err := p.ReadField2(ctx, iprot); err != nil { 9915 return err 9916 } 9917 } else { 9918 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9919 return err 9920 } 9921 } 9922 case 3: 9923 if fieldTypeId == thrift.BOOL { 9924 if err := p.ReadField3(ctx, iprot); err != nil { 9925 return err 9926 } 9927 } else { 9928 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9929 return err 9930 } 9931 } 9932 default: 9933 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9934 return err 9935 } 9936 } 9937 if err := iprot.ReadFieldEnd(ctx); err != nil { 9938 return err 9939 } 9940 } 9941 if err := iprot.ReadStructEnd(ctx); err != nil { 9942 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 9943 } 9944 return nil 9945} 9946 9947func (p *AesGcmCtrV1) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 9948 if v, err := iprot.ReadBinary(ctx); err != nil { 9949 return thrift.PrependError("error reading field 1: ", err) 9950} else { 9951 p.AadPrefix = v 9952} 9953 return nil 9954} 9955 9956func (p *AesGcmCtrV1) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 9957 if v, err := iprot.ReadBinary(ctx); err != nil { 9958 return thrift.PrependError("error reading field 2: ", err) 9959} else { 9960 p.AadFileUnique = v 9961} 9962 return nil 9963} 9964 9965func (p *AesGcmCtrV1) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 9966 if v, err := iprot.ReadBool(ctx); err != nil { 9967 return thrift.PrependError("error reading field 3: ", err) 9968} else { 9969 p.SupplyAadPrefix = &v 9970} 9971 return nil 9972} 9973 9974func (p *AesGcmCtrV1) Write(ctx context.Context, oprot thrift.TProtocol) error { 9975 if err := oprot.WriteStructBegin(ctx, "AesGcmCtrV1"); err != nil { 9976 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 9977 if p != nil { 9978 if err := p.writeField1(ctx, oprot); err != nil { return err } 9979 if err := p.writeField2(ctx, oprot); err != nil { return err } 9980 if err := p.writeField3(ctx, oprot); err != nil { return err } 9981 } 9982 if err := oprot.WriteFieldStop(ctx); err != nil { 9983 return thrift.PrependError("write field stop error: ", err) } 9984 if err := oprot.WriteStructEnd(ctx); err != nil { 9985 return thrift.PrependError("write struct stop error: ", err) } 9986 return nil 9987} 9988 9989func (p *AesGcmCtrV1) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 9990 if p.IsSetAadPrefix() { 9991 if err := oprot.WriteFieldBegin(ctx, "aad_prefix", thrift.STRING, 1); err != nil { 9992 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:aad_prefix: ", p), err) } 9993 if err := oprot.WriteBinary(ctx, p.AadPrefix); err != nil { 9994 return thrift.PrependError(fmt.Sprintf("%T.aad_prefix (1) field write error: ", p), err) } 9995 if err := oprot.WriteFieldEnd(ctx); err != nil { 9996 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:aad_prefix: ", p), err) } 9997 } 9998 return err 9999} 10000 10001func (p *AesGcmCtrV1) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 10002 if p.IsSetAadFileUnique() { 10003 if err := oprot.WriteFieldBegin(ctx, "aad_file_unique", thrift.STRING, 2); err != nil { 10004 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:aad_file_unique: ", p), err) } 10005 if err := oprot.WriteBinary(ctx, p.AadFileUnique); err != nil { 10006 return thrift.PrependError(fmt.Sprintf("%T.aad_file_unique (2) field write error: ", p), err) } 10007 if err := oprot.WriteFieldEnd(ctx); err != nil { 10008 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:aad_file_unique: ", p), err) } 10009 } 10010 return err 10011} 10012 10013func (p *AesGcmCtrV1) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 10014 if p.IsSetSupplyAadPrefix() { 10015 if err := oprot.WriteFieldBegin(ctx, "supply_aad_prefix", thrift.BOOL, 3); err != nil { 10016 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:supply_aad_prefix: ", p), err) } 10017 if err := oprot.WriteBool(ctx, bool(*p.SupplyAadPrefix)); err != nil { 10018 return thrift.PrependError(fmt.Sprintf("%T.supply_aad_prefix (3) field write error: ", p), err) } 10019 if err := oprot.WriteFieldEnd(ctx); err != nil { 10020 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:supply_aad_prefix: ", p), err) } 10021 } 10022 return err 10023} 10024 10025func (p *AesGcmCtrV1) Equals(other *AesGcmCtrV1) bool { 10026 if p == other { 10027 return true 10028 } else if p == nil || other == nil { 10029 return false 10030 } 10031 if bytes.Compare(p.AadPrefix, other.AadPrefix) != 0 { return false } 10032 if bytes.Compare(p.AadFileUnique, other.AadFileUnique) != 0 { return false } 10033 if p.SupplyAadPrefix != other.SupplyAadPrefix { 10034 if p.SupplyAadPrefix == nil || other.SupplyAadPrefix == nil { 10035 return false 10036 } 10037 if (*p.SupplyAadPrefix) != (*other.SupplyAadPrefix) { return false } 10038 } 10039 return true 10040} 10041 10042func (p *AesGcmCtrV1) String() string { 10043 if p == nil { 10044 return "<nil>" 10045 } 10046 return fmt.Sprintf("AesGcmCtrV1(%+v)", *p) 10047} 10048 10049// Attributes: 10050// - AES_GCM_V1 10051// - AES_GCM_CTR_V1 10052type EncryptionAlgorithm struct { 10053 AES_GCM_V1 *AesGcmV1 `thrift:"AES_GCM_V1,1" db:"AES_GCM_V1" json:"AES_GCM_V1,omitempty"` 10054 AES_GCM_CTR_V1 *AesGcmCtrV1 `thrift:"AES_GCM_CTR_V1,2" db:"AES_GCM_CTR_V1" json:"AES_GCM_CTR_V1,omitempty"` 10055} 10056 10057func NewEncryptionAlgorithm() *EncryptionAlgorithm { 10058 return &EncryptionAlgorithm{} 10059} 10060 10061var EncryptionAlgorithm_AES_GCM_V1_DEFAULT *AesGcmV1 10062func (p *EncryptionAlgorithm) GetAES_GCM_V1() *AesGcmV1 { 10063 if !p.IsSetAES_GCM_V1() { 10064 return EncryptionAlgorithm_AES_GCM_V1_DEFAULT 10065 } 10066return p.AES_GCM_V1 10067} 10068var EncryptionAlgorithm_AES_GCM_CTR_V1_DEFAULT *AesGcmCtrV1 10069func (p *EncryptionAlgorithm) GetAES_GCM_CTR_V1() *AesGcmCtrV1 { 10070 if !p.IsSetAES_GCM_CTR_V1() { 10071 return EncryptionAlgorithm_AES_GCM_CTR_V1_DEFAULT 10072 } 10073return p.AES_GCM_CTR_V1 10074} 10075func (p *EncryptionAlgorithm) CountSetFieldsEncryptionAlgorithm() int { 10076 count := 0 10077 if (p.IsSetAES_GCM_V1()) { 10078 count++ 10079 } 10080 if (p.IsSetAES_GCM_CTR_V1()) { 10081 count++ 10082 } 10083 return count 10084 10085} 10086 10087func (p *EncryptionAlgorithm) IsSetAES_GCM_V1() bool { 10088 return p.AES_GCM_V1 != nil 10089} 10090 10091func (p *EncryptionAlgorithm) IsSetAES_GCM_CTR_V1() bool { 10092 return p.AES_GCM_CTR_V1 != nil 10093} 10094 10095func (p *EncryptionAlgorithm) Read(ctx context.Context, iprot thrift.TProtocol) error { 10096 if _, err := iprot.ReadStructBegin(ctx); err != nil { 10097 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 10098 } 10099 10100 10101 for { 10102 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 10103 if err != nil { 10104 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 10105 } 10106 if fieldTypeId == thrift.STOP { break; } 10107 switch fieldId { 10108 case 1: 10109 if fieldTypeId == thrift.STRUCT { 10110 if err := p.ReadField1(ctx, iprot); err != nil { 10111 return err 10112 } 10113 } else { 10114 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10115 return err 10116 } 10117 } 10118 case 2: 10119 if fieldTypeId == thrift.STRUCT { 10120 if err := p.ReadField2(ctx, iprot); err != nil { 10121 return err 10122 } 10123 } else { 10124 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10125 return err 10126 } 10127 } 10128 default: 10129 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10130 return err 10131 } 10132 } 10133 if err := iprot.ReadFieldEnd(ctx); err != nil { 10134 return err 10135 } 10136 } 10137 if err := iprot.ReadStructEnd(ctx); err != nil { 10138 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 10139 } 10140 return nil 10141} 10142 10143func (p *EncryptionAlgorithm) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 10144 p.AES_GCM_V1 = &AesGcmV1{} 10145 if err := p.AES_GCM_V1.Read(ctx, iprot); err != nil { 10146 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.AES_GCM_V1), err) 10147 } 10148 return nil 10149} 10150 10151func (p *EncryptionAlgorithm) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 10152 p.AES_GCM_CTR_V1 = &AesGcmCtrV1{} 10153 if err := p.AES_GCM_CTR_V1.Read(ctx, iprot); err != nil { 10154 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.AES_GCM_CTR_V1), err) 10155 } 10156 return nil 10157} 10158 10159func (p *EncryptionAlgorithm) Write(ctx context.Context, oprot thrift.TProtocol) error { 10160 if c := p.CountSetFieldsEncryptionAlgorithm(); c != 1 { 10161 return fmt.Errorf("%T write union: exactly one field must be set (%d set).", p, c) 10162 } 10163 if err := oprot.WriteStructBegin(ctx, "EncryptionAlgorithm"); err != nil { 10164 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 10165 if p != nil { 10166 if err := p.writeField1(ctx, oprot); err != nil { return err } 10167 if err := p.writeField2(ctx, oprot); err != nil { return err } 10168 } 10169 if err := oprot.WriteFieldStop(ctx); err != nil { 10170 return thrift.PrependError("write field stop error: ", err) } 10171 if err := oprot.WriteStructEnd(ctx); err != nil { 10172 return thrift.PrependError("write struct stop error: ", err) } 10173 return nil 10174} 10175 10176func (p *EncryptionAlgorithm) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 10177 if p.IsSetAES_GCM_V1() { 10178 if err := oprot.WriteFieldBegin(ctx, "AES_GCM_V1", thrift.STRUCT, 1); err != nil { 10179 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:AES_GCM_V1: ", p), err) } 10180 if err := p.AES_GCM_V1.Write(ctx, oprot); err != nil { 10181 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.AES_GCM_V1), err) 10182 } 10183 if err := oprot.WriteFieldEnd(ctx); err != nil { 10184 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:AES_GCM_V1: ", p), err) } 10185 } 10186 return err 10187} 10188 10189func (p *EncryptionAlgorithm) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 10190 if p.IsSetAES_GCM_CTR_V1() { 10191 if err := oprot.WriteFieldBegin(ctx, "AES_GCM_CTR_V1", thrift.STRUCT, 2); err != nil { 10192 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:AES_GCM_CTR_V1: ", p), err) } 10193 if err := p.AES_GCM_CTR_V1.Write(ctx, oprot); err != nil { 10194 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.AES_GCM_CTR_V1), err) 10195 } 10196 if err := oprot.WriteFieldEnd(ctx); err != nil { 10197 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:AES_GCM_CTR_V1: ", p), err) } 10198 } 10199 return err 10200} 10201 10202func (p *EncryptionAlgorithm) Equals(other *EncryptionAlgorithm) bool { 10203 if p == other { 10204 return true 10205 } else if p == nil || other == nil { 10206 return false 10207 } 10208 if !p.AES_GCM_V1.Equals(other.AES_GCM_V1) { return false } 10209 if !p.AES_GCM_CTR_V1.Equals(other.AES_GCM_CTR_V1) { return false } 10210 return true 10211} 10212 10213func (p *EncryptionAlgorithm) String() string { 10214 if p == nil { 10215 return "<nil>" 10216 } 10217 return fmt.Sprintf("EncryptionAlgorithm(%+v)", *p) 10218} 10219 10220// Description for file metadata 10221// 10222// Attributes: 10223// - Version: Version of this file * 10224// - Schema: Parquet schema for this file. This schema contains metadata for all the columns. 10225// The schema is represented as a tree with a single root. The nodes of the tree 10226// are flattened to a list by doing a depth-first traversal. 10227// The column metadata contains the path in the schema for that column which can be 10228// used to map columns to nodes in the schema. 10229// The first element is the root * 10230// - NumRows: Number of rows in this file * 10231// - RowGroups: Row groups in this file * 10232// - KeyValueMetadata: Optional key/value metadata * 10233// - CreatedBy: String for application that wrote this file. This should be in the format 10234// <Application> version <App Version> (build <App Build Hash>). 10235// e.g. impala version 1.0 (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55) 10236// 10237// - ColumnOrders: Sort order used for the min_value and max_value fields of each column in 10238// this file. Sort orders are listed in the order matching the columns in the 10239// schema. The indexes are not necessary the same though, because only leaf 10240// nodes of the schema are represented in the list of sort orders. 10241// 10242// Without column_orders, the meaning of the min_value and max_value fields is 10243// undefined. To ensure well-defined behaviour, if min_value and max_value are 10244// written to a Parquet file, column_orders must be written as well. 10245// 10246// The obsolete min and max fields are always sorted by signed comparison 10247// regardless of column_orders. 10248// - EncryptionAlgorithm: Encryption algorithm. This field is set only in encrypted files 10249// with plaintext footer. Files with encrypted footer store algorithm id 10250// in FileCryptoMetaData structure. 10251// - FooterSigningKeyMetadata: Retrieval metadata of key used for signing the footer. 10252// Used only in encrypted files with plaintext footer. 10253type FileMetaData struct { 10254 Version int32 `thrift:"version,1,required" db:"version" json:"version"` 10255 Schema []*SchemaElement `thrift:"schema,2,required" db:"schema" json:"schema"` 10256 NumRows int64 `thrift:"num_rows,3,required" db:"num_rows" json:"num_rows"` 10257 RowGroups []*RowGroup `thrift:"row_groups,4,required" db:"row_groups" json:"row_groups"` 10258 KeyValueMetadata []*KeyValue `thrift:"key_value_metadata,5" db:"key_value_metadata" json:"key_value_metadata,omitempty"` 10259 CreatedBy *string `thrift:"created_by,6" db:"created_by" json:"created_by,omitempty"` 10260 ColumnOrders []*ColumnOrder `thrift:"column_orders,7" db:"column_orders" json:"column_orders,omitempty"` 10261 EncryptionAlgorithm *EncryptionAlgorithm `thrift:"encryption_algorithm,8" db:"encryption_algorithm" json:"encryption_algorithm,omitempty"` 10262 FooterSigningKeyMetadata []byte `thrift:"footer_signing_key_metadata,9" db:"footer_signing_key_metadata" json:"footer_signing_key_metadata,omitempty"` 10263} 10264 10265func NewFileMetaData() *FileMetaData { 10266 return &FileMetaData{} 10267} 10268 10269 10270func (p *FileMetaData) GetVersion() int32 { 10271 return p.Version 10272} 10273 10274func (p *FileMetaData) GetSchema() []*SchemaElement { 10275 return p.Schema 10276} 10277 10278func (p *FileMetaData) GetNumRows() int64 { 10279 return p.NumRows 10280} 10281 10282func (p *FileMetaData) GetRowGroups() []*RowGroup { 10283 return p.RowGroups 10284} 10285var FileMetaData_KeyValueMetadata_DEFAULT []*KeyValue 10286 10287func (p *FileMetaData) GetKeyValueMetadata() []*KeyValue { 10288 return p.KeyValueMetadata 10289} 10290var FileMetaData_CreatedBy_DEFAULT string 10291func (p *FileMetaData) GetCreatedBy() string { 10292 if !p.IsSetCreatedBy() { 10293 return FileMetaData_CreatedBy_DEFAULT 10294 } 10295return *p.CreatedBy 10296} 10297var FileMetaData_ColumnOrders_DEFAULT []*ColumnOrder 10298 10299func (p *FileMetaData) GetColumnOrders() []*ColumnOrder { 10300 return p.ColumnOrders 10301} 10302var FileMetaData_EncryptionAlgorithm_DEFAULT *EncryptionAlgorithm 10303func (p *FileMetaData) GetEncryptionAlgorithm() *EncryptionAlgorithm { 10304 if !p.IsSetEncryptionAlgorithm() { 10305 return FileMetaData_EncryptionAlgorithm_DEFAULT 10306 } 10307return p.EncryptionAlgorithm 10308} 10309var FileMetaData_FooterSigningKeyMetadata_DEFAULT []byte 10310 10311func (p *FileMetaData) GetFooterSigningKeyMetadata() []byte { 10312 return p.FooterSigningKeyMetadata 10313} 10314func (p *FileMetaData) IsSetKeyValueMetadata() bool { 10315 return p.KeyValueMetadata != nil 10316} 10317 10318func (p *FileMetaData) IsSetCreatedBy() bool { 10319 return p.CreatedBy != nil 10320} 10321 10322func (p *FileMetaData) IsSetColumnOrders() bool { 10323 return p.ColumnOrders != nil 10324} 10325 10326func (p *FileMetaData) IsSetEncryptionAlgorithm() bool { 10327 return p.EncryptionAlgorithm != nil 10328} 10329 10330func (p *FileMetaData) IsSetFooterSigningKeyMetadata() bool { 10331 return p.FooterSigningKeyMetadata != nil 10332} 10333 10334func (p *FileMetaData) Read(ctx context.Context, iprot thrift.TProtocol) error { 10335 if _, err := iprot.ReadStructBegin(ctx); err != nil { 10336 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 10337 } 10338 10339 var issetVersion bool = false; 10340 var issetSchema bool = false; 10341 var issetNumRows bool = false; 10342 var issetRowGroups bool = false; 10343 10344 for { 10345 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 10346 if err != nil { 10347 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 10348 } 10349 if fieldTypeId == thrift.STOP { break; } 10350 switch fieldId { 10351 case 1: 10352 if fieldTypeId == thrift.I32 { 10353 if err := p.ReadField1(ctx, iprot); err != nil { 10354 return err 10355 } 10356 issetVersion = true 10357 } else { 10358 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10359 return err 10360 } 10361 } 10362 case 2: 10363 if fieldTypeId == thrift.LIST { 10364 if err := p.ReadField2(ctx, iprot); err != nil { 10365 return err 10366 } 10367 issetSchema = true 10368 } else { 10369 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10370 return err 10371 } 10372 } 10373 case 3: 10374 if fieldTypeId == thrift.I64 { 10375 if err := p.ReadField3(ctx, iprot); err != nil { 10376 return err 10377 } 10378 issetNumRows = true 10379 } else { 10380 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10381 return err 10382 } 10383 } 10384 case 4: 10385 if fieldTypeId == thrift.LIST { 10386 if err := p.ReadField4(ctx, iprot); err != nil { 10387 return err 10388 } 10389 issetRowGroups = true 10390 } else { 10391 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10392 return err 10393 } 10394 } 10395 case 5: 10396 if fieldTypeId == thrift.LIST { 10397 if err := p.ReadField5(ctx, iprot); err != nil { 10398 return err 10399 } 10400 } else { 10401 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10402 return err 10403 } 10404 } 10405 case 6: 10406 if fieldTypeId == thrift.STRING { 10407 if err := p.ReadField6(ctx, iprot); err != nil { 10408 return err 10409 } 10410 } else { 10411 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10412 return err 10413 } 10414 } 10415 case 7: 10416 if fieldTypeId == thrift.LIST { 10417 if err := p.ReadField7(ctx, iprot); err != nil { 10418 return err 10419 } 10420 } else { 10421 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10422 return err 10423 } 10424 } 10425 case 8: 10426 if fieldTypeId == thrift.STRUCT { 10427 if err := p.ReadField8(ctx, iprot); err != nil { 10428 return err 10429 } 10430 } else { 10431 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10432 return err 10433 } 10434 } 10435 case 9: 10436 if fieldTypeId == thrift.STRING { 10437 if err := p.ReadField9(ctx, iprot); err != nil { 10438 return err 10439 } 10440 } else { 10441 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10442 return err 10443 } 10444 } 10445 default: 10446 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10447 return err 10448 } 10449 } 10450 if err := iprot.ReadFieldEnd(ctx); err != nil { 10451 return err 10452 } 10453 } 10454 if err := iprot.ReadStructEnd(ctx); err != nil { 10455 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 10456 } 10457 if !issetVersion{ 10458 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set")); 10459 } 10460 if !issetSchema{ 10461 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Schema is not set")); 10462 } 10463 if !issetNumRows{ 10464 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumRows is not set")); 10465 } 10466 if !issetRowGroups{ 10467 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RowGroups is not set")); 10468 } 10469 return nil 10470} 10471 10472func (p *FileMetaData) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 10473 if v, err := iprot.ReadI32(ctx); err != nil { 10474 return thrift.PrependError("error reading field 1: ", err) 10475} else { 10476 p.Version = v 10477} 10478 return nil 10479} 10480 10481func (p *FileMetaData) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 10482 _, size, err := iprot.ReadListBegin(ctx) 10483 if err != nil { 10484 return thrift.PrependError("error reading list begin: ", err) 10485 } 10486 tSlice := make([]*SchemaElement, 0, size) 10487 p.Schema = tSlice 10488 for i := 0; i < size; i ++ { 10489 _elem24 := &SchemaElement{} 10490 if err := _elem24.Read(ctx, iprot); err != nil { 10491 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem24), err) 10492 } 10493 p.Schema = append(p.Schema, _elem24) 10494 } 10495 if err := iprot.ReadListEnd(ctx); err != nil { 10496 return thrift.PrependError("error reading list end: ", err) 10497 } 10498 return nil 10499} 10500 10501func (p *FileMetaData) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 10502 if v, err := iprot.ReadI64(ctx); err != nil { 10503 return thrift.PrependError("error reading field 3: ", err) 10504} else { 10505 p.NumRows = v 10506} 10507 return nil 10508} 10509 10510func (p *FileMetaData) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 10511 _, size, err := iprot.ReadListBegin(ctx) 10512 if err != nil { 10513 return thrift.PrependError("error reading list begin: ", err) 10514 } 10515 tSlice := make([]*RowGroup, 0, size) 10516 p.RowGroups = tSlice 10517 for i := 0; i < size; i ++ { 10518 _elem25 := &RowGroup{} 10519 if err := _elem25.Read(ctx, iprot); err != nil { 10520 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem25), err) 10521 } 10522 p.RowGroups = append(p.RowGroups, _elem25) 10523 } 10524 if err := iprot.ReadListEnd(ctx); err != nil { 10525 return thrift.PrependError("error reading list end: ", err) 10526 } 10527 return nil 10528} 10529 10530func (p *FileMetaData) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 10531 _, size, err := iprot.ReadListBegin(ctx) 10532 if err != nil { 10533 return thrift.PrependError("error reading list begin: ", err) 10534 } 10535 tSlice := make([]*KeyValue, 0, size) 10536 p.KeyValueMetadata = tSlice 10537 for i := 0; i < size; i ++ { 10538 _elem26 := &KeyValue{} 10539 if err := _elem26.Read(ctx, iprot); err != nil { 10540 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem26), err) 10541 } 10542 p.KeyValueMetadata = append(p.KeyValueMetadata, _elem26) 10543 } 10544 if err := iprot.ReadListEnd(ctx); err != nil { 10545 return thrift.PrependError("error reading list end: ", err) 10546 } 10547 return nil 10548} 10549 10550func (p *FileMetaData) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 10551 if v, err := iprot.ReadString(ctx); err != nil { 10552 return thrift.PrependError("error reading field 6: ", err) 10553} else { 10554 p.CreatedBy = &v 10555} 10556 return nil 10557} 10558 10559func (p *FileMetaData) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 10560 _, size, err := iprot.ReadListBegin(ctx) 10561 if err != nil { 10562 return thrift.PrependError("error reading list begin: ", err) 10563 } 10564 tSlice := make([]*ColumnOrder, 0, size) 10565 p.ColumnOrders = tSlice 10566 for i := 0; i < size; i ++ { 10567 _elem27 := &ColumnOrder{} 10568 if err := _elem27.Read(ctx, iprot); err != nil { 10569 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem27), err) 10570 } 10571 p.ColumnOrders = append(p.ColumnOrders, _elem27) 10572 } 10573 if err := iprot.ReadListEnd(ctx); err != nil { 10574 return thrift.PrependError("error reading list end: ", err) 10575 } 10576 return nil 10577} 10578 10579func (p *FileMetaData) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 10580 p.EncryptionAlgorithm = &EncryptionAlgorithm{} 10581 if err := p.EncryptionAlgorithm.Read(ctx, iprot); err != nil { 10582 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.EncryptionAlgorithm), err) 10583 } 10584 return nil 10585} 10586 10587func (p *FileMetaData) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { 10588 if v, err := iprot.ReadBinary(ctx); err != nil { 10589 return thrift.PrependError("error reading field 9: ", err) 10590} else { 10591 p.FooterSigningKeyMetadata = v 10592} 10593 return nil 10594} 10595 10596func (p *FileMetaData) Write(ctx context.Context, oprot thrift.TProtocol) error { 10597 if err := oprot.WriteStructBegin(ctx, "FileMetaData"); err != nil { 10598 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 10599 if p != nil { 10600 if err := p.writeField1(ctx, oprot); err != nil { return err } 10601 if err := p.writeField2(ctx, oprot); err != nil { return err } 10602 if err := p.writeField3(ctx, oprot); err != nil { return err } 10603 if err := p.writeField4(ctx, oprot); err != nil { return err } 10604 if err := p.writeField5(ctx, oprot); err != nil { return err } 10605 if err := p.writeField6(ctx, oprot); err != nil { return err } 10606 if err := p.writeField7(ctx, oprot); err != nil { return err } 10607 if err := p.writeField8(ctx, oprot); err != nil { return err } 10608 if err := p.writeField9(ctx, oprot); err != nil { return err } 10609 } 10610 if err := oprot.WriteFieldStop(ctx); err != nil { 10611 return thrift.PrependError("write field stop error: ", err) } 10612 if err := oprot.WriteStructEnd(ctx); err != nil { 10613 return thrift.PrependError("write struct stop error: ", err) } 10614 return nil 10615} 10616 10617func (p *FileMetaData) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 10618 if err := oprot.WriteFieldBegin(ctx, "version", thrift.I32, 1); err != nil { 10619 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:version: ", p), err) } 10620 if err := oprot.WriteI32(ctx, int32(p.Version)); err != nil { 10621 return thrift.PrependError(fmt.Sprintf("%T.version (1) field write error: ", p), err) } 10622 if err := oprot.WriteFieldEnd(ctx); err != nil { 10623 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:version: ", p), err) } 10624 return err 10625} 10626 10627func (p *FileMetaData) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 10628 if err := oprot.WriteFieldBegin(ctx, "schema", thrift.LIST, 2); err != nil { 10629 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:schema: ", p), err) } 10630 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Schema)); err != nil { 10631 return thrift.PrependError("error writing list begin: ", err) 10632 } 10633 for _, v := range p.Schema { 10634 if err := v.Write(ctx, oprot); err != nil { 10635 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 10636 } 10637 } 10638 if err := oprot.WriteListEnd(ctx); err != nil { 10639 return thrift.PrependError("error writing list end: ", err) 10640 } 10641 if err := oprot.WriteFieldEnd(ctx); err != nil { 10642 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:schema: ", p), err) } 10643 return err 10644} 10645 10646func (p *FileMetaData) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 10647 if err := oprot.WriteFieldBegin(ctx, "num_rows", thrift.I64, 3); err != nil { 10648 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:num_rows: ", p), err) } 10649 if err := oprot.WriteI64(ctx, int64(p.NumRows)); err != nil { 10650 return thrift.PrependError(fmt.Sprintf("%T.num_rows (3) field write error: ", p), err) } 10651 if err := oprot.WriteFieldEnd(ctx); err != nil { 10652 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:num_rows: ", p), err) } 10653 return err 10654} 10655 10656func (p *FileMetaData) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 10657 if err := oprot.WriteFieldBegin(ctx, "row_groups", thrift.LIST, 4); err != nil { 10658 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:row_groups: ", p), err) } 10659 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.RowGroups)); err != nil { 10660 return thrift.PrependError("error writing list begin: ", err) 10661 } 10662 for _, v := range p.RowGroups { 10663 if err := v.Write(ctx, oprot); err != nil { 10664 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 10665 } 10666 } 10667 if err := oprot.WriteListEnd(ctx); err != nil { 10668 return thrift.PrependError("error writing list end: ", err) 10669 } 10670 if err := oprot.WriteFieldEnd(ctx); err != nil { 10671 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:row_groups: ", p), err) } 10672 return err 10673} 10674 10675func (p *FileMetaData) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 10676 if p.IsSetKeyValueMetadata() { 10677 if err := oprot.WriteFieldBegin(ctx, "key_value_metadata", thrift.LIST, 5); err != nil { 10678 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:key_value_metadata: ", p), err) } 10679 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.KeyValueMetadata)); err != nil { 10680 return thrift.PrependError("error writing list begin: ", err) 10681 } 10682 for _, v := range p.KeyValueMetadata { 10683 if err := v.Write(ctx, oprot); err != nil { 10684 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 10685 } 10686 } 10687 if err := oprot.WriteListEnd(ctx); err != nil { 10688 return thrift.PrependError("error writing list end: ", err) 10689 } 10690 if err := oprot.WriteFieldEnd(ctx); err != nil { 10691 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:key_value_metadata: ", p), err) } 10692 } 10693 return err 10694} 10695 10696func (p *FileMetaData) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 10697 if p.IsSetCreatedBy() { 10698 if err := oprot.WriteFieldBegin(ctx, "created_by", thrift.STRING, 6); err != nil { 10699 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:created_by: ", p), err) } 10700 if err := oprot.WriteString(ctx, string(*p.CreatedBy)); err != nil { 10701 return thrift.PrependError(fmt.Sprintf("%T.created_by (6) field write error: ", p), err) } 10702 if err := oprot.WriteFieldEnd(ctx); err != nil { 10703 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:created_by: ", p), err) } 10704 } 10705 return err 10706} 10707 10708func (p *FileMetaData) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 10709 if p.IsSetColumnOrders() { 10710 if err := oprot.WriteFieldBegin(ctx, "column_orders", thrift.LIST, 7); err != nil { 10711 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:column_orders: ", p), err) } 10712 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.ColumnOrders)); err != nil { 10713 return thrift.PrependError("error writing list begin: ", err) 10714 } 10715 for _, v := range p.ColumnOrders { 10716 if err := v.Write(ctx, oprot); err != nil { 10717 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 10718 } 10719 } 10720 if err := oprot.WriteListEnd(ctx); err != nil { 10721 return thrift.PrependError("error writing list end: ", err) 10722 } 10723 if err := oprot.WriteFieldEnd(ctx); err != nil { 10724 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:column_orders: ", p), err) } 10725 } 10726 return err 10727} 10728 10729func (p *FileMetaData) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 10730 if p.IsSetEncryptionAlgorithm() { 10731 if err := oprot.WriteFieldBegin(ctx, "encryption_algorithm", thrift.STRUCT, 8); err != nil { 10732 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:encryption_algorithm: ", p), err) } 10733 if err := p.EncryptionAlgorithm.Write(ctx, oprot); err != nil { 10734 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.EncryptionAlgorithm), err) 10735 } 10736 if err := oprot.WriteFieldEnd(ctx); err != nil { 10737 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:encryption_algorithm: ", p), err) } 10738 } 10739 return err 10740} 10741 10742func (p *FileMetaData) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { 10743 if p.IsSetFooterSigningKeyMetadata() { 10744 if err := oprot.WriteFieldBegin(ctx, "footer_signing_key_metadata", thrift.STRING, 9); err != nil { 10745 return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:footer_signing_key_metadata: ", p), err) } 10746 if err := oprot.WriteBinary(ctx, p.FooterSigningKeyMetadata); err != nil { 10747 return thrift.PrependError(fmt.Sprintf("%T.footer_signing_key_metadata (9) field write error: ", p), err) } 10748 if err := oprot.WriteFieldEnd(ctx); err != nil { 10749 return thrift.PrependError(fmt.Sprintf("%T write field end error 9:footer_signing_key_metadata: ", p), err) } 10750 } 10751 return err 10752} 10753 10754func (p *FileMetaData) Equals(other *FileMetaData) bool { 10755 if p == other { 10756 return true 10757 } else if p == nil || other == nil { 10758 return false 10759 } 10760 if p.Version != other.Version { return false } 10761 if len(p.Schema) != len(other.Schema) { return false } 10762 for i, _tgt := range p.Schema { 10763 _src28 := other.Schema[i] 10764 if !_tgt.Equals(_src28) { return false } 10765 } 10766 if p.NumRows != other.NumRows { return false } 10767 if len(p.RowGroups) != len(other.RowGroups) { return false } 10768 for i, _tgt := range p.RowGroups { 10769 _src29 := other.RowGroups[i] 10770 if !_tgt.Equals(_src29) { return false } 10771 } 10772 if len(p.KeyValueMetadata) != len(other.KeyValueMetadata) { return false } 10773 for i, _tgt := range p.KeyValueMetadata { 10774 _src30 := other.KeyValueMetadata[i] 10775 if !_tgt.Equals(_src30) { return false } 10776 } 10777 if p.CreatedBy != other.CreatedBy { 10778 if p.CreatedBy == nil || other.CreatedBy == nil { 10779 return false 10780 } 10781 if (*p.CreatedBy) != (*other.CreatedBy) { return false } 10782 } 10783 if len(p.ColumnOrders) != len(other.ColumnOrders) { return false } 10784 for i, _tgt := range p.ColumnOrders { 10785 _src31 := other.ColumnOrders[i] 10786 if !_tgt.Equals(_src31) { return false } 10787 } 10788 if !p.EncryptionAlgorithm.Equals(other.EncryptionAlgorithm) { return false } 10789 if bytes.Compare(p.FooterSigningKeyMetadata, other.FooterSigningKeyMetadata) != 0 { return false } 10790 return true 10791} 10792 10793func (p *FileMetaData) String() string { 10794 if p == nil { 10795 return "<nil>" 10796 } 10797 return fmt.Sprintf("FileMetaData(%+v)", *p) 10798} 10799 10800// Crypto metadata for files with encrypted footer * 10801// 10802// Attributes: 10803// - EncryptionAlgorithm: Encryption algorithm. This field is only used for files 10804// with encrypted footer. Files with plaintext footer store algorithm id 10805// inside footer (FileMetaData structure). 10806// - KeyMetadata: Retrieval metadata of key used for encryption of footer, 10807// and (possibly) columns * 10808type FileCryptoMetaData struct { 10809 EncryptionAlgorithm *EncryptionAlgorithm `thrift:"encryption_algorithm,1,required" db:"encryption_algorithm" json:"encryption_algorithm"` 10810 KeyMetadata []byte `thrift:"key_metadata,2" db:"key_metadata" json:"key_metadata,omitempty"` 10811} 10812 10813func NewFileCryptoMetaData() *FileCryptoMetaData { 10814 return &FileCryptoMetaData{} 10815} 10816 10817var FileCryptoMetaData_EncryptionAlgorithm_DEFAULT *EncryptionAlgorithm 10818func (p *FileCryptoMetaData) GetEncryptionAlgorithm() *EncryptionAlgorithm { 10819 if !p.IsSetEncryptionAlgorithm() { 10820 return FileCryptoMetaData_EncryptionAlgorithm_DEFAULT 10821 } 10822return p.EncryptionAlgorithm 10823} 10824var FileCryptoMetaData_KeyMetadata_DEFAULT []byte 10825 10826func (p *FileCryptoMetaData) GetKeyMetadata() []byte { 10827 return p.KeyMetadata 10828} 10829func (p *FileCryptoMetaData) IsSetEncryptionAlgorithm() bool { 10830 return p.EncryptionAlgorithm != nil 10831} 10832 10833func (p *FileCryptoMetaData) IsSetKeyMetadata() bool { 10834 return p.KeyMetadata != nil 10835} 10836 10837func (p *FileCryptoMetaData) Read(ctx context.Context, iprot thrift.TProtocol) error { 10838 if _, err := iprot.ReadStructBegin(ctx); err != nil { 10839 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 10840 } 10841 10842 var issetEncryptionAlgorithm bool = false; 10843 10844 for { 10845 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 10846 if err != nil { 10847 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 10848 } 10849 if fieldTypeId == thrift.STOP { break; } 10850 switch fieldId { 10851 case 1: 10852 if fieldTypeId == thrift.STRUCT { 10853 if err := p.ReadField1(ctx, iprot); err != nil { 10854 return err 10855 } 10856 issetEncryptionAlgorithm = true 10857 } else { 10858 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10859 return err 10860 } 10861 } 10862 case 2: 10863 if fieldTypeId == thrift.STRING { 10864 if err := p.ReadField2(ctx, iprot); err != nil { 10865 return err 10866 } 10867 } else { 10868 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10869 return err 10870 } 10871 } 10872 default: 10873 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10874 return err 10875 } 10876 } 10877 if err := iprot.ReadFieldEnd(ctx); err != nil { 10878 return err 10879 } 10880 } 10881 if err := iprot.ReadStructEnd(ctx); err != nil { 10882 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 10883 } 10884 if !issetEncryptionAlgorithm{ 10885 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field EncryptionAlgorithm is not set")); 10886 } 10887 return nil 10888} 10889 10890func (p *FileCryptoMetaData) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 10891 p.EncryptionAlgorithm = &EncryptionAlgorithm{} 10892 if err := p.EncryptionAlgorithm.Read(ctx, iprot); err != nil { 10893 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.EncryptionAlgorithm), err) 10894 } 10895 return nil 10896} 10897 10898func (p *FileCryptoMetaData) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 10899 if v, err := iprot.ReadBinary(ctx); err != nil { 10900 return thrift.PrependError("error reading field 2: ", err) 10901} else { 10902 p.KeyMetadata = v 10903} 10904 return nil 10905} 10906 10907func (p *FileCryptoMetaData) Write(ctx context.Context, oprot thrift.TProtocol) error { 10908 if err := oprot.WriteStructBegin(ctx, "FileCryptoMetaData"); err != nil { 10909 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } 10910 if p != nil { 10911 if err := p.writeField1(ctx, oprot); err != nil { return err } 10912 if err := p.writeField2(ctx, oprot); err != nil { return err } 10913 } 10914 if err := oprot.WriteFieldStop(ctx); err != nil { 10915 return thrift.PrependError("write field stop error: ", err) } 10916 if err := oprot.WriteStructEnd(ctx); err != nil { 10917 return thrift.PrependError("write struct stop error: ", err) } 10918 return nil 10919} 10920 10921func (p *FileCryptoMetaData) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 10922 if err := oprot.WriteFieldBegin(ctx, "encryption_algorithm", thrift.STRUCT, 1); err != nil { 10923 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:encryption_algorithm: ", p), err) } 10924 if err := p.EncryptionAlgorithm.Write(ctx, oprot); err != nil { 10925 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.EncryptionAlgorithm), err) 10926 } 10927 if err := oprot.WriteFieldEnd(ctx); err != nil { 10928 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:encryption_algorithm: ", p), err) } 10929 return err 10930} 10931 10932func (p *FileCryptoMetaData) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 10933 if p.IsSetKeyMetadata() { 10934 if err := oprot.WriteFieldBegin(ctx, "key_metadata", thrift.STRING, 2); err != nil { 10935 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:key_metadata: ", p), err) } 10936 if err := oprot.WriteBinary(ctx, p.KeyMetadata); err != nil { 10937 return thrift.PrependError(fmt.Sprintf("%T.key_metadata (2) field write error: ", p), err) } 10938 if err := oprot.WriteFieldEnd(ctx); err != nil { 10939 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:key_metadata: ", p), err) } 10940 } 10941 return err 10942} 10943 10944func (p *FileCryptoMetaData) Equals(other *FileCryptoMetaData) bool { 10945 if p == other { 10946 return true 10947 } else if p == nil || other == nil { 10948 return false 10949 } 10950 if !p.EncryptionAlgorithm.Equals(other.EncryptionAlgorithm) { return false } 10951 if bytes.Compare(p.KeyMetadata, other.KeyMetadata) != 0 { return false } 10952 return true 10953} 10954 10955func (p *FileCryptoMetaData) String() string { 10956 if p == nil { 10957 return "<nil>" 10958 } 10959 return fmt.Sprintf("FileCryptoMetaData(%+v)", *p) 10960} 10961 10962