github.com/fraugster/parquet-go@v0.12.0/parquet/parquet.go (about) 1 // Code generated by Thrift Compiler (0.17.0). DO NOT EDIT. 2 3 package parquet 4 5 import ( 6 "bytes" 7 "context" 8 "database/sql/driver" 9 "errors" 10 "fmt" 11 thrift "github.com/apache/thrift/lib/go/thrift" 12 "time" 13 ) 14 15 // (needed to ensure safety because of naive import list construction.) 16 var _ = thrift.ZERO 17 var _ = fmt.Printf 18 var _ = errors.New 19 var _ = context.Background 20 var _ = time.Now 21 var _ = bytes.Equal 22 23 //Types supported by Parquet. These types are intended to be used in combination 24 //with the encodings to control the on disk storage format. 25 //For example INT16 is not included as a type since a good encoding of INT32 26 //would handle this. 27 type Type int64 28 29 const ( 30 Type_BOOLEAN Type = 0 31 Type_INT32 Type = 1 32 Type_INT64 Type = 2 33 Type_INT96 Type = 3 34 Type_FLOAT Type = 4 35 Type_DOUBLE Type = 5 36 Type_BYTE_ARRAY Type = 6 37 Type_FIXED_LEN_BYTE_ARRAY Type = 7 38 ) 39 40 func (p Type) String() string { 41 switch p { 42 case Type_BOOLEAN: 43 return "BOOLEAN" 44 case Type_INT32: 45 return "INT32" 46 case Type_INT64: 47 return "INT64" 48 case Type_INT96: 49 return "INT96" 50 case Type_FLOAT: 51 return "FLOAT" 52 case Type_DOUBLE: 53 return "DOUBLE" 54 case Type_BYTE_ARRAY: 55 return "BYTE_ARRAY" 56 case Type_FIXED_LEN_BYTE_ARRAY: 57 return "FIXED_LEN_BYTE_ARRAY" 58 } 59 return "<UNSET>" 60 } 61 62 func TypeFromString(s string) (Type, error) { 63 switch s { 64 case "BOOLEAN": 65 return Type_BOOLEAN, nil 66 case "INT32": 67 return Type_INT32, nil 68 case "INT64": 69 return Type_INT64, nil 70 case "INT96": 71 return Type_INT96, nil 72 case "FLOAT": 73 return Type_FLOAT, nil 74 case "DOUBLE": 75 return Type_DOUBLE, nil 76 case "BYTE_ARRAY": 77 return Type_BYTE_ARRAY, nil 78 case "FIXED_LEN_BYTE_ARRAY": 79 return Type_FIXED_LEN_BYTE_ARRAY, nil 80 } 81 return Type(0), fmt.Errorf("not a valid Type string") 82 } 83 84 func TypePtr(v Type) *Type { return &v } 85 86 func (p Type) MarshalText() ([]byte, error) { 87 return []byte(p.String()), nil 88 } 89 90 func (p *Type) UnmarshalText(text []byte) error { 91 q, err := TypeFromString(string(text)) 92 if err != nil { 93 return err 94 } 95 *p = q 96 return nil 97 } 98 99 func (p *Type) Scan(value interface{}) error { 100 v, ok := value.(int64) 101 if !ok { 102 return errors.New("Scan value is not int64") 103 } 104 *p = Type(v) 105 return nil 106 } 107 108 func (p *Type) Value() (driver.Value, error) { 109 if p == nil { 110 return nil, nil 111 } 112 return int64(*p), nil 113 } 114 115 //DEPRECATED: Common types used by frameworks(e.g. hive, pig) using parquet. 116 //ConvertedType is superseded by LogicalType. This enum should not be extended. 117 // 118 //See LogicalTypes.md for conversion between ConvertedType and LogicalType. 119 type ConvertedType int64 120 121 const ( 122 ConvertedType_UTF8 ConvertedType = 0 123 ConvertedType_MAP ConvertedType = 1 124 ConvertedType_MAP_KEY_VALUE ConvertedType = 2 125 ConvertedType_LIST ConvertedType = 3 126 ConvertedType_ENUM ConvertedType = 4 127 ConvertedType_DECIMAL ConvertedType = 5 128 ConvertedType_DATE ConvertedType = 6 129 ConvertedType_TIME_MILLIS ConvertedType = 7 130 ConvertedType_TIME_MICROS ConvertedType = 8 131 ConvertedType_TIMESTAMP_MILLIS ConvertedType = 9 132 ConvertedType_TIMESTAMP_MICROS ConvertedType = 10 133 ConvertedType_UINT_8 ConvertedType = 11 134 ConvertedType_UINT_16 ConvertedType = 12 135 ConvertedType_UINT_32 ConvertedType = 13 136 ConvertedType_UINT_64 ConvertedType = 14 137 ConvertedType_INT_8 ConvertedType = 15 138 ConvertedType_INT_16 ConvertedType = 16 139 ConvertedType_INT_32 ConvertedType = 17 140 ConvertedType_INT_64 ConvertedType = 18 141 ConvertedType_JSON ConvertedType = 19 142 ConvertedType_BSON ConvertedType = 20 143 ConvertedType_INTERVAL ConvertedType = 21 144 ) 145 146 func (p ConvertedType) String() string { 147 switch p { 148 case ConvertedType_UTF8: 149 return "UTF8" 150 case ConvertedType_MAP: 151 return "MAP" 152 case ConvertedType_MAP_KEY_VALUE: 153 return "MAP_KEY_VALUE" 154 case ConvertedType_LIST: 155 return "LIST" 156 case ConvertedType_ENUM: 157 return "ENUM" 158 case ConvertedType_DECIMAL: 159 return "DECIMAL" 160 case ConvertedType_DATE: 161 return "DATE" 162 case ConvertedType_TIME_MILLIS: 163 return "TIME_MILLIS" 164 case ConvertedType_TIME_MICROS: 165 return "TIME_MICROS" 166 case ConvertedType_TIMESTAMP_MILLIS: 167 return "TIMESTAMP_MILLIS" 168 case ConvertedType_TIMESTAMP_MICROS: 169 return "TIMESTAMP_MICROS" 170 case ConvertedType_UINT_8: 171 return "UINT_8" 172 case ConvertedType_UINT_16: 173 return "UINT_16" 174 case ConvertedType_UINT_32: 175 return "UINT_32" 176 case ConvertedType_UINT_64: 177 return "UINT_64" 178 case ConvertedType_INT_8: 179 return "INT_8" 180 case ConvertedType_INT_16: 181 return "INT_16" 182 case ConvertedType_INT_32: 183 return "INT_32" 184 case ConvertedType_INT_64: 185 return "INT_64" 186 case ConvertedType_JSON: 187 return "JSON" 188 case ConvertedType_BSON: 189 return "BSON" 190 case ConvertedType_INTERVAL: 191 return "INTERVAL" 192 } 193 return "<UNSET>" 194 } 195 196 func ConvertedTypeFromString(s string) (ConvertedType, error) { 197 switch s { 198 case "UTF8": 199 return ConvertedType_UTF8, nil 200 case "MAP": 201 return ConvertedType_MAP, nil 202 case "MAP_KEY_VALUE": 203 return ConvertedType_MAP_KEY_VALUE, nil 204 case "LIST": 205 return ConvertedType_LIST, nil 206 case "ENUM": 207 return ConvertedType_ENUM, nil 208 case "DECIMAL": 209 return ConvertedType_DECIMAL, nil 210 case "DATE": 211 return ConvertedType_DATE, nil 212 case "TIME_MILLIS": 213 return ConvertedType_TIME_MILLIS, nil 214 case "TIME_MICROS": 215 return ConvertedType_TIME_MICROS, nil 216 case "TIMESTAMP_MILLIS": 217 return ConvertedType_TIMESTAMP_MILLIS, nil 218 case "TIMESTAMP_MICROS": 219 return ConvertedType_TIMESTAMP_MICROS, nil 220 case "UINT_8": 221 return ConvertedType_UINT_8, nil 222 case "UINT_16": 223 return ConvertedType_UINT_16, nil 224 case "UINT_32": 225 return ConvertedType_UINT_32, nil 226 case "UINT_64": 227 return ConvertedType_UINT_64, nil 228 case "INT_8": 229 return ConvertedType_INT_8, nil 230 case "INT_16": 231 return ConvertedType_INT_16, nil 232 case "INT_32": 233 return ConvertedType_INT_32, nil 234 case "INT_64": 235 return ConvertedType_INT_64, nil 236 case "JSON": 237 return ConvertedType_JSON, nil 238 case "BSON": 239 return ConvertedType_BSON, nil 240 case "INTERVAL": 241 return ConvertedType_INTERVAL, nil 242 } 243 return ConvertedType(0), fmt.Errorf("not a valid ConvertedType string") 244 } 245 246 func ConvertedTypePtr(v ConvertedType) *ConvertedType { return &v } 247 248 func (p ConvertedType) MarshalText() ([]byte, error) { 249 return []byte(p.String()), nil 250 } 251 252 func (p *ConvertedType) UnmarshalText(text []byte) error { 253 q, err := ConvertedTypeFromString(string(text)) 254 if err != nil { 255 return err 256 } 257 *p = q 258 return nil 259 } 260 261 func (p *ConvertedType) Scan(value interface{}) error { 262 v, ok := value.(int64) 263 if !ok { 264 return errors.New("Scan value is not int64") 265 } 266 *p = ConvertedType(v) 267 return nil 268 } 269 270 func (p *ConvertedType) Value() (driver.Value, error) { 271 if p == nil { 272 return nil, nil 273 } 274 return int64(*p), nil 275 } 276 277 //Representation of Schemas 278 type FieldRepetitionType int64 279 280 const ( 281 FieldRepetitionType_REQUIRED FieldRepetitionType = 0 282 FieldRepetitionType_OPTIONAL FieldRepetitionType = 1 283 FieldRepetitionType_REPEATED FieldRepetitionType = 2 284 ) 285 286 func (p FieldRepetitionType) String() string { 287 switch p { 288 case FieldRepetitionType_REQUIRED: 289 return "REQUIRED" 290 case FieldRepetitionType_OPTIONAL: 291 return "OPTIONAL" 292 case FieldRepetitionType_REPEATED: 293 return "REPEATED" 294 } 295 return "<UNSET>" 296 } 297 298 func FieldRepetitionTypeFromString(s string) (FieldRepetitionType, error) { 299 switch s { 300 case "REQUIRED": 301 return FieldRepetitionType_REQUIRED, nil 302 case "OPTIONAL": 303 return FieldRepetitionType_OPTIONAL, nil 304 case "REPEATED": 305 return FieldRepetitionType_REPEATED, nil 306 } 307 return FieldRepetitionType(0), fmt.Errorf("not a valid FieldRepetitionType string") 308 } 309 310 func FieldRepetitionTypePtr(v FieldRepetitionType) *FieldRepetitionType { return &v } 311 312 func (p FieldRepetitionType) MarshalText() ([]byte, error) { 313 return []byte(p.String()), nil 314 } 315 316 func (p *FieldRepetitionType) UnmarshalText(text []byte) error { 317 q, err := FieldRepetitionTypeFromString(string(text)) 318 if err != nil { 319 return err 320 } 321 *p = q 322 return nil 323 } 324 325 func (p *FieldRepetitionType) Scan(value interface{}) error { 326 v, ok := value.(int64) 327 if !ok { 328 return errors.New("Scan value is not int64") 329 } 330 *p = FieldRepetitionType(v) 331 return nil 332 } 333 334 func (p *FieldRepetitionType) Value() (driver.Value, error) { 335 if p == nil { 336 return nil, nil 337 } 338 return int64(*p), nil 339 } 340 341 //Encodings supported by Parquet. Not all encodings are valid for all types. These 342 //enums are also used to specify the encoding of definition and repetition levels. 343 //See the accompanying doc for the details of the more complicated encodings. 344 type Encoding int64 345 346 const ( 347 Encoding_PLAIN Encoding = 0 348 Encoding_PLAIN_DICTIONARY Encoding = 2 349 Encoding_RLE Encoding = 3 350 Encoding_BIT_PACKED Encoding = 4 351 Encoding_DELTA_BINARY_PACKED Encoding = 5 352 Encoding_DELTA_LENGTH_BYTE_ARRAY Encoding = 6 353 Encoding_DELTA_BYTE_ARRAY Encoding = 7 354 Encoding_RLE_DICTIONARY Encoding = 8 355 Encoding_BYTE_STREAM_SPLIT Encoding = 9 356 ) 357 358 func (p Encoding) String() string { 359 switch p { 360 case Encoding_PLAIN: 361 return "PLAIN" 362 case Encoding_PLAIN_DICTIONARY: 363 return "PLAIN_DICTIONARY" 364 case Encoding_RLE: 365 return "RLE" 366 case Encoding_BIT_PACKED: 367 return "BIT_PACKED" 368 case Encoding_DELTA_BINARY_PACKED: 369 return "DELTA_BINARY_PACKED" 370 case Encoding_DELTA_LENGTH_BYTE_ARRAY: 371 return "DELTA_LENGTH_BYTE_ARRAY" 372 case Encoding_DELTA_BYTE_ARRAY: 373 return "DELTA_BYTE_ARRAY" 374 case Encoding_RLE_DICTIONARY: 375 return "RLE_DICTIONARY" 376 case Encoding_BYTE_STREAM_SPLIT: 377 return "BYTE_STREAM_SPLIT" 378 } 379 return "<UNSET>" 380 } 381 382 func EncodingFromString(s string) (Encoding, error) { 383 switch s { 384 case "PLAIN": 385 return Encoding_PLAIN, nil 386 case "PLAIN_DICTIONARY": 387 return Encoding_PLAIN_DICTIONARY, nil 388 case "RLE": 389 return Encoding_RLE, nil 390 case "BIT_PACKED": 391 return Encoding_BIT_PACKED, nil 392 case "DELTA_BINARY_PACKED": 393 return Encoding_DELTA_BINARY_PACKED, nil 394 case "DELTA_LENGTH_BYTE_ARRAY": 395 return Encoding_DELTA_LENGTH_BYTE_ARRAY, nil 396 case "DELTA_BYTE_ARRAY": 397 return Encoding_DELTA_BYTE_ARRAY, nil 398 case "RLE_DICTIONARY": 399 return Encoding_RLE_DICTIONARY, nil 400 case "BYTE_STREAM_SPLIT": 401 return Encoding_BYTE_STREAM_SPLIT, nil 402 } 403 return Encoding(0), fmt.Errorf("not a valid Encoding string") 404 } 405 406 func EncodingPtr(v Encoding) *Encoding { return &v } 407 408 func (p Encoding) MarshalText() ([]byte, error) { 409 return []byte(p.String()), nil 410 } 411 412 func (p *Encoding) UnmarshalText(text []byte) error { 413 q, err := EncodingFromString(string(text)) 414 if err != nil { 415 return err 416 } 417 *p = q 418 return nil 419 } 420 421 func (p *Encoding) Scan(value interface{}) error { 422 v, ok := value.(int64) 423 if !ok { 424 return errors.New("Scan value is not int64") 425 } 426 *p = Encoding(v) 427 return nil 428 } 429 430 func (p *Encoding) Value() (driver.Value, error) { 431 if p == nil { 432 return nil, nil 433 } 434 return int64(*p), nil 435 } 436 437 //Supported compression algorithms. 438 // 439 //Codecs added in format version X.Y can be read by readers based on X.Y and later. 440 //Codec support may vary between readers based on the format version and 441 //libraries available at runtime. 442 // 443 //See Compression.md for a detailed specification of these algorithms. 444 type CompressionCodec int64 445 446 const ( 447 CompressionCodec_UNCOMPRESSED CompressionCodec = 0 448 CompressionCodec_SNAPPY CompressionCodec = 1 449 CompressionCodec_GZIP CompressionCodec = 2 450 CompressionCodec_LZO CompressionCodec = 3 451 CompressionCodec_BROTLI CompressionCodec = 4 452 CompressionCodec_LZ4 CompressionCodec = 5 453 CompressionCodec_ZSTD CompressionCodec = 6 454 CompressionCodec_LZ4_RAW CompressionCodec = 7 455 ) 456 457 func (p CompressionCodec) String() string { 458 switch p { 459 case CompressionCodec_UNCOMPRESSED: 460 return "UNCOMPRESSED" 461 case CompressionCodec_SNAPPY: 462 return "SNAPPY" 463 case CompressionCodec_GZIP: 464 return "GZIP" 465 case CompressionCodec_LZO: 466 return "LZO" 467 case CompressionCodec_BROTLI: 468 return "BROTLI" 469 case CompressionCodec_LZ4: 470 return "LZ4" 471 case CompressionCodec_ZSTD: 472 return "ZSTD" 473 case CompressionCodec_LZ4_RAW: 474 return "LZ4_RAW" 475 } 476 return "<UNSET>" 477 } 478 479 func CompressionCodecFromString(s string) (CompressionCodec, error) { 480 switch s { 481 case "UNCOMPRESSED": 482 return CompressionCodec_UNCOMPRESSED, nil 483 case "SNAPPY": 484 return CompressionCodec_SNAPPY, nil 485 case "GZIP": 486 return CompressionCodec_GZIP, nil 487 case "LZO": 488 return CompressionCodec_LZO, nil 489 case "BROTLI": 490 return CompressionCodec_BROTLI, nil 491 case "LZ4": 492 return CompressionCodec_LZ4, nil 493 case "ZSTD": 494 return CompressionCodec_ZSTD, nil 495 case "LZ4_RAW": 496 return CompressionCodec_LZ4_RAW, nil 497 } 498 return CompressionCodec(0), fmt.Errorf("not a valid CompressionCodec string") 499 } 500 501 func CompressionCodecPtr(v CompressionCodec) *CompressionCodec { return &v } 502 503 func (p CompressionCodec) MarshalText() ([]byte, error) { 504 return []byte(p.String()), nil 505 } 506 507 func (p *CompressionCodec) UnmarshalText(text []byte) error { 508 q, err := CompressionCodecFromString(string(text)) 509 if err != nil { 510 return err 511 } 512 *p = q 513 return nil 514 } 515 516 func (p *CompressionCodec) Scan(value interface{}) error { 517 v, ok := value.(int64) 518 if !ok { 519 return errors.New("Scan value is not int64") 520 } 521 *p = CompressionCodec(v) 522 return nil 523 } 524 525 func (p *CompressionCodec) Value() (driver.Value, error) { 526 if p == nil { 527 return nil, nil 528 } 529 return int64(*p), nil 530 } 531 532 type PageType int64 533 534 const ( 535 PageType_DATA_PAGE PageType = 0 536 PageType_INDEX_PAGE PageType = 1 537 PageType_DICTIONARY_PAGE PageType = 2 538 PageType_DATA_PAGE_V2 PageType = 3 539 ) 540 541 func (p PageType) String() string { 542 switch p { 543 case PageType_DATA_PAGE: 544 return "DATA_PAGE" 545 case PageType_INDEX_PAGE: 546 return "INDEX_PAGE" 547 case PageType_DICTIONARY_PAGE: 548 return "DICTIONARY_PAGE" 549 case PageType_DATA_PAGE_V2: 550 return "DATA_PAGE_V2" 551 } 552 return "<UNSET>" 553 } 554 555 func PageTypeFromString(s string) (PageType, error) { 556 switch s { 557 case "DATA_PAGE": 558 return PageType_DATA_PAGE, nil 559 case "INDEX_PAGE": 560 return PageType_INDEX_PAGE, nil 561 case "DICTIONARY_PAGE": 562 return PageType_DICTIONARY_PAGE, nil 563 case "DATA_PAGE_V2": 564 return PageType_DATA_PAGE_V2, nil 565 } 566 return PageType(0), fmt.Errorf("not a valid PageType string") 567 } 568 569 func PageTypePtr(v PageType) *PageType { return &v } 570 571 func (p PageType) MarshalText() ([]byte, error) { 572 return []byte(p.String()), nil 573 } 574 575 func (p *PageType) UnmarshalText(text []byte) error { 576 q, err := PageTypeFromString(string(text)) 577 if err != nil { 578 return err 579 } 580 *p = q 581 return nil 582 } 583 584 func (p *PageType) Scan(value interface{}) error { 585 v, ok := value.(int64) 586 if !ok { 587 return errors.New("Scan value is not int64") 588 } 589 *p = PageType(v) 590 return nil 591 } 592 593 func (p *PageType) Value() (driver.Value, error) { 594 if p == nil { 595 return nil, nil 596 } 597 return int64(*p), nil 598 } 599 600 //Enum to annotate whether lists of min/max elements inside ColumnIndex 601 //are ordered and if so, in which direction. 602 type BoundaryOrder int64 603 604 const ( 605 BoundaryOrder_UNORDERED BoundaryOrder = 0 606 BoundaryOrder_ASCENDING BoundaryOrder = 1 607 BoundaryOrder_DESCENDING BoundaryOrder = 2 608 ) 609 610 func (p BoundaryOrder) String() string { 611 switch p { 612 case BoundaryOrder_UNORDERED: 613 return "UNORDERED" 614 case BoundaryOrder_ASCENDING: 615 return "ASCENDING" 616 case BoundaryOrder_DESCENDING: 617 return "DESCENDING" 618 } 619 return "<UNSET>" 620 } 621 622 func BoundaryOrderFromString(s string) (BoundaryOrder, error) { 623 switch s { 624 case "UNORDERED": 625 return BoundaryOrder_UNORDERED, nil 626 case "ASCENDING": 627 return BoundaryOrder_ASCENDING, nil 628 case "DESCENDING": 629 return BoundaryOrder_DESCENDING, nil 630 } 631 return BoundaryOrder(0), fmt.Errorf("not a valid BoundaryOrder string") 632 } 633 634 func BoundaryOrderPtr(v BoundaryOrder) *BoundaryOrder { return &v } 635 636 func (p BoundaryOrder) MarshalText() ([]byte, error) { 637 return []byte(p.String()), nil 638 } 639 640 func (p *BoundaryOrder) UnmarshalText(text []byte) error { 641 q, err := BoundaryOrderFromString(string(text)) 642 if err != nil { 643 return err 644 } 645 *p = q 646 return nil 647 } 648 649 func (p *BoundaryOrder) Scan(value interface{}) error { 650 v, ok := value.(int64) 651 if !ok { 652 return errors.New("Scan value is not int64") 653 } 654 *p = BoundaryOrder(v) 655 return nil 656 } 657 658 func (p *BoundaryOrder) Value() (driver.Value, error) { 659 if p == nil { 660 return nil, nil 661 } 662 return int64(*p), nil 663 } 664 665 // Statistics per row group and per page 666 // All fields are optional. 667 // 668 // Attributes: 669 // - Max: DEPRECATED: min and max value of the column. Use min_value and max_value. 670 // 671 // Values are encoded using PLAIN encoding, except that variable-length byte 672 // arrays do not include a length prefix. 673 // 674 // These fields encode min and max values determined by signed comparison 675 // only. New files should use the correct order for a column's logical type 676 // and store the values in the min_value and max_value fields. 677 // 678 // To support older readers, these may be set when the column order is 679 // signed. 680 // - Min 681 // - NullCount: count of null value in the column 682 // - DistinctCount: count of distinct values occurring 683 // - MaxValue: Min and max values for the column, determined by its ColumnOrder. 684 // 685 // Values are encoded using PLAIN encoding, except that variable-length byte 686 // arrays do not include a length prefix. 687 // - MinValue 688 type Statistics struct { 689 Max []byte `thrift:"max,1" db:"max" json:"max,omitempty"` 690 Min []byte `thrift:"min,2" db:"min" json:"min,omitempty"` 691 NullCount *int64 `thrift:"null_count,3" db:"null_count" json:"null_count,omitempty"` 692 DistinctCount *int64 `thrift:"distinct_count,4" db:"distinct_count" json:"distinct_count,omitempty"` 693 MaxValue []byte `thrift:"max_value,5" db:"max_value" json:"max_value,omitempty"` 694 MinValue []byte `thrift:"min_value,6" db:"min_value" json:"min_value,omitempty"` 695 } 696 697 func NewStatistics() *Statistics { 698 return &Statistics{} 699 } 700 701 var Statistics_Max_DEFAULT []byte 702 703 func (p *Statistics) GetMax() []byte { 704 return p.Max 705 } 706 707 var Statistics_Min_DEFAULT []byte 708 709 func (p *Statistics) GetMin() []byte { 710 return p.Min 711 } 712 713 var Statistics_NullCount_DEFAULT int64 714 715 func (p *Statistics) GetNullCount() int64 { 716 if !p.IsSetNullCount() { 717 return Statistics_NullCount_DEFAULT 718 } 719 return *p.NullCount 720 } 721 722 var Statistics_DistinctCount_DEFAULT int64 723 724 func (p *Statistics) GetDistinctCount() int64 { 725 if !p.IsSetDistinctCount() { 726 return Statistics_DistinctCount_DEFAULT 727 } 728 return *p.DistinctCount 729 } 730 731 var Statistics_MaxValue_DEFAULT []byte 732 733 func (p *Statistics) GetMaxValue() []byte { 734 return p.MaxValue 735 } 736 737 var Statistics_MinValue_DEFAULT []byte 738 739 func (p *Statistics) GetMinValue() []byte { 740 return p.MinValue 741 } 742 func (p *Statistics) IsSetMax() bool { 743 return p.Max != nil 744 } 745 746 func (p *Statistics) IsSetMin() bool { 747 return p.Min != nil 748 } 749 750 func (p *Statistics) IsSetNullCount() bool { 751 return p.NullCount != nil 752 } 753 754 func (p *Statistics) IsSetDistinctCount() bool { 755 return p.DistinctCount != nil 756 } 757 758 func (p *Statistics) IsSetMaxValue() bool { 759 return p.MaxValue != nil 760 } 761 762 func (p *Statistics) IsSetMinValue() bool { 763 return p.MinValue != nil 764 } 765 766 func (p *Statistics) Read(ctx context.Context, iprot thrift.TProtocol) error { 767 if _, err := iprot.ReadStructBegin(ctx); err != nil { 768 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 769 } 770 771 for { 772 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 773 if err != nil { 774 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 775 } 776 if fieldTypeId == thrift.STOP { 777 break 778 } 779 switch fieldId { 780 case 1: 781 if fieldTypeId == thrift.STRING { 782 if err := p.ReadField1(ctx, iprot); err != nil { 783 return err 784 } 785 } else { 786 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 787 return err 788 } 789 } 790 case 2: 791 if fieldTypeId == thrift.STRING { 792 if err := p.ReadField2(ctx, iprot); err != nil { 793 return err 794 } 795 } else { 796 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 797 return err 798 } 799 } 800 case 3: 801 if fieldTypeId == thrift.I64 { 802 if err := p.ReadField3(ctx, iprot); err != nil { 803 return err 804 } 805 } else { 806 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 807 return err 808 } 809 } 810 case 4: 811 if fieldTypeId == thrift.I64 { 812 if err := p.ReadField4(ctx, iprot); err != nil { 813 return err 814 } 815 } else { 816 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 817 return err 818 } 819 } 820 case 5: 821 if fieldTypeId == thrift.STRING { 822 if err := p.ReadField5(ctx, iprot); err != nil { 823 return err 824 } 825 } else { 826 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 827 return err 828 } 829 } 830 case 6: 831 if fieldTypeId == thrift.STRING { 832 if err := p.ReadField6(ctx, iprot); err != nil { 833 return err 834 } 835 } else { 836 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 837 return err 838 } 839 } 840 default: 841 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 842 return err 843 } 844 } 845 if err := iprot.ReadFieldEnd(ctx); err != nil { 846 return err 847 } 848 } 849 if err := iprot.ReadStructEnd(ctx); err != nil { 850 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 851 } 852 return nil 853 } 854 855 func (p *Statistics) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 856 if v, err := iprot.ReadBinary(ctx); err != nil { 857 return thrift.PrependError("error reading field 1: ", err) 858 } else { 859 p.Max = v 860 } 861 return nil 862 } 863 864 func (p *Statistics) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 865 if v, err := iprot.ReadBinary(ctx); err != nil { 866 return thrift.PrependError("error reading field 2: ", err) 867 } else { 868 p.Min = v 869 } 870 return nil 871 } 872 873 func (p *Statistics) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 874 if v, err := iprot.ReadI64(ctx); err != nil { 875 return thrift.PrependError("error reading field 3: ", err) 876 } else { 877 p.NullCount = &v 878 } 879 return nil 880 } 881 882 func (p *Statistics) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 883 if v, err := iprot.ReadI64(ctx); err != nil { 884 return thrift.PrependError("error reading field 4: ", err) 885 } else { 886 p.DistinctCount = &v 887 } 888 return nil 889 } 890 891 func (p *Statistics) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 892 if v, err := iprot.ReadBinary(ctx); err != nil { 893 return thrift.PrependError("error reading field 5: ", err) 894 } else { 895 p.MaxValue = v 896 } 897 return nil 898 } 899 900 func (p *Statistics) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 901 if v, err := iprot.ReadBinary(ctx); err != nil { 902 return thrift.PrependError("error reading field 6: ", err) 903 } else { 904 p.MinValue = v 905 } 906 return nil 907 } 908 909 func (p *Statistics) Write(ctx context.Context, oprot thrift.TProtocol) error { 910 if err := oprot.WriteStructBegin(ctx, "Statistics"); err != nil { 911 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 912 } 913 if p != nil { 914 if err := p.writeField1(ctx, oprot); err != nil { 915 return err 916 } 917 if err := p.writeField2(ctx, oprot); err != nil { 918 return err 919 } 920 if err := p.writeField3(ctx, oprot); err != nil { 921 return err 922 } 923 if err := p.writeField4(ctx, oprot); err != nil { 924 return err 925 } 926 if err := p.writeField5(ctx, oprot); err != nil { 927 return err 928 } 929 if err := p.writeField6(ctx, oprot); err != nil { 930 return err 931 } 932 } 933 if err := oprot.WriteFieldStop(ctx); err != nil { 934 return thrift.PrependError("write field stop error: ", err) 935 } 936 if err := oprot.WriteStructEnd(ctx); err != nil { 937 return thrift.PrependError("write struct stop error: ", err) 938 } 939 return nil 940 } 941 942 func (p *Statistics) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 943 if p.IsSetMax() { 944 if err := oprot.WriteFieldBegin(ctx, "max", thrift.STRING, 1); err != nil { 945 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:max: ", p), err) 946 } 947 if err := oprot.WriteBinary(ctx, p.Max); err != nil { 948 return thrift.PrependError(fmt.Sprintf("%T.max (1) field write error: ", p), err) 949 } 950 if err := oprot.WriteFieldEnd(ctx); err != nil { 951 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:max: ", p), err) 952 } 953 } 954 return err 955 } 956 957 func (p *Statistics) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 958 if p.IsSetMin() { 959 if err := oprot.WriteFieldBegin(ctx, "min", thrift.STRING, 2); err != nil { 960 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:min: ", p), err) 961 } 962 if err := oprot.WriteBinary(ctx, p.Min); err != nil { 963 return thrift.PrependError(fmt.Sprintf("%T.min (2) field write error: ", p), err) 964 } 965 if err := oprot.WriteFieldEnd(ctx); err != nil { 966 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:min: ", p), err) 967 } 968 } 969 return err 970 } 971 972 func (p *Statistics) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 973 if p.IsSetNullCount() { 974 if err := oprot.WriteFieldBegin(ctx, "null_count", thrift.I64, 3); err != nil { 975 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:null_count: ", p), err) 976 } 977 if err := oprot.WriteI64(ctx, int64(*p.NullCount)); err != nil { 978 return thrift.PrependError(fmt.Sprintf("%T.null_count (3) field write error: ", p), err) 979 } 980 if err := oprot.WriteFieldEnd(ctx); err != nil { 981 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:null_count: ", p), err) 982 } 983 } 984 return err 985 } 986 987 func (p *Statistics) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 988 if p.IsSetDistinctCount() { 989 if err := oprot.WriteFieldBegin(ctx, "distinct_count", thrift.I64, 4); err != nil { 990 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:distinct_count: ", p), err) 991 } 992 if err := oprot.WriteI64(ctx, int64(*p.DistinctCount)); err != nil { 993 return thrift.PrependError(fmt.Sprintf("%T.distinct_count (4) field write error: ", p), err) 994 } 995 if err := oprot.WriteFieldEnd(ctx); err != nil { 996 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:distinct_count: ", p), err) 997 } 998 } 999 return err 1000 } 1001 1002 func (p *Statistics) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 1003 if p.IsSetMaxValue() { 1004 if err := oprot.WriteFieldBegin(ctx, "max_value", thrift.STRING, 5); err != nil { 1005 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:max_value: ", p), err) 1006 } 1007 if err := oprot.WriteBinary(ctx, p.MaxValue); err != nil { 1008 return thrift.PrependError(fmt.Sprintf("%T.max_value (5) field write error: ", p), err) 1009 } 1010 if err := oprot.WriteFieldEnd(ctx); err != nil { 1011 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:max_value: ", p), err) 1012 } 1013 } 1014 return err 1015 } 1016 1017 func (p *Statistics) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 1018 if p.IsSetMinValue() { 1019 if err := oprot.WriteFieldBegin(ctx, "min_value", thrift.STRING, 6); err != nil { 1020 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:min_value: ", p), err) 1021 } 1022 if err := oprot.WriteBinary(ctx, p.MinValue); err != nil { 1023 return thrift.PrependError(fmt.Sprintf("%T.min_value (6) field write error: ", p), err) 1024 } 1025 if err := oprot.WriteFieldEnd(ctx); err != nil { 1026 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:min_value: ", p), err) 1027 } 1028 } 1029 return err 1030 } 1031 1032 func (p *Statistics) Equals(other *Statistics) bool { 1033 if p == other { 1034 return true 1035 } else if p == nil || other == nil { 1036 return false 1037 } 1038 if bytes.Compare(p.Max, other.Max) != 0 { 1039 return false 1040 } 1041 if bytes.Compare(p.Min, other.Min) != 0 { 1042 return false 1043 } 1044 if p.NullCount != other.NullCount { 1045 if p.NullCount == nil || other.NullCount == nil { 1046 return false 1047 } 1048 if (*p.NullCount) != (*other.NullCount) { 1049 return false 1050 } 1051 } 1052 if p.DistinctCount != other.DistinctCount { 1053 if p.DistinctCount == nil || other.DistinctCount == nil { 1054 return false 1055 } 1056 if (*p.DistinctCount) != (*other.DistinctCount) { 1057 return false 1058 } 1059 } 1060 if bytes.Compare(p.MaxValue, other.MaxValue) != 0 { 1061 return false 1062 } 1063 if bytes.Compare(p.MinValue, other.MinValue) != 0 { 1064 return false 1065 } 1066 return true 1067 } 1068 1069 func (p *Statistics) String() string { 1070 if p == nil { 1071 return "<nil>" 1072 } 1073 return fmt.Sprintf("Statistics(%+v)", *p) 1074 } 1075 1076 // Empty structs to use as logical type annotations 1077 type StringType struct { 1078 } 1079 1080 func NewStringType() *StringType { 1081 return &StringType{} 1082 } 1083 1084 func (p *StringType) 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 for { 1090 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1091 if err != nil { 1092 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1093 } 1094 if fieldTypeId == thrift.STOP { 1095 break 1096 } 1097 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1098 return err 1099 } 1100 if err := iprot.ReadFieldEnd(ctx); err != nil { 1101 return err 1102 } 1103 } 1104 if err := iprot.ReadStructEnd(ctx); err != nil { 1105 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1106 } 1107 return nil 1108 } 1109 1110 func (p *StringType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1111 if err := oprot.WriteStructBegin(ctx, "StringType"); err != nil { 1112 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1113 } 1114 if p != nil { 1115 } 1116 if err := oprot.WriteFieldStop(ctx); err != nil { 1117 return thrift.PrependError("write field stop error: ", err) 1118 } 1119 if err := oprot.WriteStructEnd(ctx); err != nil { 1120 return thrift.PrependError("write struct stop error: ", err) 1121 } 1122 return nil 1123 } 1124 1125 func (p *StringType) Equals(other *StringType) bool { 1126 if p == other { 1127 return true 1128 } else if p == nil || other == nil { 1129 return false 1130 } 1131 return true 1132 } 1133 1134 func (p *StringType) String() string { 1135 if p == nil { 1136 return "<nil>" 1137 } 1138 return fmt.Sprintf("StringType(%+v)", *p) 1139 } 1140 1141 type UUIDType struct { 1142 } 1143 1144 func NewUUIDType() *UUIDType { 1145 return &UUIDType{} 1146 } 1147 1148 func (p *UUIDType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1149 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1150 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1151 } 1152 1153 for { 1154 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1155 if err != nil { 1156 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1157 } 1158 if fieldTypeId == thrift.STOP { 1159 break 1160 } 1161 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1162 return err 1163 } 1164 if err := iprot.ReadFieldEnd(ctx); err != nil { 1165 return err 1166 } 1167 } 1168 if err := iprot.ReadStructEnd(ctx); err != nil { 1169 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1170 } 1171 return nil 1172 } 1173 1174 func (p *UUIDType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1175 if err := oprot.WriteStructBegin(ctx, "UUIDType"); err != nil { 1176 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1177 } 1178 if p != nil { 1179 } 1180 if err := oprot.WriteFieldStop(ctx); err != nil { 1181 return thrift.PrependError("write field stop error: ", err) 1182 } 1183 if err := oprot.WriteStructEnd(ctx); err != nil { 1184 return thrift.PrependError("write struct stop error: ", err) 1185 } 1186 return nil 1187 } 1188 1189 func (p *UUIDType) Equals(other *UUIDType) bool { 1190 if p == other { 1191 return true 1192 } else if p == nil || other == nil { 1193 return false 1194 } 1195 return true 1196 } 1197 1198 func (p *UUIDType) String() string { 1199 if p == nil { 1200 return "<nil>" 1201 } 1202 return fmt.Sprintf("UUIDType(%+v)", *p) 1203 } 1204 1205 type MapType struct { 1206 } 1207 1208 func NewMapType() *MapType { 1209 return &MapType{} 1210 } 1211 1212 func (p *MapType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1213 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1214 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1215 } 1216 1217 for { 1218 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1219 if err != nil { 1220 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1221 } 1222 if fieldTypeId == thrift.STOP { 1223 break 1224 } 1225 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1226 return err 1227 } 1228 if err := iprot.ReadFieldEnd(ctx); err != nil { 1229 return err 1230 } 1231 } 1232 if err := iprot.ReadStructEnd(ctx); err != nil { 1233 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1234 } 1235 return nil 1236 } 1237 1238 func (p *MapType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1239 if err := oprot.WriteStructBegin(ctx, "MapType"); err != nil { 1240 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1241 } 1242 if p != nil { 1243 } 1244 if err := oprot.WriteFieldStop(ctx); err != nil { 1245 return thrift.PrependError("write field stop error: ", err) 1246 } 1247 if err := oprot.WriteStructEnd(ctx); err != nil { 1248 return thrift.PrependError("write struct stop error: ", err) 1249 } 1250 return nil 1251 } 1252 1253 func (p *MapType) Equals(other *MapType) bool { 1254 if p == other { 1255 return true 1256 } else if p == nil || other == nil { 1257 return false 1258 } 1259 return true 1260 } 1261 1262 func (p *MapType) String() string { 1263 if p == nil { 1264 return "<nil>" 1265 } 1266 return fmt.Sprintf("MapType(%+v)", *p) 1267 } 1268 1269 type ListType struct { 1270 } 1271 1272 func NewListType() *ListType { 1273 return &ListType{} 1274 } 1275 1276 func (p *ListType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1277 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1278 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1279 } 1280 1281 for { 1282 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1283 if err != nil { 1284 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1285 } 1286 if fieldTypeId == thrift.STOP { 1287 break 1288 } 1289 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1290 return err 1291 } 1292 if err := iprot.ReadFieldEnd(ctx); err != nil { 1293 return err 1294 } 1295 } 1296 if err := iprot.ReadStructEnd(ctx); err != nil { 1297 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1298 } 1299 return nil 1300 } 1301 1302 func (p *ListType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1303 if err := oprot.WriteStructBegin(ctx, "ListType"); err != nil { 1304 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1305 } 1306 if p != nil { 1307 } 1308 if err := oprot.WriteFieldStop(ctx); err != nil { 1309 return thrift.PrependError("write field stop error: ", err) 1310 } 1311 if err := oprot.WriteStructEnd(ctx); err != nil { 1312 return thrift.PrependError("write struct stop error: ", err) 1313 } 1314 return nil 1315 } 1316 1317 func (p *ListType) Equals(other *ListType) bool { 1318 if p == other { 1319 return true 1320 } else if p == nil || other == nil { 1321 return false 1322 } 1323 return true 1324 } 1325 1326 func (p *ListType) String() string { 1327 if p == nil { 1328 return "<nil>" 1329 } 1330 return fmt.Sprintf("ListType(%+v)", *p) 1331 } 1332 1333 type EnumType struct { 1334 } 1335 1336 func NewEnumType() *EnumType { 1337 return &EnumType{} 1338 } 1339 1340 func (p *EnumType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1341 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1342 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1343 } 1344 1345 for { 1346 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1347 if err != nil { 1348 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1349 } 1350 if fieldTypeId == thrift.STOP { 1351 break 1352 } 1353 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1354 return err 1355 } 1356 if err := iprot.ReadFieldEnd(ctx); err != nil { 1357 return err 1358 } 1359 } 1360 if err := iprot.ReadStructEnd(ctx); err != nil { 1361 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1362 } 1363 return nil 1364 } 1365 1366 func (p *EnumType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1367 if err := oprot.WriteStructBegin(ctx, "EnumType"); err != nil { 1368 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1369 } 1370 if p != nil { 1371 } 1372 if err := oprot.WriteFieldStop(ctx); err != nil { 1373 return thrift.PrependError("write field stop error: ", err) 1374 } 1375 if err := oprot.WriteStructEnd(ctx); err != nil { 1376 return thrift.PrependError("write struct stop error: ", err) 1377 } 1378 return nil 1379 } 1380 1381 func (p *EnumType) Equals(other *EnumType) bool { 1382 if p == other { 1383 return true 1384 } else if p == nil || other == nil { 1385 return false 1386 } 1387 return true 1388 } 1389 1390 func (p *EnumType) String() string { 1391 if p == nil { 1392 return "<nil>" 1393 } 1394 return fmt.Sprintf("EnumType(%+v)", *p) 1395 } 1396 1397 type DateType struct { 1398 } 1399 1400 func NewDateType() *DateType { 1401 return &DateType{} 1402 } 1403 1404 func (p *DateType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1405 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1406 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1407 } 1408 1409 for { 1410 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1411 if err != nil { 1412 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1413 } 1414 if fieldTypeId == thrift.STOP { 1415 break 1416 } 1417 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1418 return err 1419 } 1420 if err := iprot.ReadFieldEnd(ctx); err != nil { 1421 return err 1422 } 1423 } 1424 if err := iprot.ReadStructEnd(ctx); err != nil { 1425 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1426 } 1427 return nil 1428 } 1429 1430 func (p *DateType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1431 if err := oprot.WriteStructBegin(ctx, "DateType"); err != nil { 1432 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1433 } 1434 if p != nil { 1435 } 1436 if err := oprot.WriteFieldStop(ctx); err != nil { 1437 return thrift.PrependError("write field stop error: ", err) 1438 } 1439 if err := oprot.WriteStructEnd(ctx); err != nil { 1440 return thrift.PrependError("write struct stop error: ", err) 1441 } 1442 return nil 1443 } 1444 1445 func (p *DateType) Equals(other *DateType) bool { 1446 if p == other { 1447 return true 1448 } else if p == nil || other == nil { 1449 return false 1450 } 1451 return true 1452 } 1453 1454 func (p *DateType) String() string { 1455 if p == nil { 1456 return "<nil>" 1457 } 1458 return fmt.Sprintf("DateType(%+v)", *p) 1459 } 1460 1461 // Logical type to annotate a column that is always null. 1462 // 1463 // Sometimes when discovering the schema of existing data, values are always 1464 // null and the physical type can't be determined. This annotation signals 1465 // the case where the physical type was guessed from all null values. 1466 type NullType struct { 1467 } 1468 1469 func NewNullType() *NullType { 1470 return &NullType{} 1471 } 1472 1473 func (p *NullType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1474 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1475 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1476 } 1477 1478 for { 1479 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1480 if err != nil { 1481 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1482 } 1483 if fieldTypeId == thrift.STOP { 1484 break 1485 } 1486 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1487 return err 1488 } 1489 if err := iprot.ReadFieldEnd(ctx); err != nil { 1490 return err 1491 } 1492 } 1493 if err := iprot.ReadStructEnd(ctx); err != nil { 1494 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1495 } 1496 return nil 1497 } 1498 1499 func (p *NullType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1500 if err := oprot.WriteStructBegin(ctx, "NullType"); err != nil { 1501 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1502 } 1503 if p != nil { 1504 } 1505 if err := oprot.WriteFieldStop(ctx); err != nil { 1506 return thrift.PrependError("write field stop error: ", err) 1507 } 1508 if err := oprot.WriteStructEnd(ctx); err != nil { 1509 return thrift.PrependError("write struct stop error: ", err) 1510 } 1511 return nil 1512 } 1513 1514 func (p *NullType) Equals(other *NullType) bool { 1515 if p == other { 1516 return true 1517 } else if p == nil || other == nil { 1518 return false 1519 } 1520 return true 1521 } 1522 1523 func (p *NullType) String() string { 1524 if p == nil { 1525 return "<nil>" 1526 } 1527 return fmt.Sprintf("NullType(%+v)", *p) 1528 } 1529 1530 // Decimal logical type annotation 1531 // 1532 // To maintain forward-compatibility in v1, implementations using this logical 1533 // type must also set scale and precision on the annotated SchemaElement. 1534 // 1535 // Allowed for physical types: INT32, INT64, FIXED, and BINARY 1536 // 1537 // Attributes: 1538 // - Scale 1539 // - Precision 1540 type DecimalType struct { 1541 Scale int32 `thrift:"scale,1,required" db:"scale" json:"scale"` 1542 Precision int32 `thrift:"precision,2,required" db:"precision" json:"precision"` 1543 } 1544 1545 func NewDecimalType() *DecimalType { 1546 return &DecimalType{} 1547 } 1548 1549 func (p *DecimalType) GetScale() int32 { 1550 return p.Scale 1551 } 1552 1553 func (p *DecimalType) GetPrecision() int32 { 1554 return p.Precision 1555 } 1556 func (p *DecimalType) Read(ctx context.Context, iprot thrift.TProtocol) error { 1557 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1558 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1559 } 1560 1561 var issetScale bool = false 1562 var issetPrecision bool = false 1563 1564 for { 1565 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1566 if err != nil { 1567 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1568 } 1569 if fieldTypeId == thrift.STOP { 1570 break 1571 } 1572 switch fieldId { 1573 case 1: 1574 if fieldTypeId == thrift.I32 { 1575 if err := p.ReadField1(ctx, iprot); err != nil { 1576 return err 1577 } 1578 issetScale = true 1579 } else { 1580 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1581 return err 1582 } 1583 } 1584 case 2: 1585 if fieldTypeId == thrift.I32 { 1586 if err := p.ReadField2(ctx, iprot); err != nil { 1587 return err 1588 } 1589 issetPrecision = true 1590 } else { 1591 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1592 return err 1593 } 1594 } 1595 default: 1596 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1597 return err 1598 } 1599 } 1600 if err := iprot.ReadFieldEnd(ctx); err != nil { 1601 return err 1602 } 1603 } 1604 if err := iprot.ReadStructEnd(ctx); err != nil { 1605 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1606 } 1607 if !issetScale { 1608 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Scale is not set")) 1609 } 1610 if !issetPrecision { 1611 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Precision is not set")) 1612 } 1613 return nil 1614 } 1615 1616 func (p *DecimalType) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 1617 if v, err := iprot.ReadI32(ctx); err != nil { 1618 return thrift.PrependError("error reading field 1: ", err) 1619 } else { 1620 p.Scale = v 1621 } 1622 return nil 1623 } 1624 1625 func (p *DecimalType) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 1626 if v, err := iprot.ReadI32(ctx); err != nil { 1627 return thrift.PrependError("error reading field 2: ", err) 1628 } else { 1629 p.Precision = v 1630 } 1631 return nil 1632 } 1633 1634 func (p *DecimalType) Write(ctx context.Context, oprot thrift.TProtocol) error { 1635 if err := oprot.WriteStructBegin(ctx, "DecimalType"); err != nil { 1636 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1637 } 1638 if p != nil { 1639 if err := p.writeField1(ctx, oprot); err != nil { 1640 return err 1641 } 1642 if err := p.writeField2(ctx, oprot); err != nil { 1643 return err 1644 } 1645 } 1646 if err := oprot.WriteFieldStop(ctx); err != nil { 1647 return thrift.PrependError("write field stop error: ", err) 1648 } 1649 if err := oprot.WriteStructEnd(ctx); err != nil { 1650 return thrift.PrependError("write struct stop error: ", err) 1651 } 1652 return nil 1653 } 1654 1655 func (p *DecimalType) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 1656 if err := oprot.WriteFieldBegin(ctx, "scale", thrift.I32, 1); err != nil { 1657 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:scale: ", p), err) 1658 } 1659 if err := oprot.WriteI32(ctx, int32(p.Scale)); err != nil { 1660 return thrift.PrependError(fmt.Sprintf("%T.scale (1) field write error: ", p), err) 1661 } 1662 if err := oprot.WriteFieldEnd(ctx); err != nil { 1663 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:scale: ", p), err) 1664 } 1665 return err 1666 } 1667 1668 func (p *DecimalType) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 1669 if err := oprot.WriteFieldBegin(ctx, "precision", thrift.I32, 2); err != nil { 1670 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:precision: ", p), err) 1671 } 1672 if err := oprot.WriteI32(ctx, int32(p.Precision)); err != nil { 1673 return thrift.PrependError(fmt.Sprintf("%T.precision (2) field write error: ", p), err) 1674 } 1675 if err := oprot.WriteFieldEnd(ctx); err != nil { 1676 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:precision: ", p), err) 1677 } 1678 return err 1679 } 1680 1681 func (p *DecimalType) Equals(other *DecimalType) bool { 1682 if p == other { 1683 return true 1684 } else if p == nil || other == nil { 1685 return false 1686 } 1687 if p.Scale != other.Scale { 1688 return false 1689 } 1690 if p.Precision != other.Precision { 1691 return false 1692 } 1693 return true 1694 } 1695 1696 func (p *DecimalType) String() string { 1697 if p == nil { 1698 return "<nil>" 1699 } 1700 return fmt.Sprintf("DecimalType(%+v)", *p) 1701 } 1702 1703 // Time units for logical types 1704 type MilliSeconds struct { 1705 } 1706 1707 func NewMilliSeconds() *MilliSeconds { 1708 return &MilliSeconds{} 1709 } 1710 1711 func (p *MilliSeconds) Read(ctx context.Context, iprot thrift.TProtocol) error { 1712 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1713 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1714 } 1715 1716 for { 1717 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1718 if err != nil { 1719 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1720 } 1721 if fieldTypeId == thrift.STOP { 1722 break 1723 } 1724 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1725 return err 1726 } 1727 if err := iprot.ReadFieldEnd(ctx); err != nil { 1728 return err 1729 } 1730 } 1731 if err := iprot.ReadStructEnd(ctx); err != nil { 1732 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1733 } 1734 return nil 1735 } 1736 1737 func (p *MilliSeconds) Write(ctx context.Context, oprot thrift.TProtocol) error { 1738 if err := oprot.WriteStructBegin(ctx, "MilliSeconds"); err != nil { 1739 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1740 } 1741 if p != nil { 1742 } 1743 if err := oprot.WriteFieldStop(ctx); err != nil { 1744 return thrift.PrependError("write field stop error: ", err) 1745 } 1746 if err := oprot.WriteStructEnd(ctx); err != nil { 1747 return thrift.PrependError("write struct stop error: ", err) 1748 } 1749 return nil 1750 } 1751 1752 func (p *MilliSeconds) Equals(other *MilliSeconds) bool { 1753 if p == other { 1754 return true 1755 } else if p == nil || other == nil { 1756 return false 1757 } 1758 return true 1759 } 1760 1761 func (p *MilliSeconds) String() string { 1762 if p == nil { 1763 return "<nil>" 1764 } 1765 return fmt.Sprintf("MilliSeconds(%+v)", *p) 1766 } 1767 1768 type MicroSeconds struct { 1769 } 1770 1771 func NewMicroSeconds() *MicroSeconds { 1772 return &MicroSeconds{} 1773 } 1774 1775 func (p *MicroSeconds) Read(ctx context.Context, iprot thrift.TProtocol) error { 1776 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1777 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1778 } 1779 1780 for { 1781 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1782 if err != nil { 1783 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1784 } 1785 if fieldTypeId == thrift.STOP { 1786 break 1787 } 1788 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1789 return err 1790 } 1791 if err := iprot.ReadFieldEnd(ctx); err != nil { 1792 return err 1793 } 1794 } 1795 if err := iprot.ReadStructEnd(ctx); err != nil { 1796 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1797 } 1798 return nil 1799 } 1800 1801 func (p *MicroSeconds) Write(ctx context.Context, oprot thrift.TProtocol) error { 1802 if err := oprot.WriteStructBegin(ctx, "MicroSeconds"); err != nil { 1803 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1804 } 1805 if p != nil { 1806 } 1807 if err := oprot.WriteFieldStop(ctx); err != nil { 1808 return thrift.PrependError("write field stop error: ", err) 1809 } 1810 if err := oprot.WriteStructEnd(ctx); err != nil { 1811 return thrift.PrependError("write struct stop error: ", err) 1812 } 1813 return nil 1814 } 1815 1816 func (p *MicroSeconds) Equals(other *MicroSeconds) bool { 1817 if p == other { 1818 return true 1819 } else if p == nil || other == nil { 1820 return false 1821 } 1822 return true 1823 } 1824 1825 func (p *MicroSeconds) String() string { 1826 if p == nil { 1827 return "<nil>" 1828 } 1829 return fmt.Sprintf("MicroSeconds(%+v)", *p) 1830 } 1831 1832 type NanoSeconds struct { 1833 } 1834 1835 func NewNanoSeconds() *NanoSeconds { 1836 return &NanoSeconds{} 1837 } 1838 1839 func (p *NanoSeconds) Read(ctx context.Context, iprot thrift.TProtocol) error { 1840 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1841 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1842 } 1843 1844 for { 1845 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1846 if err != nil { 1847 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1848 } 1849 if fieldTypeId == thrift.STOP { 1850 break 1851 } 1852 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1853 return err 1854 } 1855 if err := iprot.ReadFieldEnd(ctx); err != nil { 1856 return err 1857 } 1858 } 1859 if err := iprot.ReadStructEnd(ctx); err != nil { 1860 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1861 } 1862 return nil 1863 } 1864 1865 func (p *NanoSeconds) Write(ctx context.Context, oprot thrift.TProtocol) error { 1866 if err := oprot.WriteStructBegin(ctx, "NanoSeconds"); err != nil { 1867 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1868 } 1869 if p != nil { 1870 } 1871 if err := oprot.WriteFieldStop(ctx); err != nil { 1872 return thrift.PrependError("write field stop error: ", err) 1873 } 1874 if err := oprot.WriteStructEnd(ctx); err != nil { 1875 return thrift.PrependError("write struct stop error: ", err) 1876 } 1877 return nil 1878 } 1879 1880 func (p *NanoSeconds) Equals(other *NanoSeconds) bool { 1881 if p == other { 1882 return true 1883 } else if p == nil || other == nil { 1884 return false 1885 } 1886 return true 1887 } 1888 1889 func (p *NanoSeconds) String() string { 1890 if p == nil { 1891 return "<nil>" 1892 } 1893 return fmt.Sprintf("NanoSeconds(%+v)", *p) 1894 } 1895 1896 // Attributes: 1897 // - MILLIS 1898 // - MICROS 1899 // - NANOS 1900 type TimeUnit struct { 1901 MILLIS *MilliSeconds `thrift:"MILLIS,1" db:"MILLIS" json:"MILLIS,omitempty"` 1902 MICROS *MicroSeconds `thrift:"MICROS,2" db:"MICROS" json:"MICROS,omitempty"` 1903 NANOS *NanoSeconds `thrift:"NANOS,3" db:"NANOS" json:"NANOS,omitempty"` 1904 } 1905 1906 func NewTimeUnit() *TimeUnit { 1907 return &TimeUnit{} 1908 } 1909 1910 var TimeUnit_MILLIS_DEFAULT *MilliSeconds 1911 1912 func (p *TimeUnit) GetMILLIS() *MilliSeconds { 1913 if !p.IsSetMILLIS() { 1914 return TimeUnit_MILLIS_DEFAULT 1915 } 1916 return p.MILLIS 1917 } 1918 1919 var TimeUnit_MICROS_DEFAULT *MicroSeconds 1920 1921 func (p *TimeUnit) GetMICROS() *MicroSeconds { 1922 if !p.IsSetMICROS() { 1923 return TimeUnit_MICROS_DEFAULT 1924 } 1925 return p.MICROS 1926 } 1927 1928 var TimeUnit_NANOS_DEFAULT *NanoSeconds 1929 1930 func (p *TimeUnit) GetNANOS() *NanoSeconds { 1931 if !p.IsSetNANOS() { 1932 return TimeUnit_NANOS_DEFAULT 1933 } 1934 return p.NANOS 1935 } 1936 func (p *TimeUnit) CountSetFieldsTimeUnit() int { 1937 count := 0 1938 if p.IsSetMILLIS() { 1939 count++ 1940 } 1941 if p.IsSetMICROS() { 1942 count++ 1943 } 1944 if p.IsSetNANOS() { 1945 count++ 1946 } 1947 return count 1948 1949 } 1950 1951 func (p *TimeUnit) IsSetMILLIS() bool { 1952 return p.MILLIS != nil 1953 } 1954 1955 func (p *TimeUnit) IsSetMICROS() bool { 1956 return p.MICROS != nil 1957 } 1958 1959 func (p *TimeUnit) IsSetNANOS() bool { 1960 return p.NANOS != nil 1961 } 1962 1963 func (p *TimeUnit) Read(ctx context.Context, iprot thrift.TProtocol) error { 1964 if _, err := iprot.ReadStructBegin(ctx); err != nil { 1965 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 1966 } 1967 1968 for { 1969 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 1970 if err != nil { 1971 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 1972 } 1973 if fieldTypeId == thrift.STOP { 1974 break 1975 } 1976 switch fieldId { 1977 case 1: 1978 if fieldTypeId == thrift.STRUCT { 1979 if err := p.ReadField1(ctx, iprot); err != nil { 1980 return err 1981 } 1982 } else { 1983 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1984 return err 1985 } 1986 } 1987 case 2: 1988 if fieldTypeId == thrift.STRUCT { 1989 if err := p.ReadField2(ctx, iprot); err != nil { 1990 return err 1991 } 1992 } else { 1993 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 1994 return err 1995 } 1996 } 1997 case 3: 1998 if fieldTypeId == thrift.STRUCT { 1999 if err := p.ReadField3(ctx, iprot); err != nil { 2000 return err 2001 } 2002 } else { 2003 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2004 return err 2005 } 2006 } 2007 default: 2008 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2009 return err 2010 } 2011 } 2012 if err := iprot.ReadFieldEnd(ctx); err != nil { 2013 return err 2014 } 2015 } 2016 if err := iprot.ReadStructEnd(ctx); err != nil { 2017 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2018 } 2019 return nil 2020 } 2021 2022 func (p *TimeUnit) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 2023 p.MILLIS = &MilliSeconds{} 2024 if err := p.MILLIS.Read(ctx, iprot); err != nil { 2025 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.MILLIS), err) 2026 } 2027 return nil 2028 } 2029 2030 func (p *TimeUnit) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 2031 p.MICROS = &MicroSeconds{} 2032 if err := p.MICROS.Read(ctx, iprot); err != nil { 2033 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.MICROS), err) 2034 } 2035 return nil 2036 } 2037 2038 func (p *TimeUnit) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 2039 p.NANOS = &NanoSeconds{} 2040 if err := p.NANOS.Read(ctx, iprot); err != nil { 2041 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.NANOS), err) 2042 } 2043 return nil 2044 } 2045 2046 func (p *TimeUnit) Write(ctx context.Context, oprot thrift.TProtocol) error { 2047 if c := p.CountSetFieldsTimeUnit(); c != 1 { 2048 return fmt.Errorf("%T write union: exactly one field must be set (%d set)", p, c) 2049 } 2050 if err := oprot.WriteStructBegin(ctx, "TimeUnit"); err != nil { 2051 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2052 } 2053 if p != nil { 2054 if err := p.writeField1(ctx, oprot); err != nil { 2055 return err 2056 } 2057 if err := p.writeField2(ctx, oprot); err != nil { 2058 return err 2059 } 2060 if err := p.writeField3(ctx, oprot); err != nil { 2061 return err 2062 } 2063 } 2064 if err := oprot.WriteFieldStop(ctx); err != nil { 2065 return thrift.PrependError("write field stop error: ", err) 2066 } 2067 if err := oprot.WriteStructEnd(ctx); err != nil { 2068 return thrift.PrependError("write struct stop error: ", err) 2069 } 2070 return nil 2071 } 2072 2073 func (p *TimeUnit) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 2074 if p.IsSetMILLIS() { 2075 if err := oprot.WriteFieldBegin(ctx, "MILLIS", thrift.STRUCT, 1); err != nil { 2076 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:MILLIS: ", p), err) 2077 } 2078 if err := p.MILLIS.Write(ctx, oprot); err != nil { 2079 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.MILLIS), err) 2080 } 2081 if err := oprot.WriteFieldEnd(ctx); err != nil { 2082 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:MILLIS: ", p), err) 2083 } 2084 } 2085 return err 2086 } 2087 2088 func (p *TimeUnit) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 2089 if p.IsSetMICROS() { 2090 if err := oprot.WriteFieldBegin(ctx, "MICROS", thrift.STRUCT, 2); err != nil { 2091 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:MICROS: ", p), err) 2092 } 2093 if err := p.MICROS.Write(ctx, oprot); err != nil { 2094 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.MICROS), err) 2095 } 2096 if err := oprot.WriteFieldEnd(ctx); err != nil { 2097 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:MICROS: ", p), err) 2098 } 2099 } 2100 return err 2101 } 2102 2103 func (p *TimeUnit) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 2104 if p.IsSetNANOS() { 2105 if err := oprot.WriteFieldBegin(ctx, "NANOS", thrift.STRUCT, 3); err != nil { 2106 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:NANOS: ", p), err) 2107 } 2108 if err := p.NANOS.Write(ctx, oprot); err != nil { 2109 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.NANOS), err) 2110 } 2111 if err := oprot.WriteFieldEnd(ctx); err != nil { 2112 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:NANOS: ", p), err) 2113 } 2114 } 2115 return err 2116 } 2117 2118 func (p *TimeUnit) Equals(other *TimeUnit) bool { 2119 if p == other { 2120 return true 2121 } else if p == nil || other == nil { 2122 return false 2123 } 2124 if !p.MILLIS.Equals(other.MILLIS) { 2125 return false 2126 } 2127 if !p.MICROS.Equals(other.MICROS) { 2128 return false 2129 } 2130 if !p.NANOS.Equals(other.NANOS) { 2131 return false 2132 } 2133 return true 2134 } 2135 2136 func (p *TimeUnit) String() string { 2137 if p == nil { 2138 return "<nil>" 2139 } 2140 return fmt.Sprintf("TimeUnit(%+v)", *p) 2141 } 2142 2143 // Timestamp logical type annotation 2144 // 2145 // Allowed for physical types: INT64 2146 // 2147 // Attributes: 2148 // - IsAdjustedToUTC 2149 // - Unit 2150 type TimestampType struct { 2151 IsAdjustedToUTC bool `thrift:"isAdjustedToUTC,1,required" db:"isAdjustedToUTC" json:"isAdjustedToUTC"` 2152 Unit *TimeUnit `thrift:"unit,2,required" db:"unit" json:"unit"` 2153 } 2154 2155 func NewTimestampType() *TimestampType { 2156 return &TimestampType{} 2157 } 2158 2159 func (p *TimestampType) GetIsAdjustedToUTC() bool { 2160 return p.IsAdjustedToUTC 2161 } 2162 2163 var TimestampType_Unit_DEFAULT *TimeUnit 2164 2165 func (p *TimestampType) GetUnit() *TimeUnit { 2166 if !p.IsSetUnit() { 2167 return TimestampType_Unit_DEFAULT 2168 } 2169 return p.Unit 2170 } 2171 func (p *TimestampType) IsSetUnit() bool { 2172 return p.Unit != nil 2173 } 2174 2175 func (p *TimestampType) Read(ctx context.Context, iprot thrift.TProtocol) error { 2176 if _, err := iprot.ReadStructBegin(ctx); err != nil { 2177 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2178 } 2179 2180 var issetIsAdjustedToUTC bool = false 2181 var issetUnit bool = false 2182 2183 for { 2184 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 2185 if err != nil { 2186 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2187 } 2188 if fieldTypeId == thrift.STOP { 2189 break 2190 } 2191 switch fieldId { 2192 case 1: 2193 if fieldTypeId == thrift.BOOL { 2194 if err := p.ReadField1(ctx, iprot); err != nil { 2195 return err 2196 } 2197 issetIsAdjustedToUTC = true 2198 } else { 2199 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2200 return err 2201 } 2202 } 2203 case 2: 2204 if fieldTypeId == thrift.STRUCT { 2205 if err := p.ReadField2(ctx, iprot); err != nil { 2206 return err 2207 } 2208 issetUnit = true 2209 } else { 2210 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2211 return err 2212 } 2213 } 2214 default: 2215 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2216 return err 2217 } 2218 } 2219 if err := iprot.ReadFieldEnd(ctx); err != nil { 2220 return err 2221 } 2222 } 2223 if err := iprot.ReadStructEnd(ctx); err != nil { 2224 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2225 } 2226 if !issetIsAdjustedToUTC { 2227 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsAdjustedToUTC is not set")) 2228 } 2229 if !issetUnit { 2230 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Unit is not set")) 2231 } 2232 return nil 2233 } 2234 2235 func (p *TimestampType) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 2236 if v, err := iprot.ReadBool(ctx); err != nil { 2237 return thrift.PrependError("error reading field 1: ", err) 2238 } else { 2239 p.IsAdjustedToUTC = v 2240 } 2241 return nil 2242 } 2243 2244 func (p *TimestampType) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 2245 p.Unit = &TimeUnit{} 2246 if err := p.Unit.Read(ctx, iprot); err != nil { 2247 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Unit), err) 2248 } 2249 return nil 2250 } 2251 2252 func (p *TimestampType) Write(ctx context.Context, oprot thrift.TProtocol) error { 2253 if err := oprot.WriteStructBegin(ctx, "TimestampType"); err != nil { 2254 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2255 } 2256 if p != nil { 2257 if err := p.writeField1(ctx, oprot); err != nil { 2258 return err 2259 } 2260 if err := p.writeField2(ctx, oprot); err != nil { 2261 return err 2262 } 2263 } 2264 if err := oprot.WriteFieldStop(ctx); err != nil { 2265 return thrift.PrependError("write field stop error: ", err) 2266 } 2267 if err := oprot.WriteStructEnd(ctx); err != nil { 2268 return thrift.PrependError("write struct stop error: ", err) 2269 } 2270 return nil 2271 } 2272 2273 func (p *TimestampType) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 2274 if err := oprot.WriteFieldBegin(ctx, "isAdjustedToUTC", thrift.BOOL, 1); err != nil { 2275 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:isAdjustedToUTC: ", p), err) 2276 } 2277 if err := oprot.WriteBool(ctx, bool(p.IsAdjustedToUTC)); err != nil { 2278 return thrift.PrependError(fmt.Sprintf("%T.isAdjustedToUTC (1) field write error: ", p), err) 2279 } 2280 if err := oprot.WriteFieldEnd(ctx); err != nil { 2281 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:isAdjustedToUTC: ", p), err) 2282 } 2283 return err 2284 } 2285 2286 func (p *TimestampType) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 2287 if err := oprot.WriteFieldBegin(ctx, "unit", thrift.STRUCT, 2); err != nil { 2288 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:unit: ", p), err) 2289 } 2290 if err := p.Unit.Write(ctx, oprot); err != nil { 2291 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Unit), err) 2292 } 2293 if err := oprot.WriteFieldEnd(ctx); err != nil { 2294 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:unit: ", p), err) 2295 } 2296 return err 2297 } 2298 2299 func (p *TimestampType) Equals(other *TimestampType) bool { 2300 if p == other { 2301 return true 2302 } else if p == nil || other == nil { 2303 return false 2304 } 2305 if p.IsAdjustedToUTC != other.IsAdjustedToUTC { 2306 return false 2307 } 2308 if !p.Unit.Equals(other.Unit) { 2309 return false 2310 } 2311 return true 2312 } 2313 2314 func (p *TimestampType) String() string { 2315 if p == nil { 2316 return "<nil>" 2317 } 2318 return fmt.Sprintf("TimestampType(%+v)", *p) 2319 } 2320 2321 // Time logical type annotation 2322 // 2323 // Allowed for physical types: INT32 (millis), INT64 (micros, nanos) 2324 // 2325 // Attributes: 2326 // - IsAdjustedToUTC 2327 // - Unit 2328 type TimeType struct { 2329 IsAdjustedToUTC bool `thrift:"isAdjustedToUTC,1,required" db:"isAdjustedToUTC" json:"isAdjustedToUTC"` 2330 Unit *TimeUnit `thrift:"unit,2,required" db:"unit" json:"unit"` 2331 } 2332 2333 func NewTimeType() *TimeType { 2334 return &TimeType{} 2335 } 2336 2337 func (p *TimeType) GetIsAdjustedToUTC() bool { 2338 return p.IsAdjustedToUTC 2339 } 2340 2341 var TimeType_Unit_DEFAULT *TimeUnit 2342 2343 func (p *TimeType) GetUnit() *TimeUnit { 2344 if !p.IsSetUnit() { 2345 return TimeType_Unit_DEFAULT 2346 } 2347 return p.Unit 2348 } 2349 func (p *TimeType) IsSetUnit() bool { 2350 return p.Unit != nil 2351 } 2352 2353 func (p *TimeType) Read(ctx context.Context, iprot thrift.TProtocol) error { 2354 if _, err := iprot.ReadStructBegin(ctx); err != nil { 2355 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2356 } 2357 2358 var issetIsAdjustedToUTC bool = false 2359 var issetUnit bool = false 2360 2361 for { 2362 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 2363 if err != nil { 2364 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2365 } 2366 if fieldTypeId == thrift.STOP { 2367 break 2368 } 2369 switch fieldId { 2370 case 1: 2371 if fieldTypeId == thrift.BOOL { 2372 if err := p.ReadField1(ctx, iprot); err != nil { 2373 return err 2374 } 2375 issetIsAdjustedToUTC = true 2376 } else { 2377 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2378 return err 2379 } 2380 } 2381 case 2: 2382 if fieldTypeId == thrift.STRUCT { 2383 if err := p.ReadField2(ctx, iprot); err != nil { 2384 return err 2385 } 2386 issetUnit = true 2387 } else { 2388 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2389 return err 2390 } 2391 } 2392 default: 2393 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2394 return err 2395 } 2396 } 2397 if err := iprot.ReadFieldEnd(ctx); err != nil { 2398 return err 2399 } 2400 } 2401 if err := iprot.ReadStructEnd(ctx); err != nil { 2402 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2403 } 2404 if !issetIsAdjustedToUTC { 2405 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsAdjustedToUTC is not set")) 2406 } 2407 if !issetUnit { 2408 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Unit is not set")) 2409 } 2410 return nil 2411 } 2412 2413 func (p *TimeType) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 2414 if v, err := iprot.ReadBool(ctx); err != nil { 2415 return thrift.PrependError("error reading field 1: ", err) 2416 } else { 2417 p.IsAdjustedToUTC = v 2418 } 2419 return nil 2420 } 2421 2422 func (p *TimeType) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 2423 p.Unit = &TimeUnit{} 2424 if err := p.Unit.Read(ctx, iprot); err != nil { 2425 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Unit), err) 2426 } 2427 return nil 2428 } 2429 2430 func (p *TimeType) Write(ctx context.Context, oprot thrift.TProtocol) error { 2431 if err := oprot.WriteStructBegin(ctx, "TimeType"); err != nil { 2432 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2433 } 2434 if p != nil { 2435 if err := p.writeField1(ctx, oprot); err != nil { 2436 return err 2437 } 2438 if err := p.writeField2(ctx, oprot); err != nil { 2439 return err 2440 } 2441 } 2442 if err := oprot.WriteFieldStop(ctx); err != nil { 2443 return thrift.PrependError("write field stop error: ", err) 2444 } 2445 if err := oprot.WriteStructEnd(ctx); err != nil { 2446 return thrift.PrependError("write struct stop error: ", err) 2447 } 2448 return nil 2449 } 2450 2451 func (p *TimeType) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 2452 if err := oprot.WriteFieldBegin(ctx, "isAdjustedToUTC", thrift.BOOL, 1); err != nil { 2453 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:isAdjustedToUTC: ", p), err) 2454 } 2455 if err := oprot.WriteBool(ctx, bool(p.IsAdjustedToUTC)); err != nil { 2456 return thrift.PrependError(fmt.Sprintf("%T.isAdjustedToUTC (1) field write error: ", p), err) 2457 } 2458 if err := oprot.WriteFieldEnd(ctx); err != nil { 2459 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:isAdjustedToUTC: ", p), err) 2460 } 2461 return err 2462 } 2463 2464 func (p *TimeType) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 2465 if err := oprot.WriteFieldBegin(ctx, "unit", thrift.STRUCT, 2); err != nil { 2466 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:unit: ", p), err) 2467 } 2468 if err := p.Unit.Write(ctx, oprot); err != nil { 2469 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Unit), err) 2470 } 2471 if err := oprot.WriteFieldEnd(ctx); err != nil { 2472 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:unit: ", p), err) 2473 } 2474 return err 2475 } 2476 2477 func (p *TimeType) Equals(other *TimeType) bool { 2478 if p == other { 2479 return true 2480 } else if p == nil || other == nil { 2481 return false 2482 } 2483 if p.IsAdjustedToUTC != other.IsAdjustedToUTC { 2484 return false 2485 } 2486 if !p.Unit.Equals(other.Unit) { 2487 return false 2488 } 2489 return true 2490 } 2491 2492 func (p *TimeType) String() string { 2493 if p == nil { 2494 return "<nil>" 2495 } 2496 return fmt.Sprintf("TimeType(%+v)", *p) 2497 } 2498 2499 // Integer logical type annotation 2500 // 2501 // bitWidth must be 8, 16, 32, or 64. 2502 // 2503 // Allowed for physical types: INT32, INT64 2504 // 2505 // Attributes: 2506 // - BitWidth 2507 // - IsSigned 2508 type IntType struct { 2509 BitWidth int8 `thrift:"bitWidth,1,required" db:"bitWidth" json:"bitWidth"` 2510 IsSigned bool `thrift:"isSigned,2,required" db:"isSigned" json:"isSigned"` 2511 } 2512 2513 func NewIntType() *IntType { 2514 return &IntType{} 2515 } 2516 2517 func (p *IntType) GetBitWidth() int8 { 2518 return p.BitWidth 2519 } 2520 2521 func (p *IntType) GetIsSigned() bool { 2522 return p.IsSigned 2523 } 2524 func (p *IntType) Read(ctx context.Context, iprot thrift.TProtocol) error { 2525 if _, err := iprot.ReadStructBegin(ctx); err != nil { 2526 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2527 } 2528 2529 var issetBitWidth bool = false 2530 var issetIsSigned bool = false 2531 2532 for { 2533 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 2534 if err != nil { 2535 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2536 } 2537 if fieldTypeId == thrift.STOP { 2538 break 2539 } 2540 switch fieldId { 2541 case 1: 2542 if fieldTypeId == thrift.BYTE { 2543 if err := p.ReadField1(ctx, iprot); err != nil { 2544 return err 2545 } 2546 issetBitWidth = true 2547 } else { 2548 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2549 return err 2550 } 2551 } 2552 case 2: 2553 if fieldTypeId == thrift.BOOL { 2554 if err := p.ReadField2(ctx, iprot); err != nil { 2555 return err 2556 } 2557 issetIsSigned = true 2558 } else { 2559 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2560 return err 2561 } 2562 } 2563 default: 2564 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2565 return err 2566 } 2567 } 2568 if err := iprot.ReadFieldEnd(ctx); err != nil { 2569 return err 2570 } 2571 } 2572 if err := iprot.ReadStructEnd(ctx); err != nil { 2573 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2574 } 2575 if !issetBitWidth { 2576 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field BitWidth is not set")) 2577 } 2578 if !issetIsSigned { 2579 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field IsSigned is not set")) 2580 } 2581 return nil 2582 } 2583 2584 func (p *IntType) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 2585 if v, err := iprot.ReadByte(ctx); err != nil { 2586 return thrift.PrependError("error reading field 1: ", err) 2587 } else { 2588 temp := int8(v) 2589 p.BitWidth = temp 2590 } 2591 return nil 2592 } 2593 2594 func (p *IntType) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 2595 if v, err := iprot.ReadBool(ctx); err != nil { 2596 return thrift.PrependError("error reading field 2: ", err) 2597 } else { 2598 p.IsSigned = v 2599 } 2600 return nil 2601 } 2602 2603 func (p *IntType) Write(ctx context.Context, oprot thrift.TProtocol) error { 2604 if err := oprot.WriteStructBegin(ctx, "IntType"); err != nil { 2605 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2606 } 2607 if p != nil { 2608 if err := p.writeField1(ctx, oprot); err != nil { 2609 return err 2610 } 2611 if err := p.writeField2(ctx, oprot); err != nil { 2612 return err 2613 } 2614 } 2615 if err := oprot.WriteFieldStop(ctx); err != nil { 2616 return thrift.PrependError("write field stop error: ", err) 2617 } 2618 if err := oprot.WriteStructEnd(ctx); err != nil { 2619 return thrift.PrependError("write struct stop error: ", err) 2620 } 2621 return nil 2622 } 2623 2624 func (p *IntType) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 2625 if err := oprot.WriteFieldBegin(ctx, "bitWidth", thrift.BYTE, 1); err != nil { 2626 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:bitWidth: ", p), err) 2627 } 2628 if err := oprot.WriteByte(ctx, int8(p.BitWidth)); err != nil { 2629 return thrift.PrependError(fmt.Sprintf("%T.bitWidth (1) field write error: ", p), err) 2630 } 2631 if err := oprot.WriteFieldEnd(ctx); err != nil { 2632 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:bitWidth: ", p), err) 2633 } 2634 return err 2635 } 2636 2637 func (p *IntType) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 2638 if err := oprot.WriteFieldBegin(ctx, "isSigned", thrift.BOOL, 2); err != nil { 2639 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:isSigned: ", p), err) 2640 } 2641 if err := oprot.WriteBool(ctx, bool(p.IsSigned)); err != nil { 2642 return thrift.PrependError(fmt.Sprintf("%T.isSigned (2) field write error: ", p), err) 2643 } 2644 if err := oprot.WriteFieldEnd(ctx); err != nil { 2645 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:isSigned: ", p), err) 2646 } 2647 return err 2648 } 2649 2650 func (p *IntType) Equals(other *IntType) bool { 2651 if p == other { 2652 return true 2653 } else if p == nil || other == nil { 2654 return false 2655 } 2656 if p.BitWidth != other.BitWidth { 2657 return false 2658 } 2659 if p.IsSigned != other.IsSigned { 2660 return false 2661 } 2662 return true 2663 } 2664 2665 func (p *IntType) String() string { 2666 if p == nil { 2667 return "<nil>" 2668 } 2669 return fmt.Sprintf("IntType(%+v)", *p) 2670 } 2671 2672 // Embedded JSON logical type annotation 2673 // 2674 // Allowed for physical types: BINARY 2675 type JsonType struct { 2676 } 2677 2678 func NewJsonType() *JsonType { 2679 return &JsonType{} 2680 } 2681 2682 func (p *JsonType) Read(ctx context.Context, iprot thrift.TProtocol) error { 2683 if _, err := iprot.ReadStructBegin(ctx); err != nil { 2684 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2685 } 2686 2687 for { 2688 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 2689 if err != nil { 2690 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2691 } 2692 if fieldTypeId == thrift.STOP { 2693 break 2694 } 2695 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2696 return err 2697 } 2698 if err := iprot.ReadFieldEnd(ctx); err != nil { 2699 return err 2700 } 2701 } 2702 if err := iprot.ReadStructEnd(ctx); err != nil { 2703 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2704 } 2705 return nil 2706 } 2707 2708 func (p *JsonType) Write(ctx context.Context, oprot thrift.TProtocol) error { 2709 if err := oprot.WriteStructBegin(ctx, "JsonType"); err != nil { 2710 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2711 } 2712 if p != nil { 2713 } 2714 if err := oprot.WriteFieldStop(ctx); err != nil { 2715 return thrift.PrependError("write field stop error: ", err) 2716 } 2717 if err := oprot.WriteStructEnd(ctx); err != nil { 2718 return thrift.PrependError("write struct stop error: ", err) 2719 } 2720 return nil 2721 } 2722 2723 func (p *JsonType) Equals(other *JsonType) bool { 2724 if p == other { 2725 return true 2726 } else if p == nil || other == nil { 2727 return false 2728 } 2729 return true 2730 } 2731 2732 func (p *JsonType) String() string { 2733 if p == nil { 2734 return "<nil>" 2735 } 2736 return fmt.Sprintf("JsonType(%+v)", *p) 2737 } 2738 2739 // Embedded BSON logical type annotation 2740 // 2741 // Allowed for physical types: BINARY 2742 type BsonType struct { 2743 } 2744 2745 func NewBsonType() *BsonType { 2746 return &BsonType{} 2747 } 2748 2749 func (p *BsonType) Read(ctx context.Context, iprot thrift.TProtocol) error { 2750 if _, err := iprot.ReadStructBegin(ctx); err != nil { 2751 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 2752 } 2753 2754 for { 2755 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 2756 if err != nil { 2757 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 2758 } 2759 if fieldTypeId == thrift.STOP { 2760 break 2761 } 2762 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 2763 return err 2764 } 2765 if err := iprot.ReadFieldEnd(ctx); err != nil { 2766 return err 2767 } 2768 } 2769 if err := iprot.ReadStructEnd(ctx); err != nil { 2770 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2771 } 2772 return nil 2773 } 2774 2775 func (p *BsonType) Write(ctx context.Context, oprot thrift.TProtocol) error { 2776 if err := oprot.WriteStructBegin(ctx, "BsonType"); err != nil { 2777 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2778 } 2779 if p != nil { 2780 } 2781 if err := oprot.WriteFieldStop(ctx); err != nil { 2782 return thrift.PrependError("write field stop error: ", err) 2783 } 2784 if err := oprot.WriteStructEnd(ctx); err != nil { 2785 return thrift.PrependError("write struct stop error: ", err) 2786 } 2787 return nil 2788 } 2789 2790 func (p *BsonType) Equals(other *BsonType) bool { 2791 if p == other { 2792 return true 2793 } else if p == nil || other == nil { 2794 return false 2795 } 2796 return true 2797 } 2798 2799 func (p *BsonType) String() string { 2800 if p == nil { 2801 return "<nil>" 2802 } 2803 return fmt.Sprintf("BsonType(%+v)", *p) 2804 } 2805 2806 // LogicalType annotations to replace ConvertedType. 2807 // 2808 // To maintain compatibility, implementations using LogicalType for a 2809 // SchemaElement must also set the corresponding ConvertedType (if any) 2810 // from the following table. 2811 // 2812 // Attributes: 2813 // - STRING 2814 // - MAP 2815 // - LIST 2816 // - ENUM 2817 // - DECIMAL 2818 // - DATE 2819 // - TIME 2820 // - TIMESTAMP 2821 // - INTEGER 2822 // - UNKNOWN 2823 // - JSON 2824 // - BSON 2825 // - UUID 2826 type LogicalType struct { 2827 STRING *StringType `thrift:"STRING,1" db:"STRING" json:"STRING,omitempty"` 2828 MAP *MapType `thrift:"MAP,2" db:"MAP" json:"MAP,omitempty"` 2829 LIST *ListType `thrift:"LIST,3" db:"LIST" json:"LIST,omitempty"` 2830 ENUM *EnumType `thrift:"ENUM,4" db:"ENUM" json:"ENUM,omitempty"` 2831 DECIMAL *DecimalType `thrift:"DECIMAL,5" db:"DECIMAL" json:"DECIMAL,omitempty"` 2832 DATE *DateType `thrift:"DATE,6" db:"DATE" json:"DATE,omitempty"` 2833 TIME *TimeType `thrift:"TIME,7" db:"TIME" json:"TIME,omitempty"` 2834 TIMESTAMP *TimestampType `thrift:"TIMESTAMP,8" db:"TIMESTAMP" json:"TIMESTAMP,omitempty"` 2835 // unused field # 9 2836 INTEGER *IntType `thrift:"INTEGER,10" db:"INTEGER" json:"INTEGER,omitempty"` 2837 UNKNOWN *NullType `thrift:"UNKNOWN,11" db:"UNKNOWN" json:"UNKNOWN,omitempty"` 2838 JSON *JsonType `thrift:"JSON,12" db:"JSON" json:"JSON,omitempty"` 2839 BSON *BsonType `thrift:"BSON,13" db:"BSON" json:"BSON,omitempty"` 2840 UUID *UUIDType `thrift:"UUID,14" db:"UUID" json:"UUID,omitempty"` 2841 } 2842 2843 func NewLogicalType() *LogicalType { 2844 return &LogicalType{} 2845 } 2846 2847 var LogicalType_STRING_DEFAULT *StringType 2848 2849 func (p *LogicalType) GetSTRING() *StringType { 2850 if !p.IsSetSTRING() { 2851 return LogicalType_STRING_DEFAULT 2852 } 2853 return p.STRING 2854 } 2855 2856 var LogicalType_MAP_DEFAULT *MapType 2857 2858 func (p *LogicalType) GetMAP() *MapType { 2859 if !p.IsSetMAP() { 2860 return LogicalType_MAP_DEFAULT 2861 } 2862 return p.MAP 2863 } 2864 2865 var LogicalType_LIST_DEFAULT *ListType 2866 2867 func (p *LogicalType) GetLIST() *ListType { 2868 if !p.IsSetLIST() { 2869 return LogicalType_LIST_DEFAULT 2870 } 2871 return p.LIST 2872 } 2873 2874 var LogicalType_ENUM_DEFAULT *EnumType 2875 2876 func (p *LogicalType) GetENUM() *EnumType { 2877 if !p.IsSetENUM() { 2878 return LogicalType_ENUM_DEFAULT 2879 } 2880 return p.ENUM 2881 } 2882 2883 var LogicalType_DECIMAL_DEFAULT *DecimalType 2884 2885 func (p *LogicalType) GetDECIMAL() *DecimalType { 2886 if !p.IsSetDECIMAL() { 2887 return LogicalType_DECIMAL_DEFAULT 2888 } 2889 return p.DECIMAL 2890 } 2891 2892 var LogicalType_DATE_DEFAULT *DateType 2893 2894 func (p *LogicalType) GetDATE() *DateType { 2895 if !p.IsSetDATE() { 2896 return LogicalType_DATE_DEFAULT 2897 } 2898 return p.DATE 2899 } 2900 2901 var LogicalType_TIME_DEFAULT *TimeType 2902 2903 func (p *LogicalType) GetTIME() *TimeType { 2904 if !p.IsSetTIME() { 2905 return LogicalType_TIME_DEFAULT 2906 } 2907 return p.TIME 2908 } 2909 2910 var LogicalType_TIMESTAMP_DEFAULT *TimestampType 2911 2912 func (p *LogicalType) GetTIMESTAMP() *TimestampType { 2913 if !p.IsSetTIMESTAMP() { 2914 return LogicalType_TIMESTAMP_DEFAULT 2915 } 2916 return p.TIMESTAMP 2917 } 2918 2919 var LogicalType_INTEGER_DEFAULT *IntType 2920 2921 func (p *LogicalType) GetINTEGER() *IntType { 2922 if !p.IsSetINTEGER() { 2923 return LogicalType_INTEGER_DEFAULT 2924 } 2925 return p.INTEGER 2926 } 2927 2928 var LogicalType_UNKNOWN_DEFAULT *NullType 2929 2930 func (p *LogicalType) GetUNKNOWN() *NullType { 2931 if !p.IsSetUNKNOWN() { 2932 return LogicalType_UNKNOWN_DEFAULT 2933 } 2934 return p.UNKNOWN 2935 } 2936 2937 var LogicalType_JSON_DEFAULT *JsonType 2938 2939 func (p *LogicalType) GetJSON() *JsonType { 2940 if !p.IsSetJSON() { 2941 return LogicalType_JSON_DEFAULT 2942 } 2943 return p.JSON 2944 } 2945 2946 var LogicalType_BSON_DEFAULT *BsonType 2947 2948 func (p *LogicalType) GetBSON() *BsonType { 2949 if !p.IsSetBSON() { 2950 return LogicalType_BSON_DEFAULT 2951 } 2952 return p.BSON 2953 } 2954 2955 var LogicalType_UUID_DEFAULT *UUIDType 2956 2957 func (p *LogicalType) GetUUID() *UUIDType { 2958 if !p.IsSetUUID() { 2959 return LogicalType_UUID_DEFAULT 2960 } 2961 return p.UUID 2962 } 2963 func (p *LogicalType) CountSetFieldsLogicalType() int { 2964 count := 0 2965 if p.IsSetSTRING() { 2966 count++ 2967 } 2968 if p.IsSetMAP() { 2969 count++ 2970 } 2971 if p.IsSetLIST() { 2972 count++ 2973 } 2974 if p.IsSetENUM() { 2975 count++ 2976 } 2977 if p.IsSetDECIMAL() { 2978 count++ 2979 } 2980 if p.IsSetDATE() { 2981 count++ 2982 } 2983 if p.IsSetTIME() { 2984 count++ 2985 } 2986 if p.IsSetTIMESTAMP() { 2987 count++ 2988 } 2989 if p.IsSetINTEGER() { 2990 count++ 2991 } 2992 if p.IsSetUNKNOWN() { 2993 count++ 2994 } 2995 if p.IsSetJSON() { 2996 count++ 2997 } 2998 if p.IsSetBSON() { 2999 count++ 3000 } 3001 if p.IsSetUUID() { 3002 count++ 3003 } 3004 return count 3005 3006 } 3007 3008 func (p *LogicalType) IsSetSTRING() bool { 3009 return p.STRING != nil 3010 } 3011 3012 func (p *LogicalType) IsSetMAP() bool { 3013 return p.MAP != nil 3014 } 3015 3016 func (p *LogicalType) IsSetLIST() bool { 3017 return p.LIST != nil 3018 } 3019 3020 func (p *LogicalType) IsSetENUM() bool { 3021 return p.ENUM != nil 3022 } 3023 3024 func (p *LogicalType) IsSetDECIMAL() bool { 3025 return p.DECIMAL != nil 3026 } 3027 3028 func (p *LogicalType) IsSetDATE() bool { 3029 return p.DATE != nil 3030 } 3031 3032 func (p *LogicalType) IsSetTIME() bool { 3033 return p.TIME != nil 3034 } 3035 3036 func (p *LogicalType) IsSetTIMESTAMP() bool { 3037 return p.TIMESTAMP != nil 3038 } 3039 3040 func (p *LogicalType) IsSetINTEGER() bool { 3041 return p.INTEGER != nil 3042 } 3043 3044 func (p *LogicalType) IsSetUNKNOWN() bool { 3045 return p.UNKNOWN != nil 3046 } 3047 3048 func (p *LogicalType) IsSetJSON() bool { 3049 return p.JSON != nil 3050 } 3051 3052 func (p *LogicalType) IsSetBSON() bool { 3053 return p.BSON != nil 3054 } 3055 3056 func (p *LogicalType) IsSetUUID() bool { 3057 return p.UUID != nil 3058 } 3059 3060 func (p *LogicalType) Read(ctx context.Context, iprot thrift.TProtocol) error { 3061 if _, err := iprot.ReadStructBegin(ctx); err != nil { 3062 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 3063 } 3064 3065 for { 3066 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 3067 if err != nil { 3068 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 3069 } 3070 if fieldTypeId == thrift.STOP { 3071 break 3072 } 3073 switch fieldId { 3074 case 1: 3075 if fieldTypeId == thrift.STRUCT { 3076 if err := p.ReadField1(ctx, iprot); err != nil { 3077 return err 3078 } 3079 } else { 3080 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3081 return err 3082 } 3083 } 3084 case 2: 3085 if fieldTypeId == thrift.STRUCT { 3086 if err := p.ReadField2(ctx, iprot); err != nil { 3087 return err 3088 } 3089 } else { 3090 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3091 return err 3092 } 3093 } 3094 case 3: 3095 if fieldTypeId == thrift.STRUCT { 3096 if err := p.ReadField3(ctx, iprot); err != nil { 3097 return err 3098 } 3099 } else { 3100 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3101 return err 3102 } 3103 } 3104 case 4: 3105 if fieldTypeId == thrift.STRUCT { 3106 if err := p.ReadField4(ctx, iprot); err != nil { 3107 return err 3108 } 3109 } else { 3110 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3111 return err 3112 } 3113 } 3114 case 5: 3115 if fieldTypeId == thrift.STRUCT { 3116 if err := p.ReadField5(ctx, iprot); err != nil { 3117 return err 3118 } 3119 } else { 3120 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3121 return err 3122 } 3123 } 3124 case 6: 3125 if fieldTypeId == thrift.STRUCT { 3126 if err := p.ReadField6(ctx, iprot); err != nil { 3127 return err 3128 } 3129 } else { 3130 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3131 return err 3132 } 3133 } 3134 case 7: 3135 if fieldTypeId == thrift.STRUCT { 3136 if err := p.ReadField7(ctx, iprot); err != nil { 3137 return err 3138 } 3139 } else { 3140 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3141 return err 3142 } 3143 } 3144 case 8: 3145 if fieldTypeId == thrift.STRUCT { 3146 if err := p.ReadField8(ctx, iprot); err != nil { 3147 return err 3148 } 3149 } else { 3150 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3151 return err 3152 } 3153 } 3154 case 10: 3155 if fieldTypeId == thrift.STRUCT { 3156 if err := p.ReadField10(ctx, iprot); err != nil { 3157 return err 3158 } 3159 } else { 3160 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3161 return err 3162 } 3163 } 3164 case 11: 3165 if fieldTypeId == thrift.STRUCT { 3166 if err := p.ReadField11(ctx, iprot); err != nil { 3167 return err 3168 } 3169 } else { 3170 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3171 return err 3172 } 3173 } 3174 case 12: 3175 if fieldTypeId == thrift.STRUCT { 3176 if err := p.ReadField12(ctx, iprot); err != nil { 3177 return err 3178 } 3179 } else { 3180 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3181 return err 3182 } 3183 } 3184 case 13: 3185 if fieldTypeId == thrift.STRUCT { 3186 if err := p.ReadField13(ctx, iprot); err != nil { 3187 return err 3188 } 3189 } else { 3190 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3191 return err 3192 } 3193 } 3194 case 14: 3195 if fieldTypeId == thrift.STRUCT { 3196 if err := p.ReadField14(ctx, iprot); err != nil { 3197 return err 3198 } 3199 } else { 3200 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3201 return err 3202 } 3203 } 3204 default: 3205 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3206 return err 3207 } 3208 } 3209 if err := iprot.ReadFieldEnd(ctx); err != nil { 3210 return err 3211 } 3212 } 3213 if err := iprot.ReadStructEnd(ctx); err != nil { 3214 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3215 } 3216 return nil 3217 } 3218 3219 func (p *LogicalType) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 3220 p.STRING = &StringType{} 3221 if err := p.STRING.Read(ctx, iprot); err != nil { 3222 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.STRING), err) 3223 } 3224 return nil 3225 } 3226 3227 func (p *LogicalType) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 3228 p.MAP = &MapType{} 3229 if err := p.MAP.Read(ctx, iprot); err != nil { 3230 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.MAP), err) 3231 } 3232 return nil 3233 } 3234 3235 func (p *LogicalType) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 3236 p.LIST = &ListType{} 3237 if err := p.LIST.Read(ctx, iprot); err != nil { 3238 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.LIST), err) 3239 } 3240 return nil 3241 } 3242 3243 func (p *LogicalType) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 3244 p.ENUM = &EnumType{} 3245 if err := p.ENUM.Read(ctx, iprot); err != nil { 3246 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ENUM), err) 3247 } 3248 return nil 3249 } 3250 3251 func (p *LogicalType) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 3252 p.DECIMAL = &DecimalType{} 3253 if err := p.DECIMAL.Read(ctx, iprot); err != nil { 3254 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DECIMAL), err) 3255 } 3256 return nil 3257 } 3258 3259 func (p *LogicalType) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 3260 p.DATE = &DateType{} 3261 if err := p.DATE.Read(ctx, iprot); err != nil { 3262 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DATE), err) 3263 } 3264 return nil 3265 } 3266 3267 func (p *LogicalType) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 3268 p.TIME = &TimeType{} 3269 if err := p.TIME.Read(ctx, iprot); err != nil { 3270 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TIME), err) 3271 } 3272 return nil 3273 } 3274 3275 func (p *LogicalType) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 3276 p.TIMESTAMP = &TimestampType{} 3277 if err := p.TIMESTAMP.Read(ctx, iprot); err != nil { 3278 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TIMESTAMP), err) 3279 } 3280 return nil 3281 } 3282 3283 func (p *LogicalType) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { 3284 p.INTEGER = &IntType{} 3285 if err := p.INTEGER.Read(ctx, iprot); err != nil { 3286 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.INTEGER), err) 3287 } 3288 return nil 3289 } 3290 3291 func (p *LogicalType) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { 3292 p.UNKNOWN = &NullType{} 3293 if err := p.UNKNOWN.Read(ctx, iprot); err != nil { 3294 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.UNKNOWN), err) 3295 } 3296 return nil 3297 } 3298 3299 func (p *LogicalType) ReadField12(ctx context.Context, iprot thrift.TProtocol) error { 3300 p.JSON = &JsonType{} 3301 if err := p.JSON.Read(ctx, iprot); err != nil { 3302 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.JSON), err) 3303 } 3304 return nil 3305 } 3306 3307 func (p *LogicalType) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { 3308 p.BSON = &BsonType{} 3309 if err := p.BSON.Read(ctx, iprot); err != nil { 3310 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.BSON), err) 3311 } 3312 return nil 3313 } 3314 3315 func (p *LogicalType) ReadField14(ctx context.Context, iprot thrift.TProtocol) error { 3316 p.UUID = &UUIDType{} 3317 if err := p.UUID.Read(ctx, iprot); err != nil { 3318 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.UUID), err) 3319 } 3320 return nil 3321 } 3322 3323 func (p *LogicalType) Write(ctx context.Context, oprot thrift.TProtocol) error { 3324 if c := p.CountSetFieldsLogicalType(); c != 1 { 3325 return fmt.Errorf("%T write union: exactly one field must be set (%d set)", p, c) 3326 } 3327 if err := oprot.WriteStructBegin(ctx, "LogicalType"); err != nil { 3328 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 3329 } 3330 if p != nil { 3331 if err := p.writeField1(ctx, oprot); err != nil { 3332 return err 3333 } 3334 if err := p.writeField2(ctx, oprot); err != nil { 3335 return err 3336 } 3337 if err := p.writeField3(ctx, oprot); err != nil { 3338 return err 3339 } 3340 if err := p.writeField4(ctx, oprot); err != nil { 3341 return err 3342 } 3343 if err := p.writeField5(ctx, oprot); err != nil { 3344 return err 3345 } 3346 if err := p.writeField6(ctx, oprot); err != nil { 3347 return err 3348 } 3349 if err := p.writeField7(ctx, oprot); err != nil { 3350 return err 3351 } 3352 if err := p.writeField8(ctx, oprot); err != nil { 3353 return err 3354 } 3355 if err := p.writeField10(ctx, oprot); err != nil { 3356 return err 3357 } 3358 if err := p.writeField11(ctx, oprot); err != nil { 3359 return err 3360 } 3361 if err := p.writeField12(ctx, oprot); err != nil { 3362 return err 3363 } 3364 if err := p.writeField13(ctx, oprot); err != nil { 3365 return err 3366 } 3367 if err := p.writeField14(ctx, oprot); err != nil { 3368 return err 3369 } 3370 } 3371 if err := oprot.WriteFieldStop(ctx); err != nil { 3372 return thrift.PrependError("write field stop error: ", err) 3373 } 3374 if err := oprot.WriteStructEnd(ctx); err != nil { 3375 return thrift.PrependError("write struct stop error: ", err) 3376 } 3377 return nil 3378 } 3379 3380 func (p *LogicalType) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 3381 if p.IsSetSTRING() { 3382 if err := oprot.WriteFieldBegin(ctx, "STRING", thrift.STRUCT, 1); err != nil { 3383 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:STRING: ", p), err) 3384 } 3385 if err := p.STRING.Write(ctx, oprot); err != nil { 3386 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.STRING), err) 3387 } 3388 if err := oprot.WriteFieldEnd(ctx); err != nil { 3389 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:STRING: ", p), err) 3390 } 3391 } 3392 return err 3393 } 3394 3395 func (p *LogicalType) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 3396 if p.IsSetMAP() { 3397 if err := oprot.WriteFieldBegin(ctx, "MAP", thrift.STRUCT, 2); err != nil { 3398 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:MAP: ", p), err) 3399 } 3400 if err := p.MAP.Write(ctx, oprot); err != nil { 3401 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.MAP), err) 3402 } 3403 if err := oprot.WriteFieldEnd(ctx); err != nil { 3404 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:MAP: ", p), err) 3405 } 3406 } 3407 return err 3408 } 3409 3410 func (p *LogicalType) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 3411 if p.IsSetLIST() { 3412 if err := oprot.WriteFieldBegin(ctx, "LIST", thrift.STRUCT, 3); err != nil { 3413 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:LIST: ", p), err) 3414 } 3415 if err := p.LIST.Write(ctx, oprot); err != nil { 3416 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.LIST), err) 3417 } 3418 if err := oprot.WriteFieldEnd(ctx); err != nil { 3419 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:LIST: ", p), err) 3420 } 3421 } 3422 return err 3423 } 3424 3425 func (p *LogicalType) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 3426 if p.IsSetENUM() { 3427 if err := oprot.WriteFieldBegin(ctx, "ENUM", thrift.STRUCT, 4); err != nil { 3428 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:ENUM: ", p), err) 3429 } 3430 if err := p.ENUM.Write(ctx, oprot); err != nil { 3431 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ENUM), err) 3432 } 3433 if err := oprot.WriteFieldEnd(ctx); err != nil { 3434 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:ENUM: ", p), err) 3435 } 3436 } 3437 return err 3438 } 3439 3440 func (p *LogicalType) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 3441 if p.IsSetDECIMAL() { 3442 if err := oprot.WriteFieldBegin(ctx, "DECIMAL", thrift.STRUCT, 5); err != nil { 3443 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:DECIMAL: ", p), err) 3444 } 3445 if err := p.DECIMAL.Write(ctx, oprot); err != nil { 3446 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DECIMAL), err) 3447 } 3448 if err := oprot.WriteFieldEnd(ctx); err != nil { 3449 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:DECIMAL: ", p), err) 3450 } 3451 } 3452 return err 3453 } 3454 3455 func (p *LogicalType) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 3456 if p.IsSetDATE() { 3457 if err := oprot.WriteFieldBegin(ctx, "DATE", thrift.STRUCT, 6); err != nil { 3458 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:DATE: ", p), err) 3459 } 3460 if err := p.DATE.Write(ctx, oprot); err != nil { 3461 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DATE), err) 3462 } 3463 if err := oprot.WriteFieldEnd(ctx); err != nil { 3464 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:DATE: ", p), err) 3465 } 3466 } 3467 return err 3468 } 3469 3470 func (p *LogicalType) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 3471 if p.IsSetTIME() { 3472 if err := oprot.WriteFieldBegin(ctx, "TIME", thrift.STRUCT, 7); err != nil { 3473 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:TIME: ", p), err) 3474 } 3475 if err := p.TIME.Write(ctx, oprot); err != nil { 3476 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TIME), err) 3477 } 3478 if err := oprot.WriteFieldEnd(ctx); err != nil { 3479 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:TIME: ", p), err) 3480 } 3481 } 3482 return err 3483 } 3484 3485 func (p *LogicalType) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 3486 if p.IsSetTIMESTAMP() { 3487 if err := oprot.WriteFieldBegin(ctx, "TIMESTAMP", thrift.STRUCT, 8); err != nil { 3488 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:TIMESTAMP: ", p), err) 3489 } 3490 if err := p.TIMESTAMP.Write(ctx, oprot); err != nil { 3491 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TIMESTAMP), err) 3492 } 3493 if err := oprot.WriteFieldEnd(ctx); err != nil { 3494 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:TIMESTAMP: ", p), err) 3495 } 3496 } 3497 return err 3498 } 3499 3500 func (p *LogicalType) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { 3501 if p.IsSetINTEGER() { 3502 if err := oprot.WriteFieldBegin(ctx, "INTEGER", thrift.STRUCT, 10); err != nil { 3503 return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:INTEGER: ", p), err) 3504 } 3505 if err := p.INTEGER.Write(ctx, oprot); err != nil { 3506 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.INTEGER), err) 3507 } 3508 if err := oprot.WriteFieldEnd(ctx); err != nil { 3509 return thrift.PrependError(fmt.Sprintf("%T write field end error 10:INTEGER: ", p), err) 3510 } 3511 } 3512 return err 3513 } 3514 3515 func (p *LogicalType) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { 3516 if p.IsSetUNKNOWN() { 3517 if err := oprot.WriteFieldBegin(ctx, "UNKNOWN", thrift.STRUCT, 11); err != nil { 3518 return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:UNKNOWN: ", p), err) 3519 } 3520 if err := p.UNKNOWN.Write(ctx, oprot); err != nil { 3521 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.UNKNOWN), err) 3522 } 3523 if err := oprot.WriteFieldEnd(ctx); err != nil { 3524 return thrift.PrependError(fmt.Sprintf("%T write field end error 11:UNKNOWN: ", p), err) 3525 } 3526 } 3527 return err 3528 } 3529 3530 func (p *LogicalType) writeField12(ctx context.Context, oprot thrift.TProtocol) (err error) { 3531 if p.IsSetJSON() { 3532 if err := oprot.WriteFieldBegin(ctx, "JSON", thrift.STRUCT, 12); err != nil { 3533 return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:JSON: ", p), err) 3534 } 3535 if err := p.JSON.Write(ctx, oprot); err != nil { 3536 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.JSON), err) 3537 } 3538 if err := oprot.WriteFieldEnd(ctx); err != nil { 3539 return thrift.PrependError(fmt.Sprintf("%T write field end error 12:JSON: ", p), err) 3540 } 3541 } 3542 return err 3543 } 3544 3545 func (p *LogicalType) writeField13(ctx context.Context, oprot thrift.TProtocol) (err error) { 3546 if p.IsSetBSON() { 3547 if err := oprot.WriteFieldBegin(ctx, "BSON", thrift.STRUCT, 13); err != nil { 3548 return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:BSON: ", p), err) 3549 } 3550 if err := p.BSON.Write(ctx, oprot); err != nil { 3551 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.BSON), err) 3552 } 3553 if err := oprot.WriteFieldEnd(ctx); err != nil { 3554 return thrift.PrependError(fmt.Sprintf("%T write field end error 13:BSON: ", p), err) 3555 } 3556 } 3557 return err 3558 } 3559 3560 func (p *LogicalType) writeField14(ctx context.Context, oprot thrift.TProtocol) (err error) { 3561 if p.IsSetUUID() { 3562 if err := oprot.WriteFieldBegin(ctx, "UUID", thrift.STRUCT, 14); err != nil { 3563 return thrift.PrependError(fmt.Sprintf("%T write field begin error 14:UUID: ", p), err) 3564 } 3565 if err := p.UUID.Write(ctx, oprot); err != nil { 3566 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.UUID), err) 3567 } 3568 if err := oprot.WriteFieldEnd(ctx); err != nil { 3569 return thrift.PrependError(fmt.Sprintf("%T write field end error 14:UUID: ", p), err) 3570 } 3571 } 3572 return err 3573 } 3574 3575 func (p *LogicalType) Equals(other *LogicalType) bool { 3576 if p == other { 3577 return true 3578 } else if p == nil || other == nil { 3579 return false 3580 } 3581 if !p.STRING.Equals(other.STRING) { 3582 return false 3583 } 3584 if !p.MAP.Equals(other.MAP) { 3585 return false 3586 } 3587 if !p.LIST.Equals(other.LIST) { 3588 return false 3589 } 3590 if !p.ENUM.Equals(other.ENUM) { 3591 return false 3592 } 3593 if !p.DECIMAL.Equals(other.DECIMAL) { 3594 return false 3595 } 3596 if !p.DATE.Equals(other.DATE) { 3597 return false 3598 } 3599 if !p.TIME.Equals(other.TIME) { 3600 return false 3601 } 3602 if !p.TIMESTAMP.Equals(other.TIMESTAMP) { 3603 return false 3604 } 3605 if !p.INTEGER.Equals(other.INTEGER) { 3606 return false 3607 } 3608 if !p.UNKNOWN.Equals(other.UNKNOWN) { 3609 return false 3610 } 3611 if !p.JSON.Equals(other.JSON) { 3612 return false 3613 } 3614 if !p.BSON.Equals(other.BSON) { 3615 return false 3616 } 3617 if !p.UUID.Equals(other.UUID) { 3618 return false 3619 } 3620 return true 3621 } 3622 3623 func (p *LogicalType) String() string { 3624 if p == nil { 3625 return "<nil>" 3626 } 3627 return fmt.Sprintf("LogicalType(%+v)", *p) 3628 } 3629 3630 // Represents a element inside a schema definition. 3631 // - if it is a group (inner node) then type is undefined and num_children is defined 3632 // - if it is a primitive type (leaf) then type is defined and num_children is undefined 3633 // the nodes are listed in depth first traversal order. 3634 // 3635 // Attributes: 3636 // - Type: Data type for this field. Not set if the current element is a non-leaf node 3637 // - TypeLength: If type is FIXED_LEN_BYTE_ARRAY, this is the byte length of the vales. 3638 // Otherwise, if specified, this is the maximum bit length to store any of the values. 3639 // (e.g. a low cardinality INT col could have this set to 3). Note that this is 3640 // in the schema, and therefore fixed for the entire file. 3641 // - RepetitionType: repetition of the field. The root of the schema does not have a repetition_type. 3642 // All other nodes must have one 3643 // - Name: Name of the field in the schema 3644 // - NumChildren: Nested fields. Since thrift does not support nested fields, 3645 // the nesting is flattened to a single list by a depth-first traversal. 3646 // The children count is used to construct the nested relationship. 3647 // This field is not set when the element is a primitive type 3648 // - ConvertedType: DEPRECATED: When the schema is the result of a conversion from another model. 3649 // Used to record the original type to help with cross conversion. 3650 // 3651 // This is superseded by logicalType. 3652 // - Scale: DEPRECATED: Used when this column contains decimal data. 3653 // See the DECIMAL converted type for more details. 3654 // 3655 // This is superseded by using the DecimalType annotation in logicalType. 3656 // - Precision 3657 // - FieldID: When the original schema supports field ids, this will save the 3658 // original field id in the parquet schema 3659 // - LogicalType: The logical type of this SchemaElement 3660 // 3661 // LogicalType replaces ConvertedType, but ConvertedType is still required 3662 // for some logical types to ensure forward-compatibility in format v1. 3663 type SchemaElement struct { 3664 Type *Type `thrift:"type,1" db:"type" json:"type,omitempty"` 3665 TypeLength *int32 `thrift:"type_length,2" db:"type_length" json:"type_length,omitempty"` 3666 RepetitionType *FieldRepetitionType `thrift:"repetition_type,3" db:"repetition_type" json:"repetition_type,omitempty"` 3667 Name string `thrift:"name,4,required" db:"name" json:"name"` 3668 NumChildren *int32 `thrift:"num_children,5" db:"num_children" json:"num_children,omitempty"` 3669 ConvertedType *ConvertedType `thrift:"converted_type,6" db:"converted_type" json:"converted_type,omitempty"` 3670 Scale *int32 `thrift:"scale,7" db:"scale" json:"scale,omitempty"` 3671 Precision *int32 `thrift:"precision,8" db:"precision" json:"precision,omitempty"` 3672 FieldID *int32 `thrift:"field_id,9" db:"field_id" json:"field_id,omitempty"` 3673 LogicalType *LogicalType `thrift:"logicalType,10" db:"logicalType" json:"logicalType,omitempty"` 3674 } 3675 3676 func NewSchemaElement() *SchemaElement { 3677 return &SchemaElement{} 3678 } 3679 3680 var SchemaElement_Type_DEFAULT Type 3681 3682 func (p *SchemaElement) GetType() Type { 3683 if !p.IsSetType() { 3684 return SchemaElement_Type_DEFAULT 3685 } 3686 return *p.Type 3687 } 3688 3689 var SchemaElement_TypeLength_DEFAULT int32 3690 3691 func (p *SchemaElement) GetTypeLength() int32 { 3692 if !p.IsSetTypeLength() { 3693 return SchemaElement_TypeLength_DEFAULT 3694 } 3695 return *p.TypeLength 3696 } 3697 3698 var SchemaElement_RepetitionType_DEFAULT FieldRepetitionType 3699 3700 func (p *SchemaElement) GetRepetitionType() FieldRepetitionType { 3701 if !p.IsSetRepetitionType() { 3702 return SchemaElement_RepetitionType_DEFAULT 3703 } 3704 return *p.RepetitionType 3705 } 3706 3707 func (p *SchemaElement) GetName() string { 3708 return p.Name 3709 } 3710 3711 var SchemaElement_NumChildren_DEFAULT int32 3712 3713 func (p *SchemaElement) GetNumChildren() int32 { 3714 if !p.IsSetNumChildren() { 3715 return SchemaElement_NumChildren_DEFAULT 3716 } 3717 return *p.NumChildren 3718 } 3719 3720 var SchemaElement_ConvertedType_DEFAULT ConvertedType 3721 3722 func (p *SchemaElement) GetConvertedType() ConvertedType { 3723 if !p.IsSetConvertedType() { 3724 return SchemaElement_ConvertedType_DEFAULT 3725 } 3726 return *p.ConvertedType 3727 } 3728 3729 var SchemaElement_Scale_DEFAULT int32 3730 3731 func (p *SchemaElement) GetScale() int32 { 3732 if !p.IsSetScale() { 3733 return SchemaElement_Scale_DEFAULT 3734 } 3735 return *p.Scale 3736 } 3737 3738 var SchemaElement_Precision_DEFAULT int32 3739 3740 func (p *SchemaElement) GetPrecision() int32 { 3741 if !p.IsSetPrecision() { 3742 return SchemaElement_Precision_DEFAULT 3743 } 3744 return *p.Precision 3745 } 3746 3747 var SchemaElement_FieldID_DEFAULT int32 3748 3749 func (p *SchemaElement) GetFieldID() int32 { 3750 if !p.IsSetFieldID() { 3751 return SchemaElement_FieldID_DEFAULT 3752 } 3753 return *p.FieldID 3754 } 3755 3756 var SchemaElement_LogicalType_DEFAULT *LogicalType 3757 3758 func (p *SchemaElement) GetLogicalType() *LogicalType { 3759 if !p.IsSetLogicalType() { 3760 return SchemaElement_LogicalType_DEFAULT 3761 } 3762 return p.LogicalType 3763 } 3764 func (p *SchemaElement) IsSetType() bool { 3765 return p.Type != nil 3766 } 3767 3768 func (p *SchemaElement) IsSetTypeLength() bool { 3769 return p.TypeLength != nil 3770 } 3771 3772 func (p *SchemaElement) IsSetRepetitionType() bool { 3773 return p.RepetitionType != nil 3774 } 3775 3776 func (p *SchemaElement) IsSetNumChildren() bool { 3777 return p.NumChildren != nil 3778 } 3779 3780 func (p *SchemaElement) IsSetConvertedType() bool { 3781 return p.ConvertedType != nil 3782 } 3783 3784 func (p *SchemaElement) IsSetScale() bool { 3785 return p.Scale != nil 3786 } 3787 3788 func (p *SchemaElement) IsSetPrecision() bool { 3789 return p.Precision != nil 3790 } 3791 3792 func (p *SchemaElement) IsSetFieldID() bool { 3793 return p.FieldID != nil 3794 } 3795 3796 func (p *SchemaElement) IsSetLogicalType() bool { 3797 return p.LogicalType != nil 3798 } 3799 3800 func (p *SchemaElement) Read(ctx context.Context, iprot thrift.TProtocol) error { 3801 if _, err := iprot.ReadStructBegin(ctx); err != nil { 3802 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 3803 } 3804 3805 var issetName bool = false 3806 3807 for { 3808 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 3809 if err != nil { 3810 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 3811 } 3812 if fieldTypeId == thrift.STOP { 3813 break 3814 } 3815 switch fieldId { 3816 case 1: 3817 if fieldTypeId == thrift.I32 { 3818 if err := p.ReadField1(ctx, iprot); err != nil { 3819 return err 3820 } 3821 } else { 3822 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3823 return err 3824 } 3825 } 3826 case 2: 3827 if fieldTypeId == thrift.I32 { 3828 if err := p.ReadField2(ctx, iprot); err != nil { 3829 return err 3830 } 3831 } else { 3832 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3833 return err 3834 } 3835 } 3836 case 3: 3837 if fieldTypeId == thrift.I32 { 3838 if err := p.ReadField3(ctx, iprot); err != nil { 3839 return err 3840 } 3841 } else { 3842 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3843 return err 3844 } 3845 } 3846 case 4: 3847 if fieldTypeId == thrift.STRING { 3848 if err := p.ReadField4(ctx, iprot); err != nil { 3849 return err 3850 } 3851 issetName = true 3852 } else { 3853 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3854 return err 3855 } 3856 } 3857 case 5: 3858 if fieldTypeId == thrift.I32 { 3859 if err := p.ReadField5(ctx, iprot); err != nil { 3860 return err 3861 } 3862 } else { 3863 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3864 return err 3865 } 3866 } 3867 case 6: 3868 if fieldTypeId == thrift.I32 { 3869 if err := p.ReadField6(ctx, iprot); err != nil { 3870 return err 3871 } 3872 } else { 3873 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3874 return err 3875 } 3876 } 3877 case 7: 3878 if fieldTypeId == thrift.I32 { 3879 if err := p.ReadField7(ctx, iprot); err != nil { 3880 return err 3881 } 3882 } else { 3883 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3884 return err 3885 } 3886 } 3887 case 8: 3888 if fieldTypeId == thrift.I32 { 3889 if err := p.ReadField8(ctx, iprot); err != nil { 3890 return err 3891 } 3892 } else { 3893 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3894 return err 3895 } 3896 } 3897 case 9: 3898 if fieldTypeId == thrift.I32 { 3899 if err := p.ReadField9(ctx, iprot); err != nil { 3900 return err 3901 } 3902 } else { 3903 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3904 return err 3905 } 3906 } 3907 case 10: 3908 if fieldTypeId == thrift.STRUCT { 3909 if err := p.ReadField10(ctx, iprot); err != nil { 3910 return err 3911 } 3912 } else { 3913 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3914 return err 3915 } 3916 } 3917 default: 3918 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 3919 return err 3920 } 3921 } 3922 if err := iprot.ReadFieldEnd(ctx); err != nil { 3923 return err 3924 } 3925 } 3926 if err := iprot.ReadStructEnd(ctx); err != nil { 3927 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3928 } 3929 if !issetName { 3930 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Name is not set")) 3931 } 3932 return nil 3933 } 3934 3935 func (p *SchemaElement) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 3936 if v, err := iprot.ReadI32(ctx); err != nil { 3937 return thrift.PrependError("error reading field 1: ", err) 3938 } else { 3939 temp := Type(v) 3940 p.Type = &temp 3941 } 3942 return nil 3943 } 3944 3945 func (p *SchemaElement) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 3946 if v, err := iprot.ReadI32(ctx); err != nil { 3947 return thrift.PrependError("error reading field 2: ", err) 3948 } else { 3949 p.TypeLength = &v 3950 } 3951 return nil 3952 } 3953 3954 func (p *SchemaElement) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 3955 if v, err := iprot.ReadI32(ctx); err != nil { 3956 return thrift.PrependError("error reading field 3: ", err) 3957 } else { 3958 temp := FieldRepetitionType(v) 3959 p.RepetitionType = &temp 3960 } 3961 return nil 3962 } 3963 3964 func (p *SchemaElement) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 3965 if v, err := iprot.ReadString(ctx); err != nil { 3966 return thrift.PrependError("error reading field 4: ", err) 3967 } else { 3968 p.Name = v 3969 } 3970 return nil 3971 } 3972 3973 func (p *SchemaElement) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 3974 if v, err := iprot.ReadI32(ctx); err != nil { 3975 return thrift.PrependError("error reading field 5: ", err) 3976 } else { 3977 p.NumChildren = &v 3978 } 3979 return nil 3980 } 3981 3982 func (p *SchemaElement) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 3983 if v, err := iprot.ReadI32(ctx); err != nil { 3984 return thrift.PrependError("error reading field 6: ", err) 3985 } else { 3986 temp := ConvertedType(v) 3987 p.ConvertedType = &temp 3988 } 3989 return nil 3990 } 3991 3992 func (p *SchemaElement) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 3993 if v, err := iprot.ReadI32(ctx); err != nil { 3994 return thrift.PrependError("error reading field 7: ", err) 3995 } else { 3996 p.Scale = &v 3997 } 3998 return nil 3999 } 4000 4001 func (p *SchemaElement) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 4002 if v, err := iprot.ReadI32(ctx); err != nil { 4003 return thrift.PrependError("error reading field 8: ", err) 4004 } else { 4005 p.Precision = &v 4006 } 4007 return nil 4008 } 4009 4010 func (p *SchemaElement) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { 4011 if v, err := iprot.ReadI32(ctx); err != nil { 4012 return thrift.PrependError("error reading field 9: ", err) 4013 } else { 4014 p.FieldID = &v 4015 } 4016 return nil 4017 } 4018 4019 func (p *SchemaElement) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { 4020 p.LogicalType = &LogicalType{} 4021 if err := p.LogicalType.Read(ctx, iprot); err != nil { 4022 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.LogicalType), err) 4023 } 4024 return nil 4025 } 4026 4027 func (p *SchemaElement) Write(ctx context.Context, oprot thrift.TProtocol) error { 4028 if err := oprot.WriteStructBegin(ctx, "SchemaElement"); err != nil { 4029 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4030 } 4031 if p != nil { 4032 if err := p.writeField1(ctx, oprot); err != nil { 4033 return err 4034 } 4035 if err := p.writeField2(ctx, oprot); err != nil { 4036 return err 4037 } 4038 if err := p.writeField3(ctx, oprot); err != nil { 4039 return err 4040 } 4041 if err := p.writeField4(ctx, oprot); err != nil { 4042 return err 4043 } 4044 if err := p.writeField5(ctx, oprot); err != nil { 4045 return err 4046 } 4047 if err := p.writeField6(ctx, oprot); err != nil { 4048 return err 4049 } 4050 if err := p.writeField7(ctx, oprot); err != nil { 4051 return err 4052 } 4053 if err := p.writeField8(ctx, oprot); err != nil { 4054 return err 4055 } 4056 if err := p.writeField9(ctx, oprot); err != nil { 4057 return err 4058 } 4059 if err := p.writeField10(ctx, oprot); err != nil { 4060 return err 4061 } 4062 } 4063 if err := oprot.WriteFieldStop(ctx); err != nil { 4064 return thrift.PrependError("write field stop error: ", err) 4065 } 4066 if err := oprot.WriteStructEnd(ctx); err != nil { 4067 return thrift.PrependError("write struct stop error: ", err) 4068 } 4069 return nil 4070 } 4071 4072 func (p *SchemaElement) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 4073 if p.IsSetType() { 4074 if err := oprot.WriteFieldBegin(ctx, "type", thrift.I32, 1); err != nil { 4075 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:type: ", p), err) 4076 } 4077 if err := oprot.WriteI32(ctx, int32(*p.Type)); err != nil { 4078 return thrift.PrependError(fmt.Sprintf("%T.type (1) field write error: ", p), err) 4079 } 4080 if err := oprot.WriteFieldEnd(ctx); err != nil { 4081 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:type: ", p), err) 4082 } 4083 } 4084 return err 4085 } 4086 4087 func (p *SchemaElement) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 4088 if p.IsSetTypeLength() { 4089 if err := oprot.WriteFieldBegin(ctx, "type_length", thrift.I32, 2); err != nil { 4090 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:type_length: ", p), err) 4091 } 4092 if err := oprot.WriteI32(ctx, int32(*p.TypeLength)); err != nil { 4093 return thrift.PrependError(fmt.Sprintf("%T.type_length (2) field write error: ", p), err) 4094 } 4095 if err := oprot.WriteFieldEnd(ctx); err != nil { 4096 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:type_length: ", p), err) 4097 } 4098 } 4099 return err 4100 } 4101 4102 func (p *SchemaElement) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 4103 if p.IsSetRepetitionType() { 4104 if err := oprot.WriteFieldBegin(ctx, "repetition_type", thrift.I32, 3); err != nil { 4105 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:repetition_type: ", p), err) 4106 } 4107 if err := oprot.WriteI32(ctx, int32(*p.RepetitionType)); err != nil { 4108 return thrift.PrependError(fmt.Sprintf("%T.repetition_type (3) field write error: ", p), err) 4109 } 4110 if err := oprot.WriteFieldEnd(ctx); err != nil { 4111 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:repetition_type: ", p), err) 4112 } 4113 } 4114 return err 4115 } 4116 4117 func (p *SchemaElement) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 4118 if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 4); err != nil { 4119 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:name: ", p), err) 4120 } 4121 if err := oprot.WriteString(ctx, string(p.Name)); err != nil { 4122 return thrift.PrependError(fmt.Sprintf("%T.name (4) field write error: ", p), err) 4123 } 4124 if err := oprot.WriteFieldEnd(ctx); err != nil { 4125 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:name: ", p), err) 4126 } 4127 return err 4128 } 4129 4130 func (p *SchemaElement) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 4131 if p.IsSetNumChildren() { 4132 if err := oprot.WriteFieldBegin(ctx, "num_children", thrift.I32, 5); err != nil { 4133 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:num_children: ", p), err) 4134 } 4135 if err := oprot.WriteI32(ctx, int32(*p.NumChildren)); err != nil { 4136 return thrift.PrependError(fmt.Sprintf("%T.num_children (5) field write error: ", p), err) 4137 } 4138 if err := oprot.WriteFieldEnd(ctx); err != nil { 4139 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:num_children: ", p), err) 4140 } 4141 } 4142 return err 4143 } 4144 4145 func (p *SchemaElement) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 4146 if p.IsSetConvertedType() { 4147 if err := oprot.WriteFieldBegin(ctx, "converted_type", thrift.I32, 6); err != nil { 4148 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:converted_type: ", p), err) 4149 } 4150 if err := oprot.WriteI32(ctx, int32(*p.ConvertedType)); err != nil { 4151 return thrift.PrependError(fmt.Sprintf("%T.converted_type (6) field write error: ", p), err) 4152 } 4153 if err := oprot.WriteFieldEnd(ctx); err != nil { 4154 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:converted_type: ", p), err) 4155 } 4156 } 4157 return err 4158 } 4159 4160 func (p *SchemaElement) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 4161 if p.IsSetScale() { 4162 if err := oprot.WriteFieldBegin(ctx, "scale", thrift.I32, 7); err != nil { 4163 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:scale: ", p), err) 4164 } 4165 if err := oprot.WriteI32(ctx, int32(*p.Scale)); err != nil { 4166 return thrift.PrependError(fmt.Sprintf("%T.scale (7) field write error: ", p), err) 4167 } 4168 if err := oprot.WriteFieldEnd(ctx); err != nil { 4169 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:scale: ", p), err) 4170 } 4171 } 4172 return err 4173 } 4174 4175 func (p *SchemaElement) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 4176 if p.IsSetPrecision() { 4177 if err := oprot.WriteFieldBegin(ctx, "precision", thrift.I32, 8); err != nil { 4178 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:precision: ", p), err) 4179 } 4180 if err := oprot.WriteI32(ctx, int32(*p.Precision)); err != nil { 4181 return thrift.PrependError(fmt.Sprintf("%T.precision (8) field write error: ", p), err) 4182 } 4183 if err := oprot.WriteFieldEnd(ctx); err != nil { 4184 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:precision: ", p), err) 4185 } 4186 } 4187 return err 4188 } 4189 4190 func (p *SchemaElement) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { 4191 if p.IsSetFieldID() { 4192 if err := oprot.WriteFieldBegin(ctx, "field_id", thrift.I32, 9); err != nil { 4193 return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:field_id: ", p), err) 4194 } 4195 if err := oprot.WriteI32(ctx, int32(*p.FieldID)); err != nil { 4196 return thrift.PrependError(fmt.Sprintf("%T.field_id (9) field write error: ", p), err) 4197 } 4198 if err := oprot.WriteFieldEnd(ctx); err != nil { 4199 return thrift.PrependError(fmt.Sprintf("%T write field end error 9:field_id: ", p), err) 4200 } 4201 } 4202 return err 4203 } 4204 4205 func (p *SchemaElement) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { 4206 if p.IsSetLogicalType() { 4207 if err := oprot.WriteFieldBegin(ctx, "logicalType", thrift.STRUCT, 10); err != nil { 4208 return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:logicalType: ", p), err) 4209 } 4210 if err := p.LogicalType.Write(ctx, oprot); err != nil { 4211 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.LogicalType), err) 4212 } 4213 if err := oprot.WriteFieldEnd(ctx); err != nil { 4214 return thrift.PrependError(fmt.Sprintf("%T write field end error 10:logicalType: ", p), err) 4215 } 4216 } 4217 return err 4218 } 4219 4220 func (p *SchemaElement) Equals(other *SchemaElement) bool { 4221 if p == other { 4222 return true 4223 } else if p == nil || other == nil { 4224 return false 4225 } 4226 if p.Type != other.Type { 4227 if p.Type == nil || other.Type == nil { 4228 return false 4229 } 4230 if (*p.Type) != (*other.Type) { 4231 return false 4232 } 4233 } 4234 if p.TypeLength != other.TypeLength { 4235 if p.TypeLength == nil || other.TypeLength == nil { 4236 return false 4237 } 4238 if (*p.TypeLength) != (*other.TypeLength) { 4239 return false 4240 } 4241 } 4242 if p.RepetitionType != other.RepetitionType { 4243 if p.RepetitionType == nil || other.RepetitionType == nil { 4244 return false 4245 } 4246 if (*p.RepetitionType) != (*other.RepetitionType) { 4247 return false 4248 } 4249 } 4250 if p.Name != other.Name { 4251 return false 4252 } 4253 if p.NumChildren != other.NumChildren { 4254 if p.NumChildren == nil || other.NumChildren == nil { 4255 return false 4256 } 4257 if (*p.NumChildren) != (*other.NumChildren) { 4258 return false 4259 } 4260 } 4261 if p.ConvertedType != other.ConvertedType { 4262 if p.ConvertedType == nil || other.ConvertedType == nil { 4263 return false 4264 } 4265 if (*p.ConvertedType) != (*other.ConvertedType) { 4266 return false 4267 } 4268 } 4269 if p.Scale != other.Scale { 4270 if p.Scale == nil || other.Scale == nil { 4271 return false 4272 } 4273 if (*p.Scale) != (*other.Scale) { 4274 return false 4275 } 4276 } 4277 if p.Precision != other.Precision { 4278 if p.Precision == nil || other.Precision == nil { 4279 return false 4280 } 4281 if (*p.Precision) != (*other.Precision) { 4282 return false 4283 } 4284 } 4285 if p.FieldID != other.FieldID { 4286 if p.FieldID == nil || other.FieldID == nil { 4287 return false 4288 } 4289 if (*p.FieldID) != (*other.FieldID) { 4290 return false 4291 } 4292 } 4293 if !p.LogicalType.Equals(other.LogicalType) { 4294 return false 4295 } 4296 return true 4297 } 4298 4299 func (p *SchemaElement) String() string { 4300 if p == nil { 4301 return "<nil>" 4302 } 4303 return fmt.Sprintf("SchemaElement(%+v)", *p) 4304 } 4305 4306 // Data page header 4307 // 4308 // Attributes: 4309 // - NumValues: Number of values, including NULLs, in this data page. * 4310 // - Encoding: Encoding used for this data page * 4311 // - DefinitionLevelEncoding: Encoding used for definition levels * 4312 // - RepetitionLevelEncoding: Encoding used for repetition levels * 4313 // - Statistics: Optional statistics for the data in this page* 4314 type DataPageHeader struct { 4315 NumValues int32 `thrift:"num_values,1,required" db:"num_values" json:"num_values"` 4316 Encoding Encoding `thrift:"encoding,2,required" db:"encoding" json:"encoding"` 4317 DefinitionLevelEncoding Encoding `thrift:"definition_level_encoding,3,required" db:"definition_level_encoding" json:"definition_level_encoding"` 4318 RepetitionLevelEncoding Encoding `thrift:"repetition_level_encoding,4,required" db:"repetition_level_encoding" json:"repetition_level_encoding"` 4319 Statistics *Statistics `thrift:"statistics,5" db:"statistics" json:"statistics,omitempty"` 4320 } 4321 4322 func NewDataPageHeader() *DataPageHeader { 4323 return &DataPageHeader{} 4324 } 4325 4326 func (p *DataPageHeader) GetNumValues() int32 { 4327 return p.NumValues 4328 } 4329 4330 func (p *DataPageHeader) GetEncoding() Encoding { 4331 return p.Encoding 4332 } 4333 4334 func (p *DataPageHeader) GetDefinitionLevelEncoding() Encoding { 4335 return p.DefinitionLevelEncoding 4336 } 4337 4338 func (p *DataPageHeader) GetRepetitionLevelEncoding() Encoding { 4339 return p.RepetitionLevelEncoding 4340 } 4341 4342 var DataPageHeader_Statistics_DEFAULT *Statistics 4343 4344 func (p *DataPageHeader) GetStatistics() *Statistics { 4345 if !p.IsSetStatistics() { 4346 return DataPageHeader_Statistics_DEFAULT 4347 } 4348 return p.Statistics 4349 } 4350 func (p *DataPageHeader) IsSetStatistics() bool { 4351 return p.Statistics != nil 4352 } 4353 4354 func (p *DataPageHeader) Read(ctx context.Context, iprot thrift.TProtocol) error { 4355 if _, err := iprot.ReadStructBegin(ctx); err != nil { 4356 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 4357 } 4358 4359 var issetNumValues bool = false 4360 var issetEncoding bool = false 4361 var issetDefinitionLevelEncoding bool = false 4362 var issetRepetitionLevelEncoding bool = false 4363 4364 for { 4365 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 4366 if err != nil { 4367 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 4368 } 4369 if fieldTypeId == thrift.STOP { 4370 break 4371 } 4372 switch fieldId { 4373 case 1: 4374 if fieldTypeId == thrift.I32 { 4375 if err := p.ReadField1(ctx, iprot); err != nil { 4376 return err 4377 } 4378 issetNumValues = true 4379 } else { 4380 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4381 return err 4382 } 4383 } 4384 case 2: 4385 if fieldTypeId == thrift.I32 { 4386 if err := p.ReadField2(ctx, iprot); err != nil { 4387 return err 4388 } 4389 issetEncoding = true 4390 } else { 4391 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4392 return err 4393 } 4394 } 4395 case 3: 4396 if fieldTypeId == thrift.I32 { 4397 if err := p.ReadField3(ctx, iprot); err != nil { 4398 return err 4399 } 4400 issetDefinitionLevelEncoding = true 4401 } else { 4402 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4403 return err 4404 } 4405 } 4406 case 4: 4407 if fieldTypeId == thrift.I32 { 4408 if err := p.ReadField4(ctx, iprot); err != nil { 4409 return err 4410 } 4411 issetRepetitionLevelEncoding = true 4412 } else { 4413 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4414 return err 4415 } 4416 } 4417 case 5: 4418 if fieldTypeId == thrift.STRUCT { 4419 if err := p.ReadField5(ctx, iprot); err != nil { 4420 return err 4421 } 4422 } else { 4423 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4424 return err 4425 } 4426 } 4427 default: 4428 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4429 return err 4430 } 4431 } 4432 if err := iprot.ReadFieldEnd(ctx); err != nil { 4433 return err 4434 } 4435 } 4436 if err := iprot.ReadStructEnd(ctx); err != nil { 4437 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4438 } 4439 if !issetNumValues { 4440 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumValues is not set")) 4441 } 4442 if !issetEncoding { 4443 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encoding is not set")) 4444 } 4445 if !issetDefinitionLevelEncoding { 4446 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DefinitionLevelEncoding is not set")) 4447 } 4448 if !issetRepetitionLevelEncoding { 4449 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RepetitionLevelEncoding is not set")) 4450 } 4451 return nil 4452 } 4453 4454 func (p *DataPageHeader) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 4455 if v, err := iprot.ReadI32(ctx); err != nil { 4456 return thrift.PrependError("error reading field 1: ", err) 4457 } else { 4458 p.NumValues = v 4459 } 4460 return nil 4461 } 4462 4463 func (p *DataPageHeader) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 4464 if v, err := iprot.ReadI32(ctx); err != nil { 4465 return thrift.PrependError("error reading field 2: ", err) 4466 } else { 4467 temp := Encoding(v) 4468 p.Encoding = temp 4469 } 4470 return nil 4471 } 4472 4473 func (p *DataPageHeader) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 4474 if v, err := iprot.ReadI32(ctx); err != nil { 4475 return thrift.PrependError("error reading field 3: ", err) 4476 } else { 4477 temp := Encoding(v) 4478 p.DefinitionLevelEncoding = temp 4479 } 4480 return nil 4481 } 4482 4483 func (p *DataPageHeader) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 4484 if v, err := iprot.ReadI32(ctx); err != nil { 4485 return thrift.PrependError("error reading field 4: ", err) 4486 } else { 4487 temp := Encoding(v) 4488 p.RepetitionLevelEncoding = temp 4489 } 4490 return nil 4491 } 4492 4493 func (p *DataPageHeader) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 4494 p.Statistics = &Statistics{} 4495 if err := p.Statistics.Read(ctx, iprot); err != nil { 4496 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Statistics), err) 4497 } 4498 return nil 4499 } 4500 4501 func (p *DataPageHeader) Write(ctx context.Context, oprot thrift.TProtocol) error { 4502 if err := oprot.WriteStructBegin(ctx, "DataPageHeader"); err != nil { 4503 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4504 } 4505 if p != nil { 4506 if err := p.writeField1(ctx, oprot); err != nil { 4507 return err 4508 } 4509 if err := p.writeField2(ctx, oprot); err != nil { 4510 return err 4511 } 4512 if err := p.writeField3(ctx, oprot); err != nil { 4513 return err 4514 } 4515 if err := p.writeField4(ctx, oprot); err != nil { 4516 return err 4517 } 4518 if err := p.writeField5(ctx, oprot); err != nil { 4519 return err 4520 } 4521 } 4522 if err := oprot.WriteFieldStop(ctx); err != nil { 4523 return thrift.PrependError("write field stop error: ", err) 4524 } 4525 if err := oprot.WriteStructEnd(ctx); err != nil { 4526 return thrift.PrependError("write struct stop error: ", err) 4527 } 4528 return nil 4529 } 4530 4531 func (p *DataPageHeader) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 4532 if err := oprot.WriteFieldBegin(ctx, "num_values", thrift.I32, 1); err != nil { 4533 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:num_values: ", p), err) 4534 } 4535 if err := oprot.WriteI32(ctx, int32(p.NumValues)); err != nil { 4536 return thrift.PrependError(fmt.Sprintf("%T.num_values (1) field write error: ", p), err) 4537 } 4538 if err := oprot.WriteFieldEnd(ctx); err != nil { 4539 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:num_values: ", p), err) 4540 } 4541 return err 4542 } 4543 4544 func (p *DataPageHeader) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 4545 if err := oprot.WriteFieldBegin(ctx, "encoding", thrift.I32, 2); err != nil { 4546 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:encoding: ", p), err) 4547 } 4548 if err := oprot.WriteI32(ctx, int32(p.Encoding)); err != nil { 4549 return thrift.PrependError(fmt.Sprintf("%T.encoding (2) field write error: ", p), err) 4550 } 4551 if err := oprot.WriteFieldEnd(ctx); err != nil { 4552 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:encoding: ", p), err) 4553 } 4554 return err 4555 } 4556 4557 func (p *DataPageHeader) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 4558 if err := oprot.WriteFieldBegin(ctx, "definition_level_encoding", thrift.I32, 3); err != nil { 4559 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:definition_level_encoding: ", p), err) 4560 } 4561 if err := oprot.WriteI32(ctx, int32(p.DefinitionLevelEncoding)); err != nil { 4562 return thrift.PrependError(fmt.Sprintf("%T.definition_level_encoding (3) field write error: ", p), err) 4563 } 4564 if err := oprot.WriteFieldEnd(ctx); err != nil { 4565 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:definition_level_encoding: ", p), err) 4566 } 4567 return err 4568 } 4569 4570 func (p *DataPageHeader) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 4571 if err := oprot.WriteFieldBegin(ctx, "repetition_level_encoding", thrift.I32, 4); err != nil { 4572 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:repetition_level_encoding: ", p), err) 4573 } 4574 if err := oprot.WriteI32(ctx, int32(p.RepetitionLevelEncoding)); err != nil { 4575 return thrift.PrependError(fmt.Sprintf("%T.repetition_level_encoding (4) field write error: ", p), err) 4576 } 4577 if err := oprot.WriteFieldEnd(ctx); err != nil { 4578 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:repetition_level_encoding: ", p), err) 4579 } 4580 return err 4581 } 4582 4583 func (p *DataPageHeader) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 4584 if p.IsSetStatistics() { 4585 if err := oprot.WriteFieldBegin(ctx, "statistics", thrift.STRUCT, 5); err != nil { 4586 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:statistics: ", p), err) 4587 } 4588 if err := p.Statistics.Write(ctx, oprot); err != nil { 4589 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Statistics), err) 4590 } 4591 if err := oprot.WriteFieldEnd(ctx); err != nil { 4592 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:statistics: ", p), err) 4593 } 4594 } 4595 return err 4596 } 4597 4598 func (p *DataPageHeader) Equals(other *DataPageHeader) bool { 4599 if p == other { 4600 return true 4601 } else if p == nil || other == nil { 4602 return false 4603 } 4604 if p.NumValues != other.NumValues { 4605 return false 4606 } 4607 if p.Encoding != other.Encoding { 4608 return false 4609 } 4610 if p.DefinitionLevelEncoding != other.DefinitionLevelEncoding { 4611 return false 4612 } 4613 if p.RepetitionLevelEncoding != other.RepetitionLevelEncoding { 4614 return false 4615 } 4616 if !p.Statistics.Equals(other.Statistics) { 4617 return false 4618 } 4619 return true 4620 } 4621 4622 func (p *DataPageHeader) String() string { 4623 if p == nil { 4624 return "<nil>" 4625 } 4626 return fmt.Sprintf("DataPageHeader(%+v)", *p) 4627 } 4628 4629 type IndexPageHeader struct { 4630 } 4631 4632 func NewIndexPageHeader() *IndexPageHeader { 4633 return &IndexPageHeader{} 4634 } 4635 4636 func (p *IndexPageHeader) Read(ctx context.Context, iprot thrift.TProtocol) error { 4637 if _, err := iprot.ReadStructBegin(ctx); err != nil { 4638 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 4639 } 4640 4641 for { 4642 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 4643 if err != nil { 4644 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 4645 } 4646 if fieldTypeId == thrift.STOP { 4647 break 4648 } 4649 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4650 return err 4651 } 4652 if err := iprot.ReadFieldEnd(ctx); err != nil { 4653 return err 4654 } 4655 } 4656 if err := iprot.ReadStructEnd(ctx); err != nil { 4657 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4658 } 4659 return nil 4660 } 4661 4662 func (p *IndexPageHeader) Write(ctx context.Context, oprot thrift.TProtocol) error { 4663 if err := oprot.WriteStructBegin(ctx, "IndexPageHeader"); err != nil { 4664 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4665 } 4666 if p != nil { 4667 } 4668 if err := oprot.WriteFieldStop(ctx); err != nil { 4669 return thrift.PrependError("write field stop error: ", err) 4670 } 4671 if err := oprot.WriteStructEnd(ctx); err != nil { 4672 return thrift.PrependError("write struct stop error: ", err) 4673 } 4674 return nil 4675 } 4676 4677 func (p *IndexPageHeader) Equals(other *IndexPageHeader) bool { 4678 if p == other { 4679 return true 4680 } else if p == nil || other == nil { 4681 return false 4682 } 4683 return true 4684 } 4685 4686 func (p *IndexPageHeader) String() string { 4687 if p == nil { 4688 return "<nil>" 4689 } 4690 return fmt.Sprintf("IndexPageHeader(%+v)", *p) 4691 } 4692 4693 // Attributes: 4694 // - NumValues: Number of values in the dictionary * 4695 // - Encoding: Encoding using this dictionary page * 4696 // - IsSorted: If true, the entries in the dictionary are sorted in ascending order * 4697 type DictionaryPageHeader struct { 4698 NumValues int32 `thrift:"num_values,1,required" db:"num_values" json:"num_values"` 4699 Encoding Encoding `thrift:"encoding,2,required" db:"encoding" json:"encoding"` 4700 IsSorted *bool `thrift:"is_sorted,3" db:"is_sorted" json:"is_sorted,omitempty"` 4701 } 4702 4703 func NewDictionaryPageHeader() *DictionaryPageHeader { 4704 return &DictionaryPageHeader{} 4705 } 4706 4707 func (p *DictionaryPageHeader) GetNumValues() int32 { 4708 return p.NumValues 4709 } 4710 4711 func (p *DictionaryPageHeader) GetEncoding() Encoding { 4712 return p.Encoding 4713 } 4714 4715 var DictionaryPageHeader_IsSorted_DEFAULT bool 4716 4717 func (p *DictionaryPageHeader) GetIsSorted() bool { 4718 if !p.IsSetIsSorted() { 4719 return DictionaryPageHeader_IsSorted_DEFAULT 4720 } 4721 return *p.IsSorted 4722 } 4723 func (p *DictionaryPageHeader) IsSetIsSorted() bool { 4724 return p.IsSorted != nil 4725 } 4726 4727 func (p *DictionaryPageHeader) Read(ctx context.Context, iprot thrift.TProtocol) error { 4728 if _, err := iprot.ReadStructBegin(ctx); err != nil { 4729 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 4730 } 4731 4732 var issetNumValues bool = false 4733 var issetEncoding bool = false 4734 4735 for { 4736 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 4737 if err != nil { 4738 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 4739 } 4740 if fieldTypeId == thrift.STOP { 4741 break 4742 } 4743 switch fieldId { 4744 case 1: 4745 if fieldTypeId == thrift.I32 { 4746 if err := p.ReadField1(ctx, iprot); err != nil { 4747 return err 4748 } 4749 issetNumValues = true 4750 } else { 4751 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4752 return err 4753 } 4754 } 4755 case 2: 4756 if fieldTypeId == thrift.I32 { 4757 if err := p.ReadField2(ctx, iprot); err != nil { 4758 return err 4759 } 4760 issetEncoding = true 4761 } else { 4762 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4763 return err 4764 } 4765 } 4766 case 3: 4767 if fieldTypeId == thrift.BOOL { 4768 if err := p.ReadField3(ctx, iprot); err != nil { 4769 return err 4770 } 4771 } else { 4772 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4773 return err 4774 } 4775 } 4776 default: 4777 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 4778 return err 4779 } 4780 } 4781 if err := iprot.ReadFieldEnd(ctx); err != nil { 4782 return err 4783 } 4784 } 4785 if err := iprot.ReadStructEnd(ctx); err != nil { 4786 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4787 } 4788 if !issetNumValues { 4789 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumValues is not set")) 4790 } 4791 if !issetEncoding { 4792 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encoding is not set")) 4793 } 4794 return nil 4795 } 4796 4797 func (p *DictionaryPageHeader) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 4798 if v, err := iprot.ReadI32(ctx); err != nil { 4799 return thrift.PrependError("error reading field 1: ", err) 4800 } else { 4801 p.NumValues = v 4802 } 4803 return nil 4804 } 4805 4806 func (p *DictionaryPageHeader) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 4807 if v, err := iprot.ReadI32(ctx); err != nil { 4808 return thrift.PrependError("error reading field 2: ", err) 4809 } else { 4810 temp := Encoding(v) 4811 p.Encoding = temp 4812 } 4813 return nil 4814 } 4815 4816 func (p *DictionaryPageHeader) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 4817 if v, err := iprot.ReadBool(ctx); err != nil { 4818 return thrift.PrependError("error reading field 3: ", err) 4819 } else { 4820 p.IsSorted = &v 4821 } 4822 return nil 4823 } 4824 4825 func (p *DictionaryPageHeader) Write(ctx context.Context, oprot thrift.TProtocol) error { 4826 if err := oprot.WriteStructBegin(ctx, "DictionaryPageHeader"); err != nil { 4827 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4828 } 4829 if p != nil { 4830 if err := p.writeField1(ctx, oprot); err != nil { 4831 return err 4832 } 4833 if err := p.writeField2(ctx, oprot); err != nil { 4834 return err 4835 } 4836 if err := p.writeField3(ctx, oprot); err != nil { 4837 return err 4838 } 4839 } 4840 if err := oprot.WriteFieldStop(ctx); err != nil { 4841 return thrift.PrependError("write field stop error: ", err) 4842 } 4843 if err := oprot.WriteStructEnd(ctx); err != nil { 4844 return thrift.PrependError("write struct stop error: ", err) 4845 } 4846 return nil 4847 } 4848 4849 func (p *DictionaryPageHeader) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 4850 if err := oprot.WriteFieldBegin(ctx, "num_values", thrift.I32, 1); err != nil { 4851 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:num_values: ", p), err) 4852 } 4853 if err := oprot.WriteI32(ctx, int32(p.NumValues)); err != nil { 4854 return thrift.PrependError(fmt.Sprintf("%T.num_values (1) field write error: ", p), err) 4855 } 4856 if err := oprot.WriteFieldEnd(ctx); err != nil { 4857 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:num_values: ", p), err) 4858 } 4859 return err 4860 } 4861 4862 func (p *DictionaryPageHeader) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 4863 if err := oprot.WriteFieldBegin(ctx, "encoding", thrift.I32, 2); err != nil { 4864 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:encoding: ", p), err) 4865 } 4866 if err := oprot.WriteI32(ctx, int32(p.Encoding)); err != nil { 4867 return thrift.PrependError(fmt.Sprintf("%T.encoding (2) field write error: ", p), err) 4868 } 4869 if err := oprot.WriteFieldEnd(ctx); err != nil { 4870 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:encoding: ", p), err) 4871 } 4872 return err 4873 } 4874 4875 func (p *DictionaryPageHeader) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 4876 if p.IsSetIsSorted() { 4877 if err := oprot.WriteFieldBegin(ctx, "is_sorted", thrift.BOOL, 3); err != nil { 4878 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:is_sorted: ", p), err) 4879 } 4880 if err := oprot.WriteBool(ctx, bool(*p.IsSorted)); err != nil { 4881 return thrift.PrependError(fmt.Sprintf("%T.is_sorted (3) field write error: ", p), err) 4882 } 4883 if err := oprot.WriteFieldEnd(ctx); err != nil { 4884 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:is_sorted: ", p), err) 4885 } 4886 } 4887 return err 4888 } 4889 4890 func (p *DictionaryPageHeader) Equals(other *DictionaryPageHeader) bool { 4891 if p == other { 4892 return true 4893 } else if p == nil || other == nil { 4894 return false 4895 } 4896 if p.NumValues != other.NumValues { 4897 return false 4898 } 4899 if p.Encoding != other.Encoding { 4900 return false 4901 } 4902 if p.IsSorted != other.IsSorted { 4903 if p.IsSorted == nil || other.IsSorted == nil { 4904 return false 4905 } 4906 if (*p.IsSorted) != (*other.IsSorted) { 4907 return false 4908 } 4909 } 4910 return true 4911 } 4912 4913 func (p *DictionaryPageHeader) String() string { 4914 if p == nil { 4915 return "<nil>" 4916 } 4917 return fmt.Sprintf("DictionaryPageHeader(%+v)", *p) 4918 } 4919 4920 // New page format allowing reading levels without decompressing the data 4921 // Repetition and definition levels are uncompressed 4922 // The remaining section containing the data is compressed if is_compressed is true 4923 // 4924 // 4925 // Attributes: 4926 // - NumValues: Number of values, including NULLs, in this data page. * 4927 // - NumNulls: Number of NULL values, in this data page. 4928 // Number of non-null = num_values - num_nulls which is also the number of values in the data section * 4929 // - NumRows: Number of rows in this data page. which means pages change on record boundaries (r = 0) * 4930 // - Encoding: Encoding used for data in this page * 4931 // - DefinitionLevelsByteLength: length of the definition levels 4932 // - RepetitionLevelsByteLength: length of the repetition levels 4933 // - IsCompressed: whether the values are compressed. 4934 // Which means the section of the page between 4935 // definition_levels_byte_length + repetition_levels_byte_length + 1 and compressed_page_size (included) 4936 // is compressed with the compression_codec. 4937 // If missing it is considered compressed 4938 // - Statistics: optional statistics for the data in this page * 4939 type DataPageHeaderV2 struct { 4940 NumValues int32 `thrift:"num_values,1,required" db:"num_values" json:"num_values"` 4941 NumNulls int32 `thrift:"num_nulls,2,required" db:"num_nulls" json:"num_nulls"` 4942 NumRows int32 `thrift:"num_rows,3,required" db:"num_rows" json:"num_rows"` 4943 Encoding Encoding `thrift:"encoding,4,required" db:"encoding" json:"encoding"` 4944 DefinitionLevelsByteLength int32 `thrift:"definition_levels_byte_length,5,required" db:"definition_levels_byte_length" json:"definition_levels_byte_length"` 4945 RepetitionLevelsByteLength int32 `thrift:"repetition_levels_byte_length,6,required" db:"repetition_levels_byte_length" json:"repetition_levels_byte_length"` 4946 IsCompressed bool `thrift:"is_compressed,7" db:"is_compressed" json:"is_compressed"` 4947 Statistics *Statistics `thrift:"statistics,8" db:"statistics" json:"statistics,omitempty"` 4948 } 4949 4950 func NewDataPageHeaderV2() *DataPageHeaderV2 { 4951 return &DataPageHeaderV2{ 4952 IsCompressed: true, 4953 } 4954 } 4955 4956 func (p *DataPageHeaderV2) GetNumValues() int32 { 4957 return p.NumValues 4958 } 4959 4960 func (p *DataPageHeaderV2) GetNumNulls() int32 { 4961 return p.NumNulls 4962 } 4963 4964 func (p *DataPageHeaderV2) GetNumRows() int32 { 4965 return p.NumRows 4966 } 4967 4968 func (p *DataPageHeaderV2) GetEncoding() Encoding { 4969 return p.Encoding 4970 } 4971 4972 func (p *DataPageHeaderV2) GetDefinitionLevelsByteLength() int32 { 4973 return p.DefinitionLevelsByteLength 4974 } 4975 4976 func (p *DataPageHeaderV2) GetRepetitionLevelsByteLength() int32 { 4977 return p.RepetitionLevelsByteLength 4978 } 4979 4980 var DataPageHeaderV2_IsCompressed_DEFAULT bool = true 4981 4982 func (p *DataPageHeaderV2) GetIsCompressed() bool { 4983 return p.IsCompressed 4984 } 4985 4986 var DataPageHeaderV2_Statistics_DEFAULT *Statistics 4987 4988 func (p *DataPageHeaderV2) GetStatistics() *Statistics { 4989 if !p.IsSetStatistics() { 4990 return DataPageHeaderV2_Statistics_DEFAULT 4991 } 4992 return p.Statistics 4993 } 4994 func (p *DataPageHeaderV2) IsSetIsCompressed() bool { 4995 return p.IsCompressed != DataPageHeaderV2_IsCompressed_DEFAULT 4996 } 4997 4998 func (p *DataPageHeaderV2) IsSetStatistics() bool { 4999 return p.Statistics != nil 5000 } 5001 5002 func (p *DataPageHeaderV2) Read(ctx context.Context, iprot thrift.TProtocol) error { 5003 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5004 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5005 } 5006 5007 var issetNumValues bool = false 5008 var issetNumNulls bool = false 5009 var issetNumRows bool = false 5010 var issetEncoding bool = false 5011 var issetDefinitionLevelsByteLength bool = false 5012 var issetRepetitionLevelsByteLength bool = false 5013 5014 for { 5015 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5016 if err != nil { 5017 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5018 } 5019 if fieldTypeId == thrift.STOP { 5020 break 5021 } 5022 switch fieldId { 5023 case 1: 5024 if fieldTypeId == thrift.I32 { 5025 if err := p.ReadField1(ctx, iprot); err != nil { 5026 return err 5027 } 5028 issetNumValues = true 5029 } else { 5030 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5031 return err 5032 } 5033 } 5034 case 2: 5035 if fieldTypeId == thrift.I32 { 5036 if err := p.ReadField2(ctx, iprot); err != nil { 5037 return err 5038 } 5039 issetNumNulls = true 5040 } else { 5041 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5042 return err 5043 } 5044 } 5045 case 3: 5046 if fieldTypeId == thrift.I32 { 5047 if err := p.ReadField3(ctx, iprot); err != nil { 5048 return err 5049 } 5050 issetNumRows = true 5051 } else { 5052 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5053 return err 5054 } 5055 } 5056 case 4: 5057 if fieldTypeId == thrift.I32 { 5058 if err := p.ReadField4(ctx, iprot); err != nil { 5059 return err 5060 } 5061 issetEncoding = true 5062 } else { 5063 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5064 return err 5065 } 5066 } 5067 case 5: 5068 if fieldTypeId == thrift.I32 { 5069 if err := p.ReadField5(ctx, iprot); err != nil { 5070 return err 5071 } 5072 issetDefinitionLevelsByteLength = true 5073 } else { 5074 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5075 return err 5076 } 5077 } 5078 case 6: 5079 if fieldTypeId == thrift.I32 { 5080 if err := p.ReadField6(ctx, iprot); err != nil { 5081 return err 5082 } 5083 issetRepetitionLevelsByteLength = true 5084 } else { 5085 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5086 return err 5087 } 5088 } 5089 case 7: 5090 if fieldTypeId == thrift.BOOL { 5091 if err := p.ReadField7(ctx, iprot); err != nil { 5092 return err 5093 } 5094 } else { 5095 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5096 return err 5097 } 5098 } 5099 case 8: 5100 if fieldTypeId == thrift.STRUCT { 5101 if err := p.ReadField8(ctx, iprot); err != nil { 5102 return err 5103 } 5104 } else { 5105 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5106 return err 5107 } 5108 } 5109 default: 5110 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5111 return err 5112 } 5113 } 5114 if err := iprot.ReadFieldEnd(ctx); err != nil { 5115 return err 5116 } 5117 } 5118 if err := iprot.ReadStructEnd(ctx); err != nil { 5119 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5120 } 5121 if !issetNumValues { 5122 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumValues is not set")) 5123 } 5124 if !issetNumNulls { 5125 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumNulls is not set")) 5126 } 5127 if !issetNumRows { 5128 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumRows is not set")) 5129 } 5130 if !issetEncoding { 5131 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encoding is not set")) 5132 } 5133 if !issetDefinitionLevelsByteLength { 5134 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DefinitionLevelsByteLength is not set")) 5135 } 5136 if !issetRepetitionLevelsByteLength { 5137 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RepetitionLevelsByteLength is not set")) 5138 } 5139 return nil 5140 } 5141 5142 func (p *DataPageHeaderV2) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 5143 if v, err := iprot.ReadI32(ctx); err != nil { 5144 return thrift.PrependError("error reading field 1: ", err) 5145 } else { 5146 p.NumValues = v 5147 } 5148 return nil 5149 } 5150 5151 func (p *DataPageHeaderV2) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 5152 if v, err := iprot.ReadI32(ctx); err != nil { 5153 return thrift.PrependError("error reading field 2: ", err) 5154 } else { 5155 p.NumNulls = v 5156 } 5157 return nil 5158 } 5159 5160 func (p *DataPageHeaderV2) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 5161 if v, err := iprot.ReadI32(ctx); err != nil { 5162 return thrift.PrependError("error reading field 3: ", err) 5163 } else { 5164 p.NumRows = v 5165 } 5166 return nil 5167 } 5168 5169 func (p *DataPageHeaderV2) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 5170 if v, err := iprot.ReadI32(ctx); err != nil { 5171 return thrift.PrependError("error reading field 4: ", err) 5172 } else { 5173 temp := Encoding(v) 5174 p.Encoding = temp 5175 } 5176 return nil 5177 } 5178 5179 func (p *DataPageHeaderV2) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 5180 if v, err := iprot.ReadI32(ctx); err != nil { 5181 return thrift.PrependError("error reading field 5: ", err) 5182 } else { 5183 p.DefinitionLevelsByteLength = v 5184 } 5185 return nil 5186 } 5187 5188 func (p *DataPageHeaderV2) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 5189 if v, err := iprot.ReadI32(ctx); err != nil { 5190 return thrift.PrependError("error reading field 6: ", err) 5191 } else { 5192 p.RepetitionLevelsByteLength = v 5193 } 5194 return nil 5195 } 5196 5197 func (p *DataPageHeaderV2) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 5198 if v, err := iprot.ReadBool(ctx); err != nil { 5199 return thrift.PrependError("error reading field 7: ", err) 5200 } else { 5201 p.IsCompressed = v 5202 } 5203 return nil 5204 } 5205 5206 func (p *DataPageHeaderV2) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 5207 p.Statistics = &Statistics{} 5208 if err := p.Statistics.Read(ctx, iprot); err != nil { 5209 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Statistics), err) 5210 } 5211 return nil 5212 } 5213 5214 func (p *DataPageHeaderV2) Write(ctx context.Context, oprot thrift.TProtocol) error { 5215 if err := oprot.WriteStructBegin(ctx, "DataPageHeaderV2"); err != nil { 5216 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5217 } 5218 if p != nil { 5219 if err := p.writeField1(ctx, oprot); err != nil { 5220 return err 5221 } 5222 if err := p.writeField2(ctx, oprot); err != nil { 5223 return err 5224 } 5225 if err := p.writeField3(ctx, oprot); err != nil { 5226 return err 5227 } 5228 if err := p.writeField4(ctx, oprot); err != nil { 5229 return err 5230 } 5231 if err := p.writeField5(ctx, oprot); err != nil { 5232 return err 5233 } 5234 if err := p.writeField6(ctx, oprot); err != nil { 5235 return err 5236 } 5237 if err := p.writeField7(ctx, oprot); err != nil { 5238 return err 5239 } 5240 if err := p.writeField8(ctx, oprot); err != nil { 5241 return err 5242 } 5243 } 5244 if err := oprot.WriteFieldStop(ctx); err != nil { 5245 return thrift.PrependError("write field stop error: ", err) 5246 } 5247 if err := oprot.WriteStructEnd(ctx); err != nil { 5248 return thrift.PrependError("write struct stop error: ", err) 5249 } 5250 return nil 5251 } 5252 5253 func (p *DataPageHeaderV2) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 5254 if err := oprot.WriteFieldBegin(ctx, "num_values", thrift.I32, 1); err != nil { 5255 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:num_values: ", p), err) 5256 } 5257 if err := oprot.WriteI32(ctx, int32(p.NumValues)); err != nil { 5258 return thrift.PrependError(fmt.Sprintf("%T.num_values (1) field write error: ", p), err) 5259 } 5260 if err := oprot.WriteFieldEnd(ctx); err != nil { 5261 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:num_values: ", p), err) 5262 } 5263 return err 5264 } 5265 5266 func (p *DataPageHeaderV2) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 5267 if err := oprot.WriteFieldBegin(ctx, "num_nulls", thrift.I32, 2); err != nil { 5268 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:num_nulls: ", p), err) 5269 } 5270 if err := oprot.WriteI32(ctx, int32(p.NumNulls)); err != nil { 5271 return thrift.PrependError(fmt.Sprintf("%T.num_nulls (2) field write error: ", p), err) 5272 } 5273 if err := oprot.WriteFieldEnd(ctx); err != nil { 5274 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:num_nulls: ", p), err) 5275 } 5276 return err 5277 } 5278 5279 func (p *DataPageHeaderV2) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 5280 if err := oprot.WriteFieldBegin(ctx, "num_rows", thrift.I32, 3); err != nil { 5281 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:num_rows: ", p), err) 5282 } 5283 if err := oprot.WriteI32(ctx, int32(p.NumRows)); err != nil { 5284 return thrift.PrependError(fmt.Sprintf("%T.num_rows (3) field write error: ", p), err) 5285 } 5286 if err := oprot.WriteFieldEnd(ctx); err != nil { 5287 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:num_rows: ", p), err) 5288 } 5289 return err 5290 } 5291 5292 func (p *DataPageHeaderV2) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 5293 if err := oprot.WriteFieldBegin(ctx, "encoding", thrift.I32, 4); err != nil { 5294 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:encoding: ", p), err) 5295 } 5296 if err := oprot.WriteI32(ctx, int32(p.Encoding)); err != nil { 5297 return thrift.PrependError(fmt.Sprintf("%T.encoding (4) field write error: ", p), err) 5298 } 5299 if err := oprot.WriteFieldEnd(ctx); err != nil { 5300 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:encoding: ", p), err) 5301 } 5302 return err 5303 } 5304 5305 func (p *DataPageHeaderV2) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 5306 if err := oprot.WriteFieldBegin(ctx, "definition_levels_byte_length", thrift.I32, 5); err != nil { 5307 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:definition_levels_byte_length: ", p), err) 5308 } 5309 if err := oprot.WriteI32(ctx, int32(p.DefinitionLevelsByteLength)); err != nil { 5310 return thrift.PrependError(fmt.Sprintf("%T.definition_levels_byte_length (5) field write error: ", p), err) 5311 } 5312 if err := oprot.WriteFieldEnd(ctx); err != nil { 5313 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:definition_levels_byte_length: ", p), err) 5314 } 5315 return err 5316 } 5317 5318 func (p *DataPageHeaderV2) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 5319 if err := oprot.WriteFieldBegin(ctx, "repetition_levels_byte_length", thrift.I32, 6); err != nil { 5320 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:repetition_levels_byte_length: ", p), err) 5321 } 5322 if err := oprot.WriteI32(ctx, int32(p.RepetitionLevelsByteLength)); err != nil { 5323 return thrift.PrependError(fmt.Sprintf("%T.repetition_levels_byte_length (6) field write error: ", p), err) 5324 } 5325 if err := oprot.WriteFieldEnd(ctx); err != nil { 5326 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:repetition_levels_byte_length: ", p), err) 5327 } 5328 return err 5329 } 5330 5331 func (p *DataPageHeaderV2) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 5332 if p.IsSetIsCompressed() { 5333 if err := oprot.WriteFieldBegin(ctx, "is_compressed", thrift.BOOL, 7); err != nil { 5334 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:is_compressed: ", p), err) 5335 } 5336 if err := oprot.WriteBool(ctx, bool(p.IsCompressed)); err != nil { 5337 return thrift.PrependError(fmt.Sprintf("%T.is_compressed (7) field write error: ", p), err) 5338 } 5339 if err := oprot.WriteFieldEnd(ctx); err != nil { 5340 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:is_compressed: ", p), err) 5341 } 5342 } 5343 return err 5344 } 5345 5346 func (p *DataPageHeaderV2) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 5347 if p.IsSetStatistics() { 5348 if err := oprot.WriteFieldBegin(ctx, "statistics", thrift.STRUCT, 8); err != nil { 5349 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:statistics: ", p), err) 5350 } 5351 if err := p.Statistics.Write(ctx, oprot); err != nil { 5352 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Statistics), err) 5353 } 5354 if err := oprot.WriteFieldEnd(ctx); err != nil { 5355 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:statistics: ", p), err) 5356 } 5357 } 5358 return err 5359 } 5360 5361 func (p *DataPageHeaderV2) Equals(other *DataPageHeaderV2) bool { 5362 if p == other { 5363 return true 5364 } else if p == nil || other == nil { 5365 return false 5366 } 5367 if p.NumValues != other.NumValues { 5368 return false 5369 } 5370 if p.NumNulls != other.NumNulls { 5371 return false 5372 } 5373 if p.NumRows != other.NumRows { 5374 return false 5375 } 5376 if p.Encoding != other.Encoding { 5377 return false 5378 } 5379 if p.DefinitionLevelsByteLength != other.DefinitionLevelsByteLength { 5380 return false 5381 } 5382 if p.RepetitionLevelsByteLength != other.RepetitionLevelsByteLength { 5383 return false 5384 } 5385 if p.IsCompressed != other.IsCompressed { 5386 return false 5387 } 5388 if !p.Statistics.Equals(other.Statistics) { 5389 return false 5390 } 5391 return true 5392 } 5393 5394 func (p *DataPageHeaderV2) String() string { 5395 if p == nil { 5396 return "<nil>" 5397 } 5398 return fmt.Sprintf("DataPageHeaderV2(%+v)", *p) 5399 } 5400 5401 // Block-based algorithm type annotation. * 5402 type SplitBlockAlgorithm struct { 5403 } 5404 5405 func NewSplitBlockAlgorithm() *SplitBlockAlgorithm { 5406 return &SplitBlockAlgorithm{} 5407 } 5408 5409 func (p *SplitBlockAlgorithm) Read(ctx context.Context, iprot thrift.TProtocol) error { 5410 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5411 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5412 } 5413 5414 for { 5415 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5416 if err != nil { 5417 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5418 } 5419 if fieldTypeId == thrift.STOP { 5420 break 5421 } 5422 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5423 return err 5424 } 5425 if err := iprot.ReadFieldEnd(ctx); err != nil { 5426 return err 5427 } 5428 } 5429 if err := iprot.ReadStructEnd(ctx); err != nil { 5430 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5431 } 5432 return nil 5433 } 5434 5435 func (p *SplitBlockAlgorithm) Write(ctx context.Context, oprot thrift.TProtocol) error { 5436 if err := oprot.WriteStructBegin(ctx, "SplitBlockAlgorithm"); err != nil { 5437 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5438 } 5439 if p != nil { 5440 } 5441 if err := oprot.WriteFieldStop(ctx); err != nil { 5442 return thrift.PrependError("write field stop error: ", err) 5443 } 5444 if err := oprot.WriteStructEnd(ctx); err != nil { 5445 return thrift.PrependError("write struct stop error: ", err) 5446 } 5447 return nil 5448 } 5449 5450 func (p *SplitBlockAlgorithm) Equals(other *SplitBlockAlgorithm) bool { 5451 if p == other { 5452 return true 5453 } else if p == nil || other == nil { 5454 return false 5455 } 5456 return true 5457 } 5458 5459 func (p *SplitBlockAlgorithm) String() string { 5460 if p == nil { 5461 return "<nil>" 5462 } 5463 return fmt.Sprintf("SplitBlockAlgorithm(%+v)", *p) 5464 } 5465 5466 // The algorithm used in Bloom filter. * 5467 // 5468 // Attributes: 5469 // - BLOCK: Block-based Bloom filter. * 5470 type BloomFilterAlgorithm struct { 5471 BLOCK *SplitBlockAlgorithm `thrift:"BLOCK,1" db:"BLOCK" json:"BLOCK,omitempty"` 5472 } 5473 5474 func NewBloomFilterAlgorithm() *BloomFilterAlgorithm { 5475 return &BloomFilterAlgorithm{} 5476 } 5477 5478 var BloomFilterAlgorithm_BLOCK_DEFAULT *SplitBlockAlgorithm 5479 5480 func (p *BloomFilterAlgorithm) GetBLOCK() *SplitBlockAlgorithm { 5481 if !p.IsSetBLOCK() { 5482 return BloomFilterAlgorithm_BLOCK_DEFAULT 5483 } 5484 return p.BLOCK 5485 } 5486 func (p *BloomFilterAlgorithm) CountSetFieldsBloomFilterAlgorithm() int { 5487 count := 0 5488 if p.IsSetBLOCK() { 5489 count++ 5490 } 5491 return count 5492 5493 } 5494 5495 func (p *BloomFilterAlgorithm) IsSetBLOCK() bool { 5496 return p.BLOCK != nil 5497 } 5498 5499 func (p *BloomFilterAlgorithm) Read(ctx context.Context, iprot thrift.TProtocol) error { 5500 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5501 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5502 } 5503 5504 for { 5505 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5506 if err != nil { 5507 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5508 } 5509 if fieldTypeId == thrift.STOP { 5510 break 5511 } 5512 switch fieldId { 5513 case 1: 5514 if fieldTypeId == thrift.STRUCT { 5515 if err := p.ReadField1(ctx, iprot); err != nil { 5516 return err 5517 } 5518 } else { 5519 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5520 return err 5521 } 5522 } 5523 default: 5524 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5525 return err 5526 } 5527 } 5528 if err := iprot.ReadFieldEnd(ctx); err != nil { 5529 return err 5530 } 5531 } 5532 if err := iprot.ReadStructEnd(ctx); err != nil { 5533 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5534 } 5535 return nil 5536 } 5537 5538 func (p *BloomFilterAlgorithm) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 5539 p.BLOCK = &SplitBlockAlgorithm{} 5540 if err := p.BLOCK.Read(ctx, iprot); err != nil { 5541 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.BLOCK), err) 5542 } 5543 return nil 5544 } 5545 5546 func (p *BloomFilterAlgorithm) Write(ctx context.Context, oprot thrift.TProtocol) error { 5547 if c := p.CountSetFieldsBloomFilterAlgorithm(); c != 1 { 5548 return fmt.Errorf("%T write union: exactly one field must be set (%d set)", p, c) 5549 } 5550 if err := oprot.WriteStructBegin(ctx, "BloomFilterAlgorithm"); err != nil { 5551 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5552 } 5553 if p != nil { 5554 if err := p.writeField1(ctx, oprot); err != nil { 5555 return err 5556 } 5557 } 5558 if err := oprot.WriteFieldStop(ctx); err != nil { 5559 return thrift.PrependError("write field stop error: ", err) 5560 } 5561 if err := oprot.WriteStructEnd(ctx); err != nil { 5562 return thrift.PrependError("write struct stop error: ", err) 5563 } 5564 return nil 5565 } 5566 5567 func (p *BloomFilterAlgorithm) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 5568 if p.IsSetBLOCK() { 5569 if err := oprot.WriteFieldBegin(ctx, "BLOCK", thrift.STRUCT, 1); err != nil { 5570 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:BLOCK: ", p), err) 5571 } 5572 if err := p.BLOCK.Write(ctx, oprot); err != nil { 5573 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.BLOCK), err) 5574 } 5575 if err := oprot.WriteFieldEnd(ctx); err != nil { 5576 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:BLOCK: ", p), err) 5577 } 5578 } 5579 return err 5580 } 5581 5582 func (p *BloomFilterAlgorithm) Equals(other *BloomFilterAlgorithm) bool { 5583 if p == other { 5584 return true 5585 } else if p == nil || other == nil { 5586 return false 5587 } 5588 if !p.BLOCK.Equals(other.BLOCK) { 5589 return false 5590 } 5591 return true 5592 } 5593 5594 func (p *BloomFilterAlgorithm) String() string { 5595 if p == nil { 5596 return "<nil>" 5597 } 5598 return fmt.Sprintf("BloomFilterAlgorithm(%+v)", *p) 5599 } 5600 5601 // Hash strategy type annotation. xxHash is an extremely fast non-cryptographic hash 5602 // algorithm. It uses 64 bits version of xxHash. 5603 // 5604 type XxHash struct { 5605 } 5606 5607 func NewXxHash() *XxHash { 5608 return &XxHash{} 5609 } 5610 5611 func (p *XxHash) Read(ctx context.Context, iprot thrift.TProtocol) error { 5612 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5613 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5614 } 5615 5616 for { 5617 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5618 if err != nil { 5619 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5620 } 5621 if fieldTypeId == thrift.STOP { 5622 break 5623 } 5624 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5625 return err 5626 } 5627 if err := iprot.ReadFieldEnd(ctx); err != nil { 5628 return err 5629 } 5630 } 5631 if err := iprot.ReadStructEnd(ctx); err != nil { 5632 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5633 } 5634 return nil 5635 } 5636 5637 func (p *XxHash) Write(ctx context.Context, oprot thrift.TProtocol) error { 5638 if err := oprot.WriteStructBegin(ctx, "XxHash"); err != nil { 5639 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5640 } 5641 if p != nil { 5642 } 5643 if err := oprot.WriteFieldStop(ctx); err != nil { 5644 return thrift.PrependError("write field stop error: ", err) 5645 } 5646 if err := oprot.WriteStructEnd(ctx); err != nil { 5647 return thrift.PrependError("write struct stop error: ", err) 5648 } 5649 return nil 5650 } 5651 5652 func (p *XxHash) Equals(other *XxHash) bool { 5653 if p == other { 5654 return true 5655 } else if p == nil || other == nil { 5656 return false 5657 } 5658 return true 5659 } 5660 5661 func (p *XxHash) String() string { 5662 if p == nil { 5663 return "<nil>" 5664 } 5665 return fmt.Sprintf("XxHash(%+v)", *p) 5666 } 5667 5668 // The hash function used in Bloom filter. This function takes the hash of a column value 5669 // using plain encoding. 5670 // 5671 // 5672 // Attributes: 5673 // - XXHASH: xxHash Strategy. * 5674 type BloomFilterHash struct { 5675 XXHASH *XxHash `thrift:"XXHASH,1" db:"XXHASH" json:"XXHASH,omitempty"` 5676 } 5677 5678 func NewBloomFilterHash() *BloomFilterHash { 5679 return &BloomFilterHash{} 5680 } 5681 5682 var BloomFilterHash_XXHASH_DEFAULT *XxHash 5683 5684 func (p *BloomFilterHash) GetXXHASH() *XxHash { 5685 if !p.IsSetXXHASH() { 5686 return BloomFilterHash_XXHASH_DEFAULT 5687 } 5688 return p.XXHASH 5689 } 5690 func (p *BloomFilterHash) CountSetFieldsBloomFilterHash() int { 5691 count := 0 5692 if p.IsSetXXHASH() { 5693 count++ 5694 } 5695 return count 5696 5697 } 5698 5699 func (p *BloomFilterHash) IsSetXXHASH() bool { 5700 return p.XXHASH != nil 5701 } 5702 5703 func (p *BloomFilterHash) Read(ctx context.Context, iprot thrift.TProtocol) error { 5704 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5705 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5706 } 5707 5708 for { 5709 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5710 if err != nil { 5711 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5712 } 5713 if fieldTypeId == thrift.STOP { 5714 break 5715 } 5716 switch fieldId { 5717 case 1: 5718 if fieldTypeId == thrift.STRUCT { 5719 if err := p.ReadField1(ctx, iprot); err != nil { 5720 return err 5721 } 5722 } else { 5723 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5724 return err 5725 } 5726 } 5727 default: 5728 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5729 return err 5730 } 5731 } 5732 if err := iprot.ReadFieldEnd(ctx); err != nil { 5733 return err 5734 } 5735 } 5736 if err := iprot.ReadStructEnd(ctx); err != nil { 5737 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5738 } 5739 return nil 5740 } 5741 5742 func (p *BloomFilterHash) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 5743 p.XXHASH = &XxHash{} 5744 if err := p.XXHASH.Read(ctx, iprot); err != nil { 5745 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.XXHASH), err) 5746 } 5747 return nil 5748 } 5749 5750 func (p *BloomFilterHash) Write(ctx context.Context, oprot thrift.TProtocol) error { 5751 if c := p.CountSetFieldsBloomFilterHash(); c != 1 { 5752 return fmt.Errorf("%T write union: exactly one field must be set (%d set)", p, c) 5753 } 5754 if err := oprot.WriteStructBegin(ctx, "BloomFilterHash"); err != nil { 5755 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5756 } 5757 if p != nil { 5758 if err := p.writeField1(ctx, oprot); err != nil { 5759 return err 5760 } 5761 } 5762 if err := oprot.WriteFieldStop(ctx); err != nil { 5763 return thrift.PrependError("write field stop error: ", err) 5764 } 5765 if err := oprot.WriteStructEnd(ctx); err != nil { 5766 return thrift.PrependError("write struct stop error: ", err) 5767 } 5768 return nil 5769 } 5770 5771 func (p *BloomFilterHash) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 5772 if p.IsSetXXHASH() { 5773 if err := oprot.WriteFieldBegin(ctx, "XXHASH", thrift.STRUCT, 1); err != nil { 5774 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:XXHASH: ", p), err) 5775 } 5776 if err := p.XXHASH.Write(ctx, oprot); err != nil { 5777 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.XXHASH), err) 5778 } 5779 if err := oprot.WriteFieldEnd(ctx); err != nil { 5780 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:XXHASH: ", p), err) 5781 } 5782 } 5783 return err 5784 } 5785 5786 func (p *BloomFilterHash) Equals(other *BloomFilterHash) bool { 5787 if p == other { 5788 return true 5789 } else if p == nil || other == nil { 5790 return false 5791 } 5792 if !p.XXHASH.Equals(other.XXHASH) { 5793 return false 5794 } 5795 return true 5796 } 5797 5798 func (p *BloomFilterHash) String() string { 5799 if p == nil { 5800 return "<nil>" 5801 } 5802 return fmt.Sprintf("BloomFilterHash(%+v)", *p) 5803 } 5804 5805 // The compression used in the Bloom filter. 5806 // 5807 type Uncompressed struct { 5808 } 5809 5810 func NewUncompressed() *Uncompressed { 5811 return &Uncompressed{} 5812 } 5813 5814 func (p *Uncompressed) Read(ctx context.Context, iprot thrift.TProtocol) error { 5815 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5816 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5817 } 5818 5819 for { 5820 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5821 if err != nil { 5822 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5823 } 5824 if fieldTypeId == thrift.STOP { 5825 break 5826 } 5827 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5828 return err 5829 } 5830 if err := iprot.ReadFieldEnd(ctx); err != nil { 5831 return err 5832 } 5833 } 5834 if err := iprot.ReadStructEnd(ctx); err != nil { 5835 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5836 } 5837 return nil 5838 } 5839 5840 func (p *Uncompressed) Write(ctx context.Context, oprot thrift.TProtocol) error { 5841 if err := oprot.WriteStructBegin(ctx, "Uncompressed"); err != nil { 5842 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5843 } 5844 if p != nil { 5845 } 5846 if err := oprot.WriteFieldStop(ctx); err != nil { 5847 return thrift.PrependError("write field stop error: ", err) 5848 } 5849 if err := oprot.WriteStructEnd(ctx); err != nil { 5850 return thrift.PrependError("write struct stop error: ", err) 5851 } 5852 return nil 5853 } 5854 5855 func (p *Uncompressed) Equals(other *Uncompressed) bool { 5856 if p == other { 5857 return true 5858 } else if p == nil || other == nil { 5859 return false 5860 } 5861 return true 5862 } 5863 5864 func (p *Uncompressed) String() string { 5865 if p == nil { 5866 return "<nil>" 5867 } 5868 return fmt.Sprintf("Uncompressed(%+v)", *p) 5869 } 5870 5871 // Attributes: 5872 // - UNCOMPRESSED 5873 type BloomFilterCompression struct { 5874 UNCOMPRESSED *Uncompressed `thrift:"UNCOMPRESSED,1" db:"UNCOMPRESSED" json:"UNCOMPRESSED,omitempty"` 5875 } 5876 5877 func NewBloomFilterCompression() *BloomFilterCompression { 5878 return &BloomFilterCompression{} 5879 } 5880 5881 var BloomFilterCompression_UNCOMPRESSED_DEFAULT *Uncompressed 5882 5883 func (p *BloomFilterCompression) GetUNCOMPRESSED() *Uncompressed { 5884 if !p.IsSetUNCOMPRESSED() { 5885 return BloomFilterCompression_UNCOMPRESSED_DEFAULT 5886 } 5887 return p.UNCOMPRESSED 5888 } 5889 func (p *BloomFilterCompression) CountSetFieldsBloomFilterCompression() int { 5890 count := 0 5891 if p.IsSetUNCOMPRESSED() { 5892 count++ 5893 } 5894 return count 5895 5896 } 5897 5898 func (p *BloomFilterCompression) IsSetUNCOMPRESSED() bool { 5899 return p.UNCOMPRESSED != nil 5900 } 5901 5902 func (p *BloomFilterCompression) Read(ctx context.Context, iprot thrift.TProtocol) error { 5903 if _, err := iprot.ReadStructBegin(ctx); err != nil { 5904 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 5905 } 5906 5907 for { 5908 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 5909 if err != nil { 5910 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 5911 } 5912 if fieldTypeId == thrift.STOP { 5913 break 5914 } 5915 switch fieldId { 5916 case 1: 5917 if fieldTypeId == thrift.STRUCT { 5918 if err := p.ReadField1(ctx, iprot); err != nil { 5919 return err 5920 } 5921 } else { 5922 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5923 return err 5924 } 5925 } 5926 default: 5927 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 5928 return err 5929 } 5930 } 5931 if err := iprot.ReadFieldEnd(ctx); err != nil { 5932 return err 5933 } 5934 } 5935 if err := iprot.ReadStructEnd(ctx); err != nil { 5936 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5937 } 5938 return nil 5939 } 5940 5941 func (p *BloomFilterCompression) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 5942 p.UNCOMPRESSED = &Uncompressed{} 5943 if err := p.UNCOMPRESSED.Read(ctx, iprot); err != nil { 5944 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.UNCOMPRESSED), err) 5945 } 5946 return nil 5947 } 5948 5949 func (p *BloomFilterCompression) Write(ctx context.Context, oprot thrift.TProtocol) error { 5950 if c := p.CountSetFieldsBloomFilterCompression(); c != 1 { 5951 return fmt.Errorf("%T write union: exactly one field must be set (%d set)", p, c) 5952 } 5953 if err := oprot.WriteStructBegin(ctx, "BloomFilterCompression"); err != nil { 5954 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5955 } 5956 if p != nil { 5957 if err := p.writeField1(ctx, oprot); err != nil { 5958 return err 5959 } 5960 } 5961 if err := oprot.WriteFieldStop(ctx); err != nil { 5962 return thrift.PrependError("write field stop error: ", err) 5963 } 5964 if err := oprot.WriteStructEnd(ctx); err != nil { 5965 return thrift.PrependError("write struct stop error: ", err) 5966 } 5967 return nil 5968 } 5969 5970 func (p *BloomFilterCompression) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 5971 if p.IsSetUNCOMPRESSED() { 5972 if err := oprot.WriteFieldBegin(ctx, "UNCOMPRESSED", thrift.STRUCT, 1); err != nil { 5973 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:UNCOMPRESSED: ", p), err) 5974 } 5975 if err := p.UNCOMPRESSED.Write(ctx, oprot); err != nil { 5976 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.UNCOMPRESSED), err) 5977 } 5978 if err := oprot.WriteFieldEnd(ctx); err != nil { 5979 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:UNCOMPRESSED: ", p), err) 5980 } 5981 } 5982 return err 5983 } 5984 5985 func (p *BloomFilterCompression) Equals(other *BloomFilterCompression) bool { 5986 if p == other { 5987 return true 5988 } else if p == nil || other == nil { 5989 return false 5990 } 5991 if !p.UNCOMPRESSED.Equals(other.UNCOMPRESSED) { 5992 return false 5993 } 5994 return true 5995 } 5996 5997 func (p *BloomFilterCompression) String() string { 5998 if p == nil { 5999 return "<nil>" 6000 } 6001 return fmt.Sprintf("BloomFilterCompression(%+v)", *p) 6002 } 6003 6004 // Bloom filter header is stored at beginning of Bloom filter data of each column 6005 // and followed by its bitset. 6006 // 6007 // 6008 // Attributes: 6009 // - NumBytes: The size of bitset in bytes * 6010 // - Algorithm: The algorithm for setting bits. * 6011 // - Hash: The hash function used for Bloom filter. * 6012 // - Compression: The compression used in the Bloom filter * 6013 type BloomFilterHeader struct { 6014 NumBytes int32 `thrift:"numBytes,1,required" db:"numBytes" json:"numBytes"` 6015 Algorithm *BloomFilterAlgorithm `thrift:"algorithm,2,required" db:"algorithm" json:"algorithm"` 6016 Hash *BloomFilterHash `thrift:"hash,3,required" db:"hash" json:"hash"` 6017 Compression *BloomFilterCompression `thrift:"compression,4,required" db:"compression" json:"compression"` 6018 } 6019 6020 func NewBloomFilterHeader() *BloomFilterHeader { 6021 return &BloomFilterHeader{} 6022 } 6023 6024 func (p *BloomFilterHeader) GetNumBytes() int32 { 6025 return p.NumBytes 6026 } 6027 6028 var BloomFilterHeader_Algorithm_DEFAULT *BloomFilterAlgorithm 6029 6030 func (p *BloomFilterHeader) GetAlgorithm() *BloomFilterAlgorithm { 6031 if !p.IsSetAlgorithm() { 6032 return BloomFilterHeader_Algorithm_DEFAULT 6033 } 6034 return p.Algorithm 6035 } 6036 6037 var BloomFilterHeader_Hash_DEFAULT *BloomFilterHash 6038 6039 func (p *BloomFilterHeader) GetHash() *BloomFilterHash { 6040 if !p.IsSetHash() { 6041 return BloomFilterHeader_Hash_DEFAULT 6042 } 6043 return p.Hash 6044 } 6045 6046 var BloomFilterHeader_Compression_DEFAULT *BloomFilterCompression 6047 6048 func (p *BloomFilterHeader) GetCompression() *BloomFilterCompression { 6049 if !p.IsSetCompression() { 6050 return BloomFilterHeader_Compression_DEFAULT 6051 } 6052 return p.Compression 6053 } 6054 func (p *BloomFilterHeader) IsSetAlgorithm() bool { 6055 return p.Algorithm != nil 6056 } 6057 6058 func (p *BloomFilterHeader) IsSetHash() bool { 6059 return p.Hash != nil 6060 } 6061 6062 func (p *BloomFilterHeader) IsSetCompression() bool { 6063 return p.Compression != nil 6064 } 6065 6066 func (p *BloomFilterHeader) Read(ctx context.Context, iprot thrift.TProtocol) error { 6067 if _, err := iprot.ReadStructBegin(ctx); err != nil { 6068 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 6069 } 6070 6071 var issetNumBytes bool = false 6072 var issetAlgorithm bool = false 6073 var issetHash bool = false 6074 var issetCompression bool = false 6075 6076 for { 6077 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 6078 if err != nil { 6079 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 6080 } 6081 if fieldTypeId == thrift.STOP { 6082 break 6083 } 6084 switch fieldId { 6085 case 1: 6086 if fieldTypeId == thrift.I32 { 6087 if err := p.ReadField1(ctx, iprot); err != nil { 6088 return err 6089 } 6090 issetNumBytes = true 6091 } else { 6092 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6093 return err 6094 } 6095 } 6096 case 2: 6097 if fieldTypeId == thrift.STRUCT { 6098 if err := p.ReadField2(ctx, iprot); err != nil { 6099 return err 6100 } 6101 issetAlgorithm = true 6102 } else { 6103 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6104 return err 6105 } 6106 } 6107 case 3: 6108 if fieldTypeId == thrift.STRUCT { 6109 if err := p.ReadField3(ctx, iprot); err != nil { 6110 return err 6111 } 6112 issetHash = true 6113 } else { 6114 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6115 return err 6116 } 6117 } 6118 case 4: 6119 if fieldTypeId == thrift.STRUCT { 6120 if err := p.ReadField4(ctx, iprot); err != nil { 6121 return err 6122 } 6123 issetCompression = true 6124 } else { 6125 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6126 return err 6127 } 6128 } 6129 default: 6130 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6131 return err 6132 } 6133 } 6134 if err := iprot.ReadFieldEnd(ctx); err != nil { 6135 return err 6136 } 6137 } 6138 if err := iprot.ReadStructEnd(ctx); err != nil { 6139 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 6140 } 6141 if !issetNumBytes { 6142 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumBytes is not set")) 6143 } 6144 if !issetAlgorithm { 6145 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Algorithm is not set")) 6146 } 6147 if !issetHash { 6148 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Hash is not set")) 6149 } 6150 if !issetCompression { 6151 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Compression is not set")) 6152 } 6153 return nil 6154 } 6155 6156 func (p *BloomFilterHeader) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 6157 if v, err := iprot.ReadI32(ctx); err != nil { 6158 return thrift.PrependError("error reading field 1: ", err) 6159 } else { 6160 p.NumBytes = v 6161 } 6162 return nil 6163 } 6164 6165 func (p *BloomFilterHeader) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 6166 p.Algorithm = &BloomFilterAlgorithm{} 6167 if err := p.Algorithm.Read(ctx, iprot); err != nil { 6168 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Algorithm), err) 6169 } 6170 return nil 6171 } 6172 6173 func (p *BloomFilterHeader) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 6174 p.Hash = &BloomFilterHash{} 6175 if err := p.Hash.Read(ctx, iprot); err != nil { 6176 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Hash), err) 6177 } 6178 return nil 6179 } 6180 6181 func (p *BloomFilterHeader) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 6182 p.Compression = &BloomFilterCompression{} 6183 if err := p.Compression.Read(ctx, iprot); err != nil { 6184 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Compression), err) 6185 } 6186 return nil 6187 } 6188 6189 func (p *BloomFilterHeader) Write(ctx context.Context, oprot thrift.TProtocol) error { 6190 if err := oprot.WriteStructBegin(ctx, "BloomFilterHeader"); err != nil { 6191 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 6192 } 6193 if p != nil { 6194 if err := p.writeField1(ctx, oprot); err != nil { 6195 return err 6196 } 6197 if err := p.writeField2(ctx, oprot); err != nil { 6198 return err 6199 } 6200 if err := p.writeField3(ctx, oprot); err != nil { 6201 return err 6202 } 6203 if err := p.writeField4(ctx, oprot); err != nil { 6204 return err 6205 } 6206 } 6207 if err := oprot.WriteFieldStop(ctx); err != nil { 6208 return thrift.PrependError("write field stop error: ", err) 6209 } 6210 if err := oprot.WriteStructEnd(ctx); err != nil { 6211 return thrift.PrependError("write struct stop error: ", err) 6212 } 6213 return nil 6214 } 6215 6216 func (p *BloomFilterHeader) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 6217 if err := oprot.WriteFieldBegin(ctx, "numBytes", thrift.I32, 1); err != nil { 6218 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:numBytes: ", p), err) 6219 } 6220 if err := oprot.WriteI32(ctx, int32(p.NumBytes)); err != nil { 6221 return thrift.PrependError(fmt.Sprintf("%T.numBytes (1) field write error: ", p), err) 6222 } 6223 if err := oprot.WriteFieldEnd(ctx); err != nil { 6224 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:numBytes: ", p), err) 6225 } 6226 return err 6227 } 6228 6229 func (p *BloomFilterHeader) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 6230 if err := oprot.WriteFieldBegin(ctx, "algorithm", thrift.STRUCT, 2); err != nil { 6231 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:algorithm: ", p), err) 6232 } 6233 if err := p.Algorithm.Write(ctx, oprot); err != nil { 6234 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Algorithm), err) 6235 } 6236 if err := oprot.WriteFieldEnd(ctx); err != nil { 6237 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:algorithm: ", p), err) 6238 } 6239 return err 6240 } 6241 6242 func (p *BloomFilterHeader) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 6243 if err := oprot.WriteFieldBegin(ctx, "hash", thrift.STRUCT, 3); err != nil { 6244 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:hash: ", p), err) 6245 } 6246 if err := p.Hash.Write(ctx, oprot); err != nil { 6247 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Hash), err) 6248 } 6249 if err := oprot.WriteFieldEnd(ctx); err != nil { 6250 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:hash: ", p), err) 6251 } 6252 return err 6253 } 6254 6255 func (p *BloomFilterHeader) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 6256 if err := oprot.WriteFieldBegin(ctx, "compression", thrift.STRUCT, 4); err != nil { 6257 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:compression: ", p), err) 6258 } 6259 if err := p.Compression.Write(ctx, oprot); err != nil { 6260 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Compression), err) 6261 } 6262 if err := oprot.WriteFieldEnd(ctx); err != nil { 6263 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:compression: ", p), err) 6264 } 6265 return err 6266 } 6267 6268 func (p *BloomFilterHeader) Equals(other *BloomFilterHeader) bool { 6269 if p == other { 6270 return true 6271 } else if p == nil || other == nil { 6272 return false 6273 } 6274 if p.NumBytes != other.NumBytes { 6275 return false 6276 } 6277 if !p.Algorithm.Equals(other.Algorithm) { 6278 return false 6279 } 6280 if !p.Hash.Equals(other.Hash) { 6281 return false 6282 } 6283 if !p.Compression.Equals(other.Compression) { 6284 return false 6285 } 6286 return true 6287 } 6288 6289 func (p *BloomFilterHeader) String() string { 6290 if p == nil { 6291 return "<nil>" 6292 } 6293 return fmt.Sprintf("BloomFilterHeader(%+v)", *p) 6294 } 6295 6296 // Attributes: 6297 // - Type: the type of the page: indicates which of the *_header fields is set * 6298 // - UncompressedPageSize: Uncompressed page size in bytes (not including this header) * 6299 // - CompressedPageSize: Compressed (and potentially encrypted) page size in bytes, not including this header * 6300 // - Crc: The 32bit CRC for the page, to be be calculated as follows: 6301 // - Using the standard CRC32 algorithm 6302 // - On the data only, i.e. this header should not be included. 'Data' 6303 // hereby refers to the concatenation of the repetition levels, the 6304 // definition levels and the column value, in this exact order. 6305 // - On the encoded versions of the repetition levels, definition levels and 6306 // column values 6307 // - On the compressed versions of the repetition levels, definition levels 6308 // and column values where possible; 6309 // - For v1 data pages, the repetition levels, definition levels and column 6310 // values are always compressed together. If a compression scheme is 6311 // specified, the CRC shall be calculated on the compressed version of 6312 // this concatenation. If no compression scheme is specified, the CRC 6313 // shall be calculated on the uncompressed version of this concatenation. 6314 // - For v2 data pages, the repetition levels and definition levels are 6315 // handled separately from the data and are never compressed (only 6316 // encoded). If a compression scheme is specified, the CRC shall be 6317 // calculated on the concatenation of the uncompressed repetition levels, 6318 // uncompressed definition levels and the compressed column values. 6319 // If no compression scheme is specified, the CRC shall be calculated on 6320 // the uncompressed concatenation. 6321 // - In encrypted columns, CRC is calculated after page encryption; the 6322 // encryption itself is performed after page compression (if compressed) 6323 // If enabled, this allows for disabling checksumming in HDFS if only a few 6324 // pages need to be read. 6325 // 6326 // - DataPageHeader 6327 // - IndexPageHeader 6328 // - DictionaryPageHeader 6329 // - DataPageHeaderV2 6330 type PageHeader struct { 6331 Type PageType `thrift:"type,1,required" db:"type" json:"type"` 6332 UncompressedPageSize int32 `thrift:"uncompressed_page_size,2,required" db:"uncompressed_page_size" json:"uncompressed_page_size"` 6333 CompressedPageSize int32 `thrift:"compressed_page_size,3,required" db:"compressed_page_size" json:"compressed_page_size"` 6334 Crc *int32 `thrift:"crc,4" db:"crc" json:"crc,omitempty"` 6335 DataPageHeader *DataPageHeader `thrift:"data_page_header,5" db:"data_page_header" json:"data_page_header,omitempty"` 6336 IndexPageHeader *IndexPageHeader `thrift:"index_page_header,6" db:"index_page_header" json:"index_page_header,omitempty"` 6337 DictionaryPageHeader *DictionaryPageHeader `thrift:"dictionary_page_header,7" db:"dictionary_page_header" json:"dictionary_page_header,omitempty"` 6338 DataPageHeaderV2 *DataPageHeaderV2 `thrift:"data_page_header_v2,8" db:"data_page_header_v2" json:"data_page_header_v2,omitempty"` 6339 } 6340 6341 func NewPageHeader() *PageHeader { 6342 return &PageHeader{} 6343 } 6344 6345 func (p *PageHeader) GetType() PageType { 6346 return p.Type 6347 } 6348 6349 func (p *PageHeader) GetUncompressedPageSize() int32 { 6350 return p.UncompressedPageSize 6351 } 6352 6353 func (p *PageHeader) GetCompressedPageSize() int32 { 6354 return p.CompressedPageSize 6355 } 6356 6357 var PageHeader_Crc_DEFAULT int32 6358 6359 func (p *PageHeader) GetCrc() int32 { 6360 if !p.IsSetCrc() { 6361 return PageHeader_Crc_DEFAULT 6362 } 6363 return *p.Crc 6364 } 6365 6366 var PageHeader_DataPageHeader_DEFAULT *DataPageHeader 6367 6368 func (p *PageHeader) GetDataPageHeader() *DataPageHeader { 6369 if !p.IsSetDataPageHeader() { 6370 return PageHeader_DataPageHeader_DEFAULT 6371 } 6372 return p.DataPageHeader 6373 } 6374 6375 var PageHeader_IndexPageHeader_DEFAULT *IndexPageHeader 6376 6377 func (p *PageHeader) GetIndexPageHeader() *IndexPageHeader { 6378 if !p.IsSetIndexPageHeader() { 6379 return PageHeader_IndexPageHeader_DEFAULT 6380 } 6381 return p.IndexPageHeader 6382 } 6383 6384 var PageHeader_DictionaryPageHeader_DEFAULT *DictionaryPageHeader 6385 6386 func (p *PageHeader) GetDictionaryPageHeader() *DictionaryPageHeader { 6387 if !p.IsSetDictionaryPageHeader() { 6388 return PageHeader_DictionaryPageHeader_DEFAULT 6389 } 6390 return p.DictionaryPageHeader 6391 } 6392 6393 var PageHeader_DataPageHeaderV2_DEFAULT *DataPageHeaderV2 6394 6395 func (p *PageHeader) GetDataPageHeaderV2() *DataPageHeaderV2 { 6396 if !p.IsSetDataPageHeaderV2() { 6397 return PageHeader_DataPageHeaderV2_DEFAULT 6398 } 6399 return p.DataPageHeaderV2 6400 } 6401 func (p *PageHeader) IsSetCrc() bool { 6402 return p.Crc != nil 6403 } 6404 6405 func (p *PageHeader) IsSetDataPageHeader() bool { 6406 return p.DataPageHeader != nil 6407 } 6408 6409 func (p *PageHeader) IsSetIndexPageHeader() bool { 6410 return p.IndexPageHeader != nil 6411 } 6412 6413 func (p *PageHeader) IsSetDictionaryPageHeader() bool { 6414 return p.DictionaryPageHeader != nil 6415 } 6416 6417 func (p *PageHeader) IsSetDataPageHeaderV2() bool { 6418 return p.DataPageHeaderV2 != nil 6419 } 6420 6421 func (p *PageHeader) Read(ctx context.Context, iprot thrift.TProtocol) error { 6422 if _, err := iprot.ReadStructBegin(ctx); err != nil { 6423 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 6424 } 6425 6426 var issetType bool = false 6427 var issetUncompressedPageSize bool = false 6428 var issetCompressedPageSize bool = false 6429 6430 for { 6431 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 6432 if err != nil { 6433 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 6434 } 6435 if fieldTypeId == thrift.STOP { 6436 break 6437 } 6438 switch fieldId { 6439 case 1: 6440 if fieldTypeId == thrift.I32 { 6441 if err := p.ReadField1(ctx, iprot); err != nil { 6442 return err 6443 } 6444 issetType = true 6445 } else { 6446 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6447 return err 6448 } 6449 } 6450 case 2: 6451 if fieldTypeId == thrift.I32 { 6452 if err := p.ReadField2(ctx, iprot); err != nil { 6453 return err 6454 } 6455 issetUncompressedPageSize = true 6456 } else { 6457 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6458 return err 6459 } 6460 } 6461 case 3: 6462 if fieldTypeId == thrift.I32 { 6463 if err := p.ReadField3(ctx, iprot); err != nil { 6464 return err 6465 } 6466 issetCompressedPageSize = true 6467 } else { 6468 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6469 return err 6470 } 6471 } 6472 case 4: 6473 if fieldTypeId == thrift.I32 { 6474 if err := p.ReadField4(ctx, iprot); err != nil { 6475 return err 6476 } 6477 } else { 6478 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6479 return err 6480 } 6481 } 6482 case 5: 6483 if fieldTypeId == thrift.STRUCT { 6484 if err := p.ReadField5(ctx, iprot); err != nil { 6485 return err 6486 } 6487 } else { 6488 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6489 return err 6490 } 6491 } 6492 case 6: 6493 if fieldTypeId == thrift.STRUCT { 6494 if err := p.ReadField6(ctx, iprot); err != nil { 6495 return err 6496 } 6497 } else { 6498 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6499 return err 6500 } 6501 } 6502 case 7: 6503 if fieldTypeId == thrift.STRUCT { 6504 if err := p.ReadField7(ctx, iprot); err != nil { 6505 return err 6506 } 6507 } else { 6508 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6509 return err 6510 } 6511 } 6512 case 8: 6513 if fieldTypeId == thrift.STRUCT { 6514 if err := p.ReadField8(ctx, iprot); err != nil { 6515 return err 6516 } 6517 } else { 6518 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6519 return err 6520 } 6521 } 6522 default: 6523 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6524 return err 6525 } 6526 } 6527 if err := iprot.ReadFieldEnd(ctx); err != nil { 6528 return err 6529 } 6530 } 6531 if err := iprot.ReadStructEnd(ctx); err != nil { 6532 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 6533 } 6534 if !issetType { 6535 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")) 6536 } 6537 if !issetUncompressedPageSize { 6538 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field UncompressedPageSize is not set")) 6539 } 6540 if !issetCompressedPageSize { 6541 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field CompressedPageSize is not set")) 6542 } 6543 return nil 6544 } 6545 6546 func (p *PageHeader) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 6547 if v, err := iprot.ReadI32(ctx); err != nil { 6548 return thrift.PrependError("error reading field 1: ", err) 6549 } else { 6550 temp := PageType(v) 6551 p.Type = temp 6552 } 6553 return nil 6554 } 6555 6556 func (p *PageHeader) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 6557 if v, err := iprot.ReadI32(ctx); err != nil { 6558 return thrift.PrependError("error reading field 2: ", err) 6559 } else { 6560 p.UncompressedPageSize = v 6561 } 6562 return nil 6563 } 6564 6565 func (p *PageHeader) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 6566 if v, err := iprot.ReadI32(ctx); err != nil { 6567 return thrift.PrependError("error reading field 3: ", err) 6568 } else { 6569 p.CompressedPageSize = v 6570 } 6571 return nil 6572 } 6573 6574 func (p *PageHeader) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 6575 if v, err := iprot.ReadI32(ctx); err != nil { 6576 return thrift.PrependError("error reading field 4: ", err) 6577 } else { 6578 p.Crc = &v 6579 } 6580 return nil 6581 } 6582 6583 func (p *PageHeader) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 6584 p.DataPageHeader = &DataPageHeader{} 6585 if err := p.DataPageHeader.Read(ctx, iprot); err != nil { 6586 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DataPageHeader), err) 6587 } 6588 return nil 6589 } 6590 6591 func (p *PageHeader) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 6592 p.IndexPageHeader = &IndexPageHeader{} 6593 if err := p.IndexPageHeader.Read(ctx, iprot); err != nil { 6594 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.IndexPageHeader), err) 6595 } 6596 return nil 6597 } 6598 6599 func (p *PageHeader) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 6600 p.DictionaryPageHeader = &DictionaryPageHeader{} 6601 if err := p.DictionaryPageHeader.Read(ctx, iprot); err != nil { 6602 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DictionaryPageHeader), err) 6603 } 6604 return nil 6605 } 6606 6607 func (p *PageHeader) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 6608 p.DataPageHeaderV2 = &DataPageHeaderV2{ 6609 IsCompressed: true, 6610 } 6611 if err := p.DataPageHeaderV2.Read(ctx, iprot); err != nil { 6612 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.DataPageHeaderV2), err) 6613 } 6614 return nil 6615 } 6616 6617 func (p *PageHeader) Write(ctx context.Context, oprot thrift.TProtocol) error { 6618 if err := oprot.WriteStructBegin(ctx, "PageHeader"); err != nil { 6619 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 6620 } 6621 if p != nil { 6622 if err := p.writeField1(ctx, oprot); err != nil { 6623 return err 6624 } 6625 if err := p.writeField2(ctx, oprot); err != nil { 6626 return err 6627 } 6628 if err := p.writeField3(ctx, oprot); err != nil { 6629 return err 6630 } 6631 if err := p.writeField4(ctx, oprot); err != nil { 6632 return err 6633 } 6634 if err := p.writeField5(ctx, oprot); err != nil { 6635 return err 6636 } 6637 if err := p.writeField6(ctx, oprot); err != nil { 6638 return err 6639 } 6640 if err := p.writeField7(ctx, oprot); err != nil { 6641 return err 6642 } 6643 if err := p.writeField8(ctx, oprot); err != nil { 6644 return err 6645 } 6646 } 6647 if err := oprot.WriteFieldStop(ctx); err != nil { 6648 return thrift.PrependError("write field stop error: ", err) 6649 } 6650 if err := oprot.WriteStructEnd(ctx); err != nil { 6651 return thrift.PrependError("write struct stop error: ", err) 6652 } 6653 return nil 6654 } 6655 6656 func (p *PageHeader) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 6657 if err := oprot.WriteFieldBegin(ctx, "type", thrift.I32, 1); err != nil { 6658 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:type: ", p), err) 6659 } 6660 if err := oprot.WriteI32(ctx, int32(p.Type)); err != nil { 6661 return thrift.PrependError(fmt.Sprintf("%T.type (1) field write error: ", p), err) 6662 } 6663 if err := oprot.WriteFieldEnd(ctx); err != nil { 6664 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:type: ", p), err) 6665 } 6666 return err 6667 } 6668 6669 func (p *PageHeader) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 6670 if err := oprot.WriteFieldBegin(ctx, "uncompressed_page_size", thrift.I32, 2); err != nil { 6671 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:uncompressed_page_size: ", p), err) 6672 } 6673 if err := oprot.WriteI32(ctx, int32(p.UncompressedPageSize)); err != nil { 6674 return thrift.PrependError(fmt.Sprintf("%T.uncompressed_page_size (2) field write error: ", p), err) 6675 } 6676 if err := oprot.WriteFieldEnd(ctx); err != nil { 6677 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:uncompressed_page_size: ", p), err) 6678 } 6679 return err 6680 } 6681 6682 func (p *PageHeader) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 6683 if err := oprot.WriteFieldBegin(ctx, "compressed_page_size", thrift.I32, 3); err != nil { 6684 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:compressed_page_size: ", p), err) 6685 } 6686 if err := oprot.WriteI32(ctx, int32(p.CompressedPageSize)); err != nil { 6687 return thrift.PrependError(fmt.Sprintf("%T.compressed_page_size (3) field write error: ", p), err) 6688 } 6689 if err := oprot.WriteFieldEnd(ctx); err != nil { 6690 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:compressed_page_size: ", p), err) 6691 } 6692 return err 6693 } 6694 6695 func (p *PageHeader) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 6696 if p.IsSetCrc() { 6697 if err := oprot.WriteFieldBegin(ctx, "crc", thrift.I32, 4); err != nil { 6698 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:crc: ", p), err) 6699 } 6700 if err := oprot.WriteI32(ctx, int32(*p.Crc)); err != nil { 6701 return thrift.PrependError(fmt.Sprintf("%T.crc (4) field write error: ", p), err) 6702 } 6703 if err := oprot.WriteFieldEnd(ctx); err != nil { 6704 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:crc: ", p), err) 6705 } 6706 } 6707 return err 6708 } 6709 6710 func (p *PageHeader) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 6711 if p.IsSetDataPageHeader() { 6712 if err := oprot.WriteFieldBegin(ctx, "data_page_header", thrift.STRUCT, 5); err != nil { 6713 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:data_page_header: ", p), err) 6714 } 6715 if err := p.DataPageHeader.Write(ctx, oprot); err != nil { 6716 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DataPageHeader), err) 6717 } 6718 if err := oprot.WriteFieldEnd(ctx); err != nil { 6719 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:data_page_header: ", p), err) 6720 } 6721 } 6722 return err 6723 } 6724 6725 func (p *PageHeader) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 6726 if p.IsSetIndexPageHeader() { 6727 if err := oprot.WriteFieldBegin(ctx, "index_page_header", thrift.STRUCT, 6); err != nil { 6728 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:index_page_header: ", p), err) 6729 } 6730 if err := p.IndexPageHeader.Write(ctx, oprot); err != nil { 6731 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.IndexPageHeader), err) 6732 } 6733 if err := oprot.WriteFieldEnd(ctx); err != nil { 6734 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:index_page_header: ", p), err) 6735 } 6736 } 6737 return err 6738 } 6739 6740 func (p *PageHeader) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 6741 if p.IsSetDictionaryPageHeader() { 6742 if err := oprot.WriteFieldBegin(ctx, "dictionary_page_header", thrift.STRUCT, 7); err != nil { 6743 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:dictionary_page_header: ", p), err) 6744 } 6745 if err := p.DictionaryPageHeader.Write(ctx, oprot); err != nil { 6746 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DictionaryPageHeader), err) 6747 } 6748 if err := oprot.WriteFieldEnd(ctx); err != nil { 6749 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:dictionary_page_header: ", p), err) 6750 } 6751 } 6752 return err 6753 } 6754 6755 func (p *PageHeader) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 6756 if p.IsSetDataPageHeaderV2() { 6757 if err := oprot.WriteFieldBegin(ctx, "data_page_header_v2", thrift.STRUCT, 8); err != nil { 6758 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:data_page_header_v2: ", p), err) 6759 } 6760 if err := p.DataPageHeaderV2.Write(ctx, oprot); err != nil { 6761 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.DataPageHeaderV2), err) 6762 } 6763 if err := oprot.WriteFieldEnd(ctx); err != nil { 6764 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:data_page_header_v2: ", p), err) 6765 } 6766 } 6767 return err 6768 } 6769 6770 func (p *PageHeader) Equals(other *PageHeader) bool { 6771 if p == other { 6772 return true 6773 } else if p == nil || other == nil { 6774 return false 6775 } 6776 if p.Type != other.Type { 6777 return false 6778 } 6779 if p.UncompressedPageSize != other.UncompressedPageSize { 6780 return false 6781 } 6782 if p.CompressedPageSize != other.CompressedPageSize { 6783 return false 6784 } 6785 if p.Crc != other.Crc { 6786 if p.Crc == nil || other.Crc == nil { 6787 return false 6788 } 6789 if (*p.Crc) != (*other.Crc) { 6790 return false 6791 } 6792 } 6793 if !p.DataPageHeader.Equals(other.DataPageHeader) { 6794 return false 6795 } 6796 if !p.IndexPageHeader.Equals(other.IndexPageHeader) { 6797 return false 6798 } 6799 if !p.DictionaryPageHeader.Equals(other.DictionaryPageHeader) { 6800 return false 6801 } 6802 if !p.DataPageHeaderV2.Equals(other.DataPageHeaderV2) { 6803 return false 6804 } 6805 return true 6806 } 6807 6808 func (p *PageHeader) String() string { 6809 if p == nil { 6810 return "<nil>" 6811 } 6812 return fmt.Sprintf("PageHeader(%+v)", *p) 6813 } 6814 6815 // Wrapper struct to store key values 6816 // 6817 // Attributes: 6818 // - Key 6819 // - Value 6820 type KeyValue struct { 6821 Key string `thrift:"key,1,required" db:"key" json:"key"` 6822 Value *string `thrift:"value,2" db:"value" json:"value,omitempty"` 6823 } 6824 6825 func NewKeyValue() *KeyValue { 6826 return &KeyValue{} 6827 } 6828 6829 func (p *KeyValue) GetKey() string { 6830 return p.Key 6831 } 6832 6833 var KeyValue_Value_DEFAULT string 6834 6835 func (p *KeyValue) GetValue() string { 6836 if !p.IsSetValue() { 6837 return KeyValue_Value_DEFAULT 6838 } 6839 return *p.Value 6840 } 6841 func (p *KeyValue) IsSetValue() bool { 6842 return p.Value != nil 6843 } 6844 6845 func (p *KeyValue) Read(ctx context.Context, iprot thrift.TProtocol) error { 6846 if _, err := iprot.ReadStructBegin(ctx); err != nil { 6847 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 6848 } 6849 6850 var issetKey bool = false 6851 6852 for { 6853 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 6854 if err != nil { 6855 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 6856 } 6857 if fieldTypeId == thrift.STOP { 6858 break 6859 } 6860 switch fieldId { 6861 case 1: 6862 if fieldTypeId == thrift.STRING { 6863 if err := p.ReadField1(ctx, iprot); err != nil { 6864 return err 6865 } 6866 issetKey = true 6867 } else { 6868 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6869 return err 6870 } 6871 } 6872 case 2: 6873 if fieldTypeId == thrift.STRING { 6874 if err := p.ReadField2(ctx, iprot); err != nil { 6875 return err 6876 } 6877 } else { 6878 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6879 return err 6880 } 6881 } 6882 default: 6883 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 6884 return err 6885 } 6886 } 6887 if err := iprot.ReadFieldEnd(ctx); err != nil { 6888 return err 6889 } 6890 } 6891 if err := iprot.ReadStructEnd(ctx); err != nil { 6892 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 6893 } 6894 if !issetKey { 6895 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Key is not set")) 6896 } 6897 return nil 6898 } 6899 6900 func (p *KeyValue) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 6901 if v, err := iprot.ReadString(ctx); err != nil { 6902 return thrift.PrependError("error reading field 1: ", err) 6903 } else { 6904 p.Key = v 6905 } 6906 return nil 6907 } 6908 6909 func (p *KeyValue) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 6910 if v, err := iprot.ReadString(ctx); err != nil { 6911 return thrift.PrependError("error reading field 2: ", err) 6912 } else { 6913 p.Value = &v 6914 } 6915 return nil 6916 } 6917 6918 func (p *KeyValue) Write(ctx context.Context, oprot thrift.TProtocol) error { 6919 if err := oprot.WriteStructBegin(ctx, "KeyValue"); err != nil { 6920 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 6921 } 6922 if p != nil { 6923 if err := p.writeField1(ctx, oprot); err != nil { 6924 return err 6925 } 6926 if err := p.writeField2(ctx, oprot); err != nil { 6927 return err 6928 } 6929 } 6930 if err := oprot.WriteFieldStop(ctx); err != nil { 6931 return thrift.PrependError("write field stop error: ", err) 6932 } 6933 if err := oprot.WriteStructEnd(ctx); err != nil { 6934 return thrift.PrependError("write struct stop error: ", err) 6935 } 6936 return nil 6937 } 6938 6939 func (p *KeyValue) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 6940 if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil { 6941 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) 6942 } 6943 if err := oprot.WriteString(ctx, string(p.Key)); err != nil { 6944 return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) 6945 } 6946 if err := oprot.WriteFieldEnd(ctx); err != nil { 6947 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) 6948 } 6949 return err 6950 } 6951 6952 func (p *KeyValue) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 6953 if p.IsSetValue() { 6954 if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil { 6955 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) 6956 } 6957 if err := oprot.WriteString(ctx, string(*p.Value)); err != nil { 6958 return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) 6959 } 6960 if err := oprot.WriteFieldEnd(ctx); err != nil { 6961 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) 6962 } 6963 } 6964 return err 6965 } 6966 6967 func (p *KeyValue) Equals(other *KeyValue) bool { 6968 if p == other { 6969 return true 6970 } else if p == nil || other == nil { 6971 return false 6972 } 6973 if p.Key != other.Key { 6974 return false 6975 } 6976 if p.Value != other.Value { 6977 if p.Value == nil || other.Value == nil { 6978 return false 6979 } 6980 if (*p.Value) != (*other.Value) { 6981 return false 6982 } 6983 } 6984 return true 6985 } 6986 6987 func (p *KeyValue) String() string { 6988 if p == nil { 6989 return "<nil>" 6990 } 6991 return fmt.Sprintf("KeyValue(%+v)", *p) 6992 } 6993 6994 // Wrapper struct to specify sort order 6995 // 6996 // Attributes: 6997 // - ColumnIdx: The column index (in this row group) * 6998 // - Descending: If true, indicates this column is sorted in descending order. * 6999 // - NullsFirst: If true, nulls will come before non-null values, otherwise, 7000 // nulls go at the end. 7001 type SortingColumn struct { 7002 ColumnIdx int32 `thrift:"column_idx,1,required" db:"column_idx" json:"column_idx"` 7003 Descending bool `thrift:"descending,2,required" db:"descending" json:"descending"` 7004 NullsFirst bool `thrift:"nulls_first,3,required" db:"nulls_first" json:"nulls_first"` 7005 } 7006 7007 func NewSortingColumn() *SortingColumn { 7008 return &SortingColumn{} 7009 } 7010 7011 func (p *SortingColumn) GetColumnIdx() int32 { 7012 return p.ColumnIdx 7013 } 7014 7015 func (p *SortingColumn) GetDescending() bool { 7016 return p.Descending 7017 } 7018 7019 func (p *SortingColumn) GetNullsFirst() bool { 7020 return p.NullsFirst 7021 } 7022 func (p *SortingColumn) Read(ctx context.Context, iprot thrift.TProtocol) error { 7023 if _, err := iprot.ReadStructBegin(ctx); err != nil { 7024 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 7025 } 7026 7027 var issetColumnIdx bool = false 7028 var issetDescending bool = false 7029 var issetNullsFirst bool = false 7030 7031 for { 7032 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 7033 if err != nil { 7034 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 7035 } 7036 if fieldTypeId == thrift.STOP { 7037 break 7038 } 7039 switch fieldId { 7040 case 1: 7041 if fieldTypeId == thrift.I32 { 7042 if err := p.ReadField1(ctx, iprot); err != nil { 7043 return err 7044 } 7045 issetColumnIdx = true 7046 } else { 7047 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7048 return err 7049 } 7050 } 7051 case 2: 7052 if fieldTypeId == thrift.BOOL { 7053 if err := p.ReadField2(ctx, iprot); err != nil { 7054 return err 7055 } 7056 issetDescending = true 7057 } else { 7058 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7059 return err 7060 } 7061 } 7062 case 3: 7063 if fieldTypeId == thrift.BOOL { 7064 if err := p.ReadField3(ctx, iprot); err != nil { 7065 return err 7066 } 7067 issetNullsFirst = true 7068 } else { 7069 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7070 return err 7071 } 7072 } 7073 default: 7074 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7075 return err 7076 } 7077 } 7078 if err := iprot.ReadFieldEnd(ctx); err != nil { 7079 return err 7080 } 7081 } 7082 if err := iprot.ReadStructEnd(ctx); err != nil { 7083 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 7084 } 7085 if !issetColumnIdx { 7086 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ColumnIdx is not set")) 7087 } 7088 if !issetDescending { 7089 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Descending is not set")) 7090 } 7091 if !issetNullsFirst { 7092 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NullsFirst is not set")) 7093 } 7094 return nil 7095 } 7096 7097 func (p *SortingColumn) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 7098 if v, err := iprot.ReadI32(ctx); err != nil { 7099 return thrift.PrependError("error reading field 1: ", err) 7100 } else { 7101 p.ColumnIdx = v 7102 } 7103 return nil 7104 } 7105 7106 func (p *SortingColumn) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 7107 if v, err := iprot.ReadBool(ctx); err != nil { 7108 return thrift.PrependError("error reading field 2: ", err) 7109 } else { 7110 p.Descending = v 7111 } 7112 return nil 7113 } 7114 7115 func (p *SortingColumn) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 7116 if v, err := iprot.ReadBool(ctx); err != nil { 7117 return thrift.PrependError("error reading field 3: ", err) 7118 } else { 7119 p.NullsFirst = v 7120 } 7121 return nil 7122 } 7123 7124 func (p *SortingColumn) Write(ctx context.Context, oprot thrift.TProtocol) error { 7125 if err := oprot.WriteStructBegin(ctx, "SortingColumn"); err != nil { 7126 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 7127 } 7128 if p != nil { 7129 if err := p.writeField1(ctx, oprot); err != nil { 7130 return err 7131 } 7132 if err := p.writeField2(ctx, oprot); err != nil { 7133 return err 7134 } 7135 if err := p.writeField3(ctx, oprot); err != nil { 7136 return err 7137 } 7138 } 7139 if err := oprot.WriteFieldStop(ctx); err != nil { 7140 return thrift.PrependError("write field stop error: ", err) 7141 } 7142 if err := oprot.WriteStructEnd(ctx); err != nil { 7143 return thrift.PrependError("write struct stop error: ", err) 7144 } 7145 return nil 7146 } 7147 7148 func (p *SortingColumn) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 7149 if err := oprot.WriteFieldBegin(ctx, "column_idx", thrift.I32, 1); err != nil { 7150 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:column_idx: ", p), err) 7151 } 7152 if err := oprot.WriteI32(ctx, int32(p.ColumnIdx)); err != nil { 7153 return thrift.PrependError(fmt.Sprintf("%T.column_idx (1) field write error: ", p), err) 7154 } 7155 if err := oprot.WriteFieldEnd(ctx); err != nil { 7156 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:column_idx: ", p), err) 7157 } 7158 return err 7159 } 7160 7161 func (p *SortingColumn) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 7162 if err := oprot.WriteFieldBegin(ctx, "descending", thrift.BOOL, 2); err != nil { 7163 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:descending: ", p), err) 7164 } 7165 if err := oprot.WriteBool(ctx, bool(p.Descending)); err != nil { 7166 return thrift.PrependError(fmt.Sprintf("%T.descending (2) field write error: ", p), err) 7167 } 7168 if err := oprot.WriteFieldEnd(ctx); err != nil { 7169 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:descending: ", p), err) 7170 } 7171 return err 7172 } 7173 7174 func (p *SortingColumn) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 7175 if err := oprot.WriteFieldBegin(ctx, "nulls_first", thrift.BOOL, 3); err != nil { 7176 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:nulls_first: ", p), err) 7177 } 7178 if err := oprot.WriteBool(ctx, bool(p.NullsFirst)); err != nil { 7179 return thrift.PrependError(fmt.Sprintf("%T.nulls_first (3) field write error: ", p), err) 7180 } 7181 if err := oprot.WriteFieldEnd(ctx); err != nil { 7182 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:nulls_first: ", p), err) 7183 } 7184 return err 7185 } 7186 7187 func (p *SortingColumn) Equals(other *SortingColumn) bool { 7188 if p == other { 7189 return true 7190 } else if p == nil || other == nil { 7191 return false 7192 } 7193 if p.ColumnIdx != other.ColumnIdx { 7194 return false 7195 } 7196 if p.Descending != other.Descending { 7197 return false 7198 } 7199 if p.NullsFirst != other.NullsFirst { 7200 return false 7201 } 7202 return true 7203 } 7204 7205 func (p *SortingColumn) String() string { 7206 if p == nil { 7207 return "<nil>" 7208 } 7209 return fmt.Sprintf("SortingColumn(%+v)", *p) 7210 } 7211 7212 // statistics of a given page type and encoding 7213 // 7214 // Attributes: 7215 // - PageType: the page type (data/dic/...) * 7216 // - Encoding: encoding of the page * 7217 // - Count: number of pages of this type with this encoding * 7218 type PageEncodingStats struct { 7219 PageType PageType `thrift:"page_type,1,required" db:"page_type" json:"page_type"` 7220 Encoding Encoding `thrift:"encoding,2,required" db:"encoding" json:"encoding"` 7221 Count int32 `thrift:"count,3,required" db:"count" json:"count"` 7222 } 7223 7224 func NewPageEncodingStats() *PageEncodingStats { 7225 return &PageEncodingStats{} 7226 } 7227 7228 func (p *PageEncodingStats) GetPageType() PageType { 7229 return p.PageType 7230 } 7231 7232 func (p *PageEncodingStats) GetEncoding() Encoding { 7233 return p.Encoding 7234 } 7235 7236 func (p *PageEncodingStats) GetCount() int32 { 7237 return p.Count 7238 } 7239 func (p *PageEncodingStats) Read(ctx context.Context, iprot thrift.TProtocol) error { 7240 if _, err := iprot.ReadStructBegin(ctx); err != nil { 7241 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 7242 } 7243 7244 var issetPageType bool = false 7245 var issetEncoding bool = false 7246 var issetCount bool = false 7247 7248 for { 7249 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 7250 if err != nil { 7251 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 7252 } 7253 if fieldTypeId == thrift.STOP { 7254 break 7255 } 7256 switch fieldId { 7257 case 1: 7258 if fieldTypeId == thrift.I32 { 7259 if err := p.ReadField1(ctx, iprot); err != nil { 7260 return err 7261 } 7262 issetPageType = true 7263 } else { 7264 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7265 return err 7266 } 7267 } 7268 case 2: 7269 if fieldTypeId == thrift.I32 { 7270 if err := p.ReadField2(ctx, iprot); err != nil { 7271 return err 7272 } 7273 issetEncoding = true 7274 } else { 7275 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7276 return err 7277 } 7278 } 7279 case 3: 7280 if fieldTypeId == thrift.I32 { 7281 if err := p.ReadField3(ctx, iprot); err != nil { 7282 return err 7283 } 7284 issetCount = true 7285 } else { 7286 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7287 return err 7288 } 7289 } 7290 default: 7291 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7292 return err 7293 } 7294 } 7295 if err := iprot.ReadFieldEnd(ctx); err != nil { 7296 return err 7297 } 7298 } 7299 if err := iprot.ReadStructEnd(ctx); err != nil { 7300 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 7301 } 7302 if !issetPageType { 7303 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PageType is not set")) 7304 } 7305 if !issetEncoding { 7306 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encoding is not set")) 7307 } 7308 if !issetCount { 7309 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Count is not set")) 7310 } 7311 return nil 7312 } 7313 7314 func (p *PageEncodingStats) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 7315 if v, err := iprot.ReadI32(ctx); err != nil { 7316 return thrift.PrependError("error reading field 1: ", err) 7317 } else { 7318 temp := PageType(v) 7319 p.PageType = temp 7320 } 7321 return nil 7322 } 7323 7324 func (p *PageEncodingStats) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 7325 if v, err := iprot.ReadI32(ctx); err != nil { 7326 return thrift.PrependError("error reading field 2: ", err) 7327 } else { 7328 temp := Encoding(v) 7329 p.Encoding = temp 7330 } 7331 return nil 7332 } 7333 7334 func (p *PageEncodingStats) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 7335 if v, err := iprot.ReadI32(ctx); err != nil { 7336 return thrift.PrependError("error reading field 3: ", err) 7337 } else { 7338 p.Count = v 7339 } 7340 return nil 7341 } 7342 7343 func (p *PageEncodingStats) Write(ctx context.Context, oprot thrift.TProtocol) error { 7344 if err := oprot.WriteStructBegin(ctx, "PageEncodingStats"); err != nil { 7345 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 7346 } 7347 if p != nil { 7348 if err := p.writeField1(ctx, oprot); err != nil { 7349 return err 7350 } 7351 if err := p.writeField2(ctx, oprot); err != nil { 7352 return err 7353 } 7354 if err := p.writeField3(ctx, oprot); err != nil { 7355 return err 7356 } 7357 } 7358 if err := oprot.WriteFieldStop(ctx); err != nil { 7359 return thrift.PrependError("write field stop error: ", err) 7360 } 7361 if err := oprot.WriteStructEnd(ctx); err != nil { 7362 return thrift.PrependError("write struct stop error: ", err) 7363 } 7364 return nil 7365 } 7366 7367 func (p *PageEncodingStats) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 7368 if err := oprot.WriteFieldBegin(ctx, "page_type", thrift.I32, 1); err != nil { 7369 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:page_type: ", p), err) 7370 } 7371 if err := oprot.WriteI32(ctx, int32(p.PageType)); err != nil { 7372 return thrift.PrependError(fmt.Sprintf("%T.page_type (1) field write error: ", p), err) 7373 } 7374 if err := oprot.WriteFieldEnd(ctx); err != nil { 7375 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:page_type: ", p), err) 7376 } 7377 return err 7378 } 7379 7380 func (p *PageEncodingStats) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 7381 if err := oprot.WriteFieldBegin(ctx, "encoding", thrift.I32, 2); err != nil { 7382 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:encoding: ", p), err) 7383 } 7384 if err := oprot.WriteI32(ctx, int32(p.Encoding)); err != nil { 7385 return thrift.PrependError(fmt.Sprintf("%T.encoding (2) field write error: ", p), err) 7386 } 7387 if err := oprot.WriteFieldEnd(ctx); err != nil { 7388 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:encoding: ", p), err) 7389 } 7390 return err 7391 } 7392 7393 func (p *PageEncodingStats) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 7394 if err := oprot.WriteFieldBegin(ctx, "count", thrift.I32, 3); err != nil { 7395 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:count: ", p), err) 7396 } 7397 if err := oprot.WriteI32(ctx, int32(p.Count)); err != nil { 7398 return thrift.PrependError(fmt.Sprintf("%T.count (3) field write error: ", p), err) 7399 } 7400 if err := oprot.WriteFieldEnd(ctx); err != nil { 7401 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:count: ", p), err) 7402 } 7403 return err 7404 } 7405 7406 func (p *PageEncodingStats) Equals(other *PageEncodingStats) bool { 7407 if p == other { 7408 return true 7409 } else if p == nil || other == nil { 7410 return false 7411 } 7412 if p.PageType != other.PageType { 7413 return false 7414 } 7415 if p.Encoding != other.Encoding { 7416 return false 7417 } 7418 if p.Count != other.Count { 7419 return false 7420 } 7421 return true 7422 } 7423 7424 func (p *PageEncodingStats) String() string { 7425 if p == nil { 7426 return "<nil>" 7427 } 7428 return fmt.Sprintf("PageEncodingStats(%+v)", *p) 7429 } 7430 7431 // Description for column metadata 7432 // 7433 // Attributes: 7434 // - Type: Type of this column * 7435 // - Encodings: Set of all encodings used for this column. The purpose is to validate 7436 // whether we can decode those pages. * 7437 // - PathInSchema: Path in schema * 7438 // - Codec: Compression codec * 7439 // - NumValues: Number of values in this column * 7440 // - TotalUncompressedSize: total byte size of all uncompressed pages in this column chunk (including the headers) * 7441 // - TotalCompressedSize: total byte size of all compressed, and potentially encrypted, pages 7442 // in this column chunk (including the headers) * 7443 // - KeyValueMetadata: Optional key/value metadata * 7444 // - DataPageOffset: Byte offset from beginning of file to first data page * 7445 // - IndexPageOffset: Byte offset from beginning of file to root index page * 7446 // - DictionaryPageOffset: Byte offset from the beginning of file to first (only) dictionary page * 7447 // - Statistics: optional statistics for this column chunk 7448 // - EncodingStats: Set of all encodings used for pages in this column chunk. 7449 // This information can be used to determine if all data pages are 7450 // dictionary encoded for example * 7451 // - BloomFilterOffset: Byte offset from beginning of file to Bloom filter data. * 7452 type ColumnMetaData struct { 7453 Type Type `thrift:"type,1,required" db:"type" json:"type"` 7454 Encodings []Encoding `thrift:"encodings,2,required" db:"encodings" json:"encodings"` 7455 PathInSchema []string `thrift:"path_in_schema,3,required" db:"path_in_schema" json:"path_in_schema"` 7456 Codec CompressionCodec `thrift:"codec,4,required" db:"codec" json:"codec"` 7457 NumValues int64 `thrift:"num_values,5,required" db:"num_values" json:"num_values"` 7458 TotalUncompressedSize int64 `thrift:"total_uncompressed_size,6,required" db:"total_uncompressed_size" json:"total_uncompressed_size"` 7459 TotalCompressedSize int64 `thrift:"total_compressed_size,7,required" db:"total_compressed_size" json:"total_compressed_size"` 7460 KeyValueMetadata []*KeyValue `thrift:"key_value_metadata,8" db:"key_value_metadata" json:"key_value_metadata,omitempty"` 7461 DataPageOffset int64 `thrift:"data_page_offset,9,required" db:"data_page_offset" json:"data_page_offset"` 7462 IndexPageOffset *int64 `thrift:"index_page_offset,10" db:"index_page_offset" json:"index_page_offset,omitempty"` 7463 DictionaryPageOffset *int64 `thrift:"dictionary_page_offset,11" db:"dictionary_page_offset" json:"dictionary_page_offset,omitempty"` 7464 Statistics *Statistics `thrift:"statistics,12" db:"statistics" json:"statistics,omitempty"` 7465 EncodingStats []*PageEncodingStats `thrift:"encoding_stats,13" db:"encoding_stats" json:"encoding_stats,omitempty"` 7466 BloomFilterOffset *int64 `thrift:"bloom_filter_offset,14" db:"bloom_filter_offset" json:"bloom_filter_offset,omitempty"` 7467 } 7468 7469 func NewColumnMetaData() *ColumnMetaData { 7470 return &ColumnMetaData{} 7471 } 7472 7473 func (p *ColumnMetaData) GetType() Type { 7474 return p.Type 7475 } 7476 7477 func (p *ColumnMetaData) GetEncodings() []Encoding { 7478 return p.Encodings 7479 } 7480 7481 func (p *ColumnMetaData) GetPathInSchema() []string { 7482 return p.PathInSchema 7483 } 7484 7485 func (p *ColumnMetaData) GetCodec() CompressionCodec { 7486 return p.Codec 7487 } 7488 7489 func (p *ColumnMetaData) GetNumValues() int64 { 7490 return p.NumValues 7491 } 7492 7493 func (p *ColumnMetaData) GetTotalUncompressedSize() int64 { 7494 return p.TotalUncompressedSize 7495 } 7496 7497 func (p *ColumnMetaData) GetTotalCompressedSize() int64 { 7498 return p.TotalCompressedSize 7499 } 7500 7501 var ColumnMetaData_KeyValueMetadata_DEFAULT []*KeyValue 7502 7503 func (p *ColumnMetaData) GetKeyValueMetadata() []*KeyValue { 7504 return p.KeyValueMetadata 7505 } 7506 7507 func (p *ColumnMetaData) GetDataPageOffset() int64 { 7508 return p.DataPageOffset 7509 } 7510 7511 var ColumnMetaData_IndexPageOffset_DEFAULT int64 7512 7513 func (p *ColumnMetaData) GetIndexPageOffset() int64 { 7514 if !p.IsSetIndexPageOffset() { 7515 return ColumnMetaData_IndexPageOffset_DEFAULT 7516 } 7517 return *p.IndexPageOffset 7518 } 7519 7520 var ColumnMetaData_DictionaryPageOffset_DEFAULT int64 7521 7522 func (p *ColumnMetaData) GetDictionaryPageOffset() int64 { 7523 if !p.IsSetDictionaryPageOffset() { 7524 return ColumnMetaData_DictionaryPageOffset_DEFAULT 7525 } 7526 return *p.DictionaryPageOffset 7527 } 7528 7529 var ColumnMetaData_Statistics_DEFAULT *Statistics 7530 7531 func (p *ColumnMetaData) GetStatistics() *Statistics { 7532 if !p.IsSetStatistics() { 7533 return ColumnMetaData_Statistics_DEFAULT 7534 } 7535 return p.Statistics 7536 } 7537 7538 var ColumnMetaData_EncodingStats_DEFAULT []*PageEncodingStats 7539 7540 func (p *ColumnMetaData) GetEncodingStats() []*PageEncodingStats { 7541 return p.EncodingStats 7542 } 7543 7544 var ColumnMetaData_BloomFilterOffset_DEFAULT int64 7545 7546 func (p *ColumnMetaData) GetBloomFilterOffset() int64 { 7547 if !p.IsSetBloomFilterOffset() { 7548 return ColumnMetaData_BloomFilterOffset_DEFAULT 7549 } 7550 return *p.BloomFilterOffset 7551 } 7552 func (p *ColumnMetaData) IsSetKeyValueMetadata() bool { 7553 return p.KeyValueMetadata != nil 7554 } 7555 7556 func (p *ColumnMetaData) IsSetIndexPageOffset() bool { 7557 return p.IndexPageOffset != nil 7558 } 7559 7560 func (p *ColumnMetaData) IsSetDictionaryPageOffset() bool { 7561 return p.DictionaryPageOffset != nil 7562 } 7563 7564 func (p *ColumnMetaData) IsSetStatistics() bool { 7565 return p.Statistics != nil 7566 } 7567 7568 func (p *ColumnMetaData) IsSetEncodingStats() bool { 7569 return p.EncodingStats != nil 7570 } 7571 7572 func (p *ColumnMetaData) IsSetBloomFilterOffset() bool { 7573 return p.BloomFilterOffset != nil 7574 } 7575 7576 func (p *ColumnMetaData) Read(ctx context.Context, iprot thrift.TProtocol) error { 7577 if _, err := iprot.ReadStructBegin(ctx); err != nil { 7578 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 7579 } 7580 7581 var issetType bool = false 7582 var issetEncodings bool = false 7583 var issetPathInSchema bool = false 7584 var issetCodec bool = false 7585 var issetNumValues bool = false 7586 var issetTotalUncompressedSize bool = false 7587 var issetTotalCompressedSize bool = false 7588 var issetDataPageOffset bool = false 7589 7590 for { 7591 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 7592 if err != nil { 7593 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 7594 } 7595 if fieldTypeId == thrift.STOP { 7596 break 7597 } 7598 switch fieldId { 7599 case 1: 7600 if fieldTypeId == thrift.I32 { 7601 if err := p.ReadField1(ctx, iprot); err != nil { 7602 return err 7603 } 7604 issetType = true 7605 } else { 7606 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7607 return err 7608 } 7609 } 7610 case 2: 7611 if fieldTypeId == thrift.LIST { 7612 if err := p.ReadField2(ctx, iprot); err != nil { 7613 return err 7614 } 7615 issetEncodings = true 7616 } else { 7617 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7618 return err 7619 } 7620 } 7621 case 3: 7622 if fieldTypeId == thrift.LIST { 7623 if err := p.ReadField3(ctx, iprot); err != nil { 7624 return err 7625 } 7626 issetPathInSchema = true 7627 } else { 7628 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7629 return err 7630 } 7631 } 7632 case 4: 7633 if fieldTypeId == thrift.I32 { 7634 if err := p.ReadField4(ctx, iprot); err != nil { 7635 return err 7636 } 7637 issetCodec = true 7638 } else { 7639 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7640 return err 7641 } 7642 } 7643 case 5: 7644 if fieldTypeId == thrift.I64 { 7645 if err := p.ReadField5(ctx, iprot); err != nil { 7646 return err 7647 } 7648 issetNumValues = true 7649 } else { 7650 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7651 return err 7652 } 7653 } 7654 case 6: 7655 if fieldTypeId == thrift.I64 { 7656 if err := p.ReadField6(ctx, iprot); err != nil { 7657 return err 7658 } 7659 issetTotalUncompressedSize = true 7660 } else { 7661 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7662 return err 7663 } 7664 } 7665 case 7: 7666 if fieldTypeId == thrift.I64 { 7667 if err := p.ReadField7(ctx, iprot); err != nil { 7668 return err 7669 } 7670 issetTotalCompressedSize = true 7671 } else { 7672 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7673 return err 7674 } 7675 } 7676 case 8: 7677 if fieldTypeId == thrift.LIST { 7678 if err := p.ReadField8(ctx, iprot); err != nil { 7679 return err 7680 } 7681 } else { 7682 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7683 return err 7684 } 7685 } 7686 case 9: 7687 if fieldTypeId == thrift.I64 { 7688 if err := p.ReadField9(ctx, iprot); err != nil { 7689 return err 7690 } 7691 issetDataPageOffset = true 7692 } else { 7693 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7694 return err 7695 } 7696 } 7697 case 10: 7698 if fieldTypeId == thrift.I64 { 7699 if err := p.ReadField10(ctx, iprot); err != nil { 7700 return err 7701 } 7702 } else { 7703 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7704 return err 7705 } 7706 } 7707 case 11: 7708 if fieldTypeId == thrift.I64 { 7709 if err := p.ReadField11(ctx, iprot); err != nil { 7710 return err 7711 } 7712 } else { 7713 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7714 return err 7715 } 7716 } 7717 case 12: 7718 if fieldTypeId == thrift.STRUCT { 7719 if err := p.ReadField12(ctx, iprot); err != nil { 7720 return err 7721 } 7722 } else { 7723 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7724 return err 7725 } 7726 } 7727 case 13: 7728 if fieldTypeId == thrift.LIST { 7729 if err := p.ReadField13(ctx, iprot); err != nil { 7730 return err 7731 } 7732 } else { 7733 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7734 return err 7735 } 7736 } 7737 case 14: 7738 if fieldTypeId == thrift.I64 { 7739 if err := p.ReadField14(ctx, iprot); err != nil { 7740 return err 7741 } 7742 } else { 7743 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7744 return err 7745 } 7746 } 7747 default: 7748 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 7749 return err 7750 } 7751 } 7752 if err := iprot.ReadFieldEnd(ctx); err != nil { 7753 return err 7754 } 7755 } 7756 if err := iprot.ReadStructEnd(ctx); err != nil { 7757 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 7758 } 7759 if !issetType { 7760 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Type is not set")) 7761 } 7762 if !issetEncodings { 7763 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Encodings is not set")) 7764 } 7765 if !issetPathInSchema { 7766 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PathInSchema is not set")) 7767 } 7768 if !issetCodec { 7769 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Codec is not set")) 7770 } 7771 if !issetNumValues { 7772 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumValues is not set")) 7773 } 7774 if !issetTotalUncompressedSize { 7775 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TotalUncompressedSize is not set")) 7776 } 7777 if !issetTotalCompressedSize { 7778 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TotalCompressedSize is not set")) 7779 } 7780 if !issetDataPageOffset { 7781 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DataPageOffset is not set")) 7782 } 7783 return nil 7784 } 7785 7786 func (p *ColumnMetaData) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 7787 if v, err := iprot.ReadI32(ctx); err != nil { 7788 return thrift.PrependError("error reading field 1: ", err) 7789 } else { 7790 temp := Type(v) 7791 p.Type = temp 7792 } 7793 return nil 7794 } 7795 7796 func (p *ColumnMetaData) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 7797 _, size, err := iprot.ReadListBegin(ctx) 7798 if size < 0 { 7799 return errors.New("list size is negative") 7800 } 7801 if err != nil { 7802 return thrift.PrependError("error reading list begin: ", err) 7803 } 7804 tSlice := make([]Encoding, 0, size) 7805 p.Encodings = tSlice 7806 for i := 0; i < size; i++ { 7807 var _elem0 Encoding 7808 if v, err := iprot.ReadI32(ctx); err != nil { 7809 return thrift.PrependError("error reading field 0: ", err) 7810 } else { 7811 temp := Encoding(v) 7812 _elem0 = temp 7813 } 7814 p.Encodings = append(p.Encodings, _elem0) 7815 } 7816 if err := iprot.ReadListEnd(ctx); err != nil { 7817 return thrift.PrependError("error reading list end: ", err) 7818 } 7819 return nil 7820 } 7821 7822 func (p *ColumnMetaData) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 7823 _, size, err := iprot.ReadListBegin(ctx) 7824 if size < 0 { 7825 return errors.New("list size is negative") 7826 } 7827 if err != nil { 7828 return thrift.PrependError("error reading list begin: ", err) 7829 } 7830 tSlice := make([]string, 0, size) 7831 p.PathInSchema = tSlice 7832 for i := 0; i < size; i++ { 7833 var _elem1 string 7834 if v, err := iprot.ReadString(ctx); err != nil { 7835 return thrift.PrependError("error reading field 0: ", err) 7836 } else { 7837 _elem1 = v 7838 } 7839 p.PathInSchema = append(p.PathInSchema, _elem1) 7840 } 7841 if err := iprot.ReadListEnd(ctx); err != nil { 7842 return thrift.PrependError("error reading list end: ", err) 7843 } 7844 return nil 7845 } 7846 7847 func (p *ColumnMetaData) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 7848 if v, err := iprot.ReadI32(ctx); err != nil { 7849 return thrift.PrependError("error reading field 4: ", err) 7850 } else { 7851 temp := CompressionCodec(v) 7852 p.Codec = temp 7853 } 7854 return nil 7855 } 7856 7857 func (p *ColumnMetaData) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 7858 if v, err := iprot.ReadI64(ctx); err != nil { 7859 return thrift.PrependError("error reading field 5: ", err) 7860 } else { 7861 p.NumValues = v 7862 } 7863 return nil 7864 } 7865 7866 func (p *ColumnMetaData) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 7867 if v, err := iprot.ReadI64(ctx); err != nil { 7868 return thrift.PrependError("error reading field 6: ", err) 7869 } else { 7870 p.TotalUncompressedSize = v 7871 } 7872 return nil 7873 } 7874 7875 func (p *ColumnMetaData) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 7876 if v, err := iprot.ReadI64(ctx); err != nil { 7877 return thrift.PrependError("error reading field 7: ", err) 7878 } else { 7879 p.TotalCompressedSize = v 7880 } 7881 return nil 7882 } 7883 7884 func (p *ColumnMetaData) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 7885 _, size, err := iprot.ReadListBegin(ctx) 7886 if size < 0 { 7887 return errors.New("list size is negative") 7888 } 7889 if err != nil { 7890 return thrift.PrependError("error reading list begin: ", err) 7891 } 7892 tSlice := make([]*KeyValue, 0, size) 7893 p.KeyValueMetadata = tSlice 7894 for i := 0; i < size; i++ { 7895 _elem2 := &KeyValue{} 7896 if err := _elem2.Read(ctx, iprot); err != nil { 7897 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err) 7898 } 7899 p.KeyValueMetadata = append(p.KeyValueMetadata, _elem2) 7900 } 7901 if err := iprot.ReadListEnd(ctx); err != nil { 7902 return thrift.PrependError("error reading list end: ", err) 7903 } 7904 return nil 7905 } 7906 7907 func (p *ColumnMetaData) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { 7908 if v, err := iprot.ReadI64(ctx); err != nil { 7909 return thrift.PrependError("error reading field 9: ", err) 7910 } else { 7911 p.DataPageOffset = v 7912 } 7913 return nil 7914 } 7915 7916 func (p *ColumnMetaData) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { 7917 if v, err := iprot.ReadI64(ctx); err != nil { 7918 return thrift.PrependError("error reading field 10: ", err) 7919 } else { 7920 p.IndexPageOffset = &v 7921 } 7922 return nil 7923 } 7924 7925 func (p *ColumnMetaData) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { 7926 if v, err := iprot.ReadI64(ctx); err != nil { 7927 return thrift.PrependError("error reading field 11: ", err) 7928 } else { 7929 p.DictionaryPageOffset = &v 7930 } 7931 return nil 7932 } 7933 7934 func (p *ColumnMetaData) ReadField12(ctx context.Context, iprot thrift.TProtocol) error { 7935 p.Statistics = &Statistics{} 7936 if err := p.Statistics.Read(ctx, iprot); err != nil { 7937 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Statistics), err) 7938 } 7939 return nil 7940 } 7941 7942 func (p *ColumnMetaData) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { 7943 _, size, err := iprot.ReadListBegin(ctx) 7944 if size < 0 { 7945 return errors.New("list size is negative") 7946 } 7947 if err != nil { 7948 return thrift.PrependError("error reading list begin: ", err) 7949 } 7950 tSlice := make([]*PageEncodingStats, 0, size) 7951 p.EncodingStats = tSlice 7952 for i := 0; i < size; i++ { 7953 _elem3 := &PageEncodingStats{} 7954 if err := _elem3.Read(ctx, iprot); err != nil { 7955 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err) 7956 } 7957 p.EncodingStats = append(p.EncodingStats, _elem3) 7958 } 7959 if err := iprot.ReadListEnd(ctx); err != nil { 7960 return thrift.PrependError("error reading list end: ", err) 7961 } 7962 return nil 7963 } 7964 7965 func (p *ColumnMetaData) ReadField14(ctx context.Context, iprot thrift.TProtocol) error { 7966 if v, err := iprot.ReadI64(ctx); err != nil { 7967 return thrift.PrependError("error reading field 14: ", err) 7968 } else { 7969 p.BloomFilterOffset = &v 7970 } 7971 return nil 7972 } 7973 7974 func (p *ColumnMetaData) Write(ctx context.Context, oprot thrift.TProtocol) error { 7975 if err := oprot.WriteStructBegin(ctx, "ColumnMetaData"); err != nil { 7976 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 7977 } 7978 if p != nil { 7979 if err := p.writeField1(ctx, oprot); err != nil { 7980 return err 7981 } 7982 if err := p.writeField2(ctx, oprot); err != nil { 7983 return err 7984 } 7985 if err := p.writeField3(ctx, oprot); err != nil { 7986 return err 7987 } 7988 if err := p.writeField4(ctx, oprot); err != nil { 7989 return err 7990 } 7991 if err := p.writeField5(ctx, oprot); err != nil { 7992 return err 7993 } 7994 if err := p.writeField6(ctx, oprot); err != nil { 7995 return err 7996 } 7997 if err := p.writeField7(ctx, oprot); err != nil { 7998 return err 7999 } 8000 if err := p.writeField8(ctx, oprot); err != nil { 8001 return err 8002 } 8003 if err := p.writeField9(ctx, oprot); err != nil { 8004 return err 8005 } 8006 if err := p.writeField10(ctx, oprot); err != nil { 8007 return err 8008 } 8009 if err := p.writeField11(ctx, oprot); err != nil { 8010 return err 8011 } 8012 if err := p.writeField12(ctx, oprot); err != nil { 8013 return err 8014 } 8015 if err := p.writeField13(ctx, oprot); err != nil { 8016 return err 8017 } 8018 if err := p.writeField14(ctx, oprot); err != nil { 8019 return err 8020 } 8021 } 8022 if err := oprot.WriteFieldStop(ctx); err != nil { 8023 return thrift.PrependError("write field stop error: ", err) 8024 } 8025 if err := oprot.WriteStructEnd(ctx); err != nil { 8026 return thrift.PrependError("write struct stop error: ", err) 8027 } 8028 return nil 8029 } 8030 8031 func (p *ColumnMetaData) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 8032 if err := oprot.WriteFieldBegin(ctx, "type", thrift.I32, 1); err != nil { 8033 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:type: ", p), err) 8034 } 8035 if err := oprot.WriteI32(ctx, int32(p.Type)); err != nil { 8036 return thrift.PrependError(fmt.Sprintf("%T.type (1) field write error: ", p), err) 8037 } 8038 if err := oprot.WriteFieldEnd(ctx); err != nil { 8039 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:type: ", p), err) 8040 } 8041 return err 8042 } 8043 8044 func (p *ColumnMetaData) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 8045 if err := oprot.WriteFieldBegin(ctx, "encodings", thrift.LIST, 2); err != nil { 8046 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:encodings: ", p), err) 8047 } 8048 if err := oprot.WriteListBegin(ctx, thrift.I32, len(p.Encodings)); err != nil { 8049 return thrift.PrependError("error writing list begin: ", err) 8050 } 8051 for _, v := range p.Encodings { 8052 if err := oprot.WriteI32(ctx, int32(v)); err != nil { 8053 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) 8054 } 8055 } 8056 if err := oprot.WriteListEnd(ctx); err != nil { 8057 return thrift.PrependError("error writing list end: ", err) 8058 } 8059 if err := oprot.WriteFieldEnd(ctx); err != nil { 8060 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:encodings: ", p), err) 8061 } 8062 return err 8063 } 8064 8065 func (p *ColumnMetaData) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 8066 if err := oprot.WriteFieldBegin(ctx, "path_in_schema", thrift.LIST, 3); err != nil { 8067 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:path_in_schema: ", p), err) 8068 } 8069 if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.PathInSchema)); err != nil { 8070 return thrift.PrependError("error writing list begin: ", err) 8071 } 8072 for _, v := range p.PathInSchema { 8073 if err := oprot.WriteString(ctx, string(v)); err != nil { 8074 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) 8075 } 8076 } 8077 if err := oprot.WriteListEnd(ctx); err != nil { 8078 return thrift.PrependError("error writing list end: ", err) 8079 } 8080 if err := oprot.WriteFieldEnd(ctx); err != nil { 8081 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:path_in_schema: ", p), err) 8082 } 8083 return err 8084 } 8085 8086 func (p *ColumnMetaData) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 8087 if err := oprot.WriteFieldBegin(ctx, "codec", thrift.I32, 4); err != nil { 8088 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:codec: ", p), err) 8089 } 8090 if err := oprot.WriteI32(ctx, int32(p.Codec)); err != nil { 8091 return thrift.PrependError(fmt.Sprintf("%T.codec (4) field write error: ", p), err) 8092 } 8093 if err := oprot.WriteFieldEnd(ctx); err != nil { 8094 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:codec: ", p), err) 8095 } 8096 return err 8097 } 8098 8099 func (p *ColumnMetaData) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 8100 if err := oprot.WriteFieldBegin(ctx, "num_values", thrift.I64, 5); err != nil { 8101 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:num_values: ", p), err) 8102 } 8103 if err := oprot.WriteI64(ctx, int64(p.NumValues)); err != nil { 8104 return thrift.PrependError(fmt.Sprintf("%T.num_values (5) field write error: ", p), err) 8105 } 8106 if err := oprot.WriteFieldEnd(ctx); err != nil { 8107 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:num_values: ", p), err) 8108 } 8109 return err 8110 } 8111 8112 func (p *ColumnMetaData) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 8113 if err := oprot.WriteFieldBegin(ctx, "total_uncompressed_size", thrift.I64, 6); err != nil { 8114 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:total_uncompressed_size: ", p), err) 8115 } 8116 if err := oprot.WriteI64(ctx, int64(p.TotalUncompressedSize)); err != nil { 8117 return thrift.PrependError(fmt.Sprintf("%T.total_uncompressed_size (6) field write error: ", p), err) 8118 } 8119 if err := oprot.WriteFieldEnd(ctx); err != nil { 8120 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:total_uncompressed_size: ", p), err) 8121 } 8122 return err 8123 } 8124 8125 func (p *ColumnMetaData) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 8126 if err := oprot.WriteFieldBegin(ctx, "total_compressed_size", thrift.I64, 7); err != nil { 8127 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:total_compressed_size: ", p), err) 8128 } 8129 if err := oprot.WriteI64(ctx, int64(p.TotalCompressedSize)); err != nil { 8130 return thrift.PrependError(fmt.Sprintf("%T.total_compressed_size (7) field write error: ", p), err) 8131 } 8132 if err := oprot.WriteFieldEnd(ctx); err != nil { 8133 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:total_compressed_size: ", p), err) 8134 } 8135 return err 8136 } 8137 8138 func (p *ColumnMetaData) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 8139 if p.IsSetKeyValueMetadata() { 8140 if err := oprot.WriteFieldBegin(ctx, "key_value_metadata", thrift.LIST, 8); err != nil { 8141 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:key_value_metadata: ", p), err) 8142 } 8143 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.KeyValueMetadata)); err != nil { 8144 return thrift.PrependError("error writing list begin: ", err) 8145 } 8146 for _, v := range p.KeyValueMetadata { 8147 if err := v.Write(ctx, oprot); err != nil { 8148 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 8149 } 8150 } 8151 if err := oprot.WriteListEnd(ctx); err != nil { 8152 return thrift.PrependError("error writing list end: ", err) 8153 } 8154 if err := oprot.WriteFieldEnd(ctx); err != nil { 8155 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:key_value_metadata: ", p), err) 8156 } 8157 } 8158 return err 8159 } 8160 8161 func (p *ColumnMetaData) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { 8162 if err := oprot.WriteFieldBegin(ctx, "data_page_offset", thrift.I64, 9); err != nil { 8163 return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:data_page_offset: ", p), err) 8164 } 8165 if err := oprot.WriteI64(ctx, int64(p.DataPageOffset)); err != nil { 8166 return thrift.PrependError(fmt.Sprintf("%T.data_page_offset (9) field write error: ", p), err) 8167 } 8168 if err := oprot.WriteFieldEnd(ctx); err != nil { 8169 return thrift.PrependError(fmt.Sprintf("%T write field end error 9:data_page_offset: ", p), err) 8170 } 8171 return err 8172 } 8173 8174 func (p *ColumnMetaData) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { 8175 if p.IsSetIndexPageOffset() { 8176 if err := oprot.WriteFieldBegin(ctx, "index_page_offset", thrift.I64, 10); err != nil { 8177 return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:index_page_offset: ", p), err) 8178 } 8179 if err := oprot.WriteI64(ctx, int64(*p.IndexPageOffset)); err != nil { 8180 return thrift.PrependError(fmt.Sprintf("%T.index_page_offset (10) field write error: ", p), err) 8181 } 8182 if err := oprot.WriteFieldEnd(ctx); err != nil { 8183 return thrift.PrependError(fmt.Sprintf("%T write field end error 10:index_page_offset: ", p), err) 8184 } 8185 } 8186 return err 8187 } 8188 8189 func (p *ColumnMetaData) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { 8190 if p.IsSetDictionaryPageOffset() { 8191 if err := oprot.WriteFieldBegin(ctx, "dictionary_page_offset", thrift.I64, 11); err != nil { 8192 return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:dictionary_page_offset: ", p), err) 8193 } 8194 if err := oprot.WriteI64(ctx, int64(*p.DictionaryPageOffset)); err != nil { 8195 return thrift.PrependError(fmt.Sprintf("%T.dictionary_page_offset (11) field write error: ", p), err) 8196 } 8197 if err := oprot.WriteFieldEnd(ctx); err != nil { 8198 return thrift.PrependError(fmt.Sprintf("%T write field end error 11:dictionary_page_offset: ", p), err) 8199 } 8200 } 8201 return err 8202 } 8203 8204 func (p *ColumnMetaData) writeField12(ctx context.Context, oprot thrift.TProtocol) (err error) { 8205 if p.IsSetStatistics() { 8206 if err := oprot.WriteFieldBegin(ctx, "statistics", thrift.STRUCT, 12); err != nil { 8207 return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:statistics: ", p), err) 8208 } 8209 if err := p.Statistics.Write(ctx, oprot); err != nil { 8210 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Statistics), err) 8211 } 8212 if err := oprot.WriteFieldEnd(ctx); err != nil { 8213 return thrift.PrependError(fmt.Sprintf("%T write field end error 12:statistics: ", p), err) 8214 } 8215 } 8216 return err 8217 } 8218 8219 func (p *ColumnMetaData) writeField13(ctx context.Context, oprot thrift.TProtocol) (err error) { 8220 if p.IsSetEncodingStats() { 8221 if err := oprot.WriteFieldBegin(ctx, "encoding_stats", thrift.LIST, 13); err != nil { 8222 return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:encoding_stats: ", p), err) 8223 } 8224 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.EncodingStats)); err != nil { 8225 return thrift.PrependError("error writing list begin: ", err) 8226 } 8227 for _, v := range p.EncodingStats { 8228 if err := v.Write(ctx, oprot); err != nil { 8229 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 8230 } 8231 } 8232 if err := oprot.WriteListEnd(ctx); err != nil { 8233 return thrift.PrependError("error writing list end: ", err) 8234 } 8235 if err := oprot.WriteFieldEnd(ctx); err != nil { 8236 return thrift.PrependError(fmt.Sprintf("%T write field end error 13:encoding_stats: ", p), err) 8237 } 8238 } 8239 return err 8240 } 8241 8242 func (p *ColumnMetaData) writeField14(ctx context.Context, oprot thrift.TProtocol) (err error) { 8243 if p.IsSetBloomFilterOffset() { 8244 if err := oprot.WriteFieldBegin(ctx, "bloom_filter_offset", thrift.I64, 14); err != nil { 8245 return thrift.PrependError(fmt.Sprintf("%T write field begin error 14:bloom_filter_offset: ", p), err) 8246 } 8247 if err := oprot.WriteI64(ctx, int64(*p.BloomFilterOffset)); err != nil { 8248 return thrift.PrependError(fmt.Sprintf("%T.bloom_filter_offset (14) field write error: ", p), err) 8249 } 8250 if err := oprot.WriteFieldEnd(ctx); err != nil { 8251 return thrift.PrependError(fmt.Sprintf("%T write field end error 14:bloom_filter_offset: ", p), err) 8252 } 8253 } 8254 return err 8255 } 8256 8257 func (p *ColumnMetaData) Equals(other *ColumnMetaData) bool { 8258 if p == other { 8259 return true 8260 } else if p == nil || other == nil { 8261 return false 8262 } 8263 if p.Type != other.Type { 8264 return false 8265 } 8266 if len(p.Encodings) != len(other.Encodings) { 8267 return false 8268 } 8269 for i, _tgt := range p.Encodings { 8270 _src4 := other.Encodings[i] 8271 if _tgt != _src4 { 8272 return false 8273 } 8274 } 8275 if len(p.PathInSchema) != len(other.PathInSchema) { 8276 return false 8277 } 8278 for i, _tgt := range p.PathInSchema { 8279 _src5 := other.PathInSchema[i] 8280 if _tgt != _src5 { 8281 return false 8282 } 8283 } 8284 if p.Codec != other.Codec { 8285 return false 8286 } 8287 if p.NumValues != other.NumValues { 8288 return false 8289 } 8290 if p.TotalUncompressedSize != other.TotalUncompressedSize { 8291 return false 8292 } 8293 if p.TotalCompressedSize != other.TotalCompressedSize { 8294 return false 8295 } 8296 if len(p.KeyValueMetadata) != len(other.KeyValueMetadata) { 8297 return false 8298 } 8299 for i, _tgt := range p.KeyValueMetadata { 8300 _src6 := other.KeyValueMetadata[i] 8301 if !_tgt.Equals(_src6) { 8302 return false 8303 } 8304 } 8305 if p.DataPageOffset != other.DataPageOffset { 8306 return false 8307 } 8308 if p.IndexPageOffset != other.IndexPageOffset { 8309 if p.IndexPageOffset == nil || other.IndexPageOffset == nil { 8310 return false 8311 } 8312 if (*p.IndexPageOffset) != (*other.IndexPageOffset) { 8313 return false 8314 } 8315 } 8316 if p.DictionaryPageOffset != other.DictionaryPageOffset { 8317 if p.DictionaryPageOffset == nil || other.DictionaryPageOffset == nil { 8318 return false 8319 } 8320 if (*p.DictionaryPageOffset) != (*other.DictionaryPageOffset) { 8321 return false 8322 } 8323 } 8324 if !p.Statistics.Equals(other.Statistics) { 8325 return false 8326 } 8327 if len(p.EncodingStats) != len(other.EncodingStats) { 8328 return false 8329 } 8330 for i, _tgt := range p.EncodingStats { 8331 _src7 := other.EncodingStats[i] 8332 if !_tgt.Equals(_src7) { 8333 return false 8334 } 8335 } 8336 if p.BloomFilterOffset != other.BloomFilterOffset { 8337 if p.BloomFilterOffset == nil || other.BloomFilterOffset == nil { 8338 return false 8339 } 8340 if (*p.BloomFilterOffset) != (*other.BloomFilterOffset) { 8341 return false 8342 } 8343 } 8344 return true 8345 } 8346 8347 func (p *ColumnMetaData) String() string { 8348 if p == nil { 8349 return "<nil>" 8350 } 8351 return fmt.Sprintf("ColumnMetaData(%+v)", *p) 8352 } 8353 8354 type EncryptionWithFooterKey struct { 8355 } 8356 8357 func NewEncryptionWithFooterKey() *EncryptionWithFooterKey { 8358 return &EncryptionWithFooterKey{} 8359 } 8360 8361 func (p *EncryptionWithFooterKey) Read(ctx context.Context, iprot thrift.TProtocol) error { 8362 if _, err := iprot.ReadStructBegin(ctx); err != nil { 8363 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 8364 } 8365 8366 for { 8367 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 8368 if err != nil { 8369 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 8370 } 8371 if fieldTypeId == thrift.STOP { 8372 break 8373 } 8374 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8375 return err 8376 } 8377 if err := iprot.ReadFieldEnd(ctx); err != nil { 8378 return err 8379 } 8380 } 8381 if err := iprot.ReadStructEnd(ctx); err != nil { 8382 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 8383 } 8384 return nil 8385 } 8386 8387 func (p *EncryptionWithFooterKey) Write(ctx context.Context, oprot thrift.TProtocol) error { 8388 if err := oprot.WriteStructBegin(ctx, "EncryptionWithFooterKey"); err != nil { 8389 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 8390 } 8391 if p != nil { 8392 } 8393 if err := oprot.WriteFieldStop(ctx); err != nil { 8394 return thrift.PrependError("write field stop error: ", err) 8395 } 8396 if err := oprot.WriteStructEnd(ctx); err != nil { 8397 return thrift.PrependError("write struct stop error: ", err) 8398 } 8399 return nil 8400 } 8401 8402 func (p *EncryptionWithFooterKey) Equals(other *EncryptionWithFooterKey) bool { 8403 if p == other { 8404 return true 8405 } else if p == nil || other == nil { 8406 return false 8407 } 8408 return true 8409 } 8410 8411 func (p *EncryptionWithFooterKey) String() string { 8412 if p == nil { 8413 return "<nil>" 8414 } 8415 return fmt.Sprintf("EncryptionWithFooterKey(%+v)", *p) 8416 } 8417 8418 // Attributes: 8419 // - PathInSchema: Column path in schema * 8420 // - KeyMetadata: Retrieval metadata of column encryption key * 8421 type EncryptionWithColumnKey struct { 8422 PathInSchema []string `thrift:"path_in_schema,1,required" db:"path_in_schema" json:"path_in_schema"` 8423 KeyMetadata []byte `thrift:"key_metadata,2" db:"key_metadata" json:"key_metadata,omitempty"` 8424 } 8425 8426 func NewEncryptionWithColumnKey() *EncryptionWithColumnKey { 8427 return &EncryptionWithColumnKey{} 8428 } 8429 8430 func (p *EncryptionWithColumnKey) GetPathInSchema() []string { 8431 return p.PathInSchema 8432 } 8433 8434 var EncryptionWithColumnKey_KeyMetadata_DEFAULT []byte 8435 8436 func (p *EncryptionWithColumnKey) GetKeyMetadata() []byte { 8437 return p.KeyMetadata 8438 } 8439 func (p *EncryptionWithColumnKey) IsSetKeyMetadata() bool { 8440 return p.KeyMetadata != nil 8441 } 8442 8443 func (p *EncryptionWithColumnKey) Read(ctx context.Context, iprot thrift.TProtocol) error { 8444 if _, err := iprot.ReadStructBegin(ctx); err != nil { 8445 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 8446 } 8447 8448 var issetPathInSchema bool = false 8449 8450 for { 8451 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 8452 if err != nil { 8453 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 8454 } 8455 if fieldTypeId == thrift.STOP { 8456 break 8457 } 8458 switch fieldId { 8459 case 1: 8460 if fieldTypeId == thrift.LIST { 8461 if err := p.ReadField1(ctx, iprot); err != nil { 8462 return err 8463 } 8464 issetPathInSchema = true 8465 } else { 8466 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8467 return err 8468 } 8469 } 8470 case 2: 8471 if fieldTypeId == thrift.STRING { 8472 if err := p.ReadField2(ctx, iprot); err != nil { 8473 return err 8474 } 8475 } else { 8476 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8477 return err 8478 } 8479 } 8480 default: 8481 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8482 return err 8483 } 8484 } 8485 if err := iprot.ReadFieldEnd(ctx); err != nil { 8486 return err 8487 } 8488 } 8489 if err := iprot.ReadStructEnd(ctx); err != nil { 8490 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 8491 } 8492 if !issetPathInSchema { 8493 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PathInSchema is not set")) 8494 } 8495 return nil 8496 } 8497 8498 func (p *EncryptionWithColumnKey) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 8499 _, size, err := iprot.ReadListBegin(ctx) 8500 if size < 0 { 8501 return errors.New("list size is negative") 8502 } 8503 if err != nil { 8504 return thrift.PrependError("error reading list begin: ", err) 8505 } 8506 tSlice := make([]string, 0, size) 8507 p.PathInSchema = tSlice 8508 for i := 0; i < size; i++ { 8509 var _elem8 string 8510 if v, err := iprot.ReadString(ctx); err != nil { 8511 return thrift.PrependError("error reading field 0: ", err) 8512 } else { 8513 _elem8 = v 8514 } 8515 p.PathInSchema = append(p.PathInSchema, _elem8) 8516 } 8517 if err := iprot.ReadListEnd(ctx); err != nil { 8518 return thrift.PrependError("error reading list end: ", err) 8519 } 8520 return nil 8521 } 8522 8523 func (p *EncryptionWithColumnKey) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 8524 if v, err := iprot.ReadBinary(ctx); err != nil { 8525 return thrift.PrependError("error reading field 2: ", err) 8526 } else { 8527 p.KeyMetadata = v 8528 } 8529 return nil 8530 } 8531 8532 func (p *EncryptionWithColumnKey) Write(ctx context.Context, oprot thrift.TProtocol) error { 8533 if err := oprot.WriteStructBegin(ctx, "EncryptionWithColumnKey"); err != nil { 8534 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 8535 } 8536 if p != nil { 8537 if err := p.writeField1(ctx, oprot); err != nil { 8538 return err 8539 } 8540 if err := p.writeField2(ctx, oprot); err != nil { 8541 return err 8542 } 8543 } 8544 if err := oprot.WriteFieldStop(ctx); err != nil { 8545 return thrift.PrependError("write field stop error: ", err) 8546 } 8547 if err := oprot.WriteStructEnd(ctx); err != nil { 8548 return thrift.PrependError("write struct stop error: ", err) 8549 } 8550 return nil 8551 } 8552 8553 func (p *EncryptionWithColumnKey) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 8554 if err := oprot.WriteFieldBegin(ctx, "path_in_schema", thrift.LIST, 1); err != nil { 8555 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:path_in_schema: ", p), err) 8556 } 8557 if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.PathInSchema)); err != nil { 8558 return thrift.PrependError("error writing list begin: ", err) 8559 } 8560 for _, v := range p.PathInSchema { 8561 if err := oprot.WriteString(ctx, string(v)); err != nil { 8562 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) 8563 } 8564 } 8565 if err := oprot.WriteListEnd(ctx); err != nil { 8566 return thrift.PrependError("error writing list end: ", err) 8567 } 8568 if err := oprot.WriteFieldEnd(ctx); err != nil { 8569 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:path_in_schema: ", p), err) 8570 } 8571 return err 8572 } 8573 8574 func (p *EncryptionWithColumnKey) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 8575 if p.IsSetKeyMetadata() { 8576 if err := oprot.WriteFieldBegin(ctx, "key_metadata", thrift.STRING, 2); err != nil { 8577 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:key_metadata: ", p), err) 8578 } 8579 if err := oprot.WriteBinary(ctx, p.KeyMetadata); err != nil { 8580 return thrift.PrependError(fmt.Sprintf("%T.key_metadata (2) field write error: ", p), err) 8581 } 8582 if err := oprot.WriteFieldEnd(ctx); err != nil { 8583 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:key_metadata: ", p), err) 8584 } 8585 } 8586 return err 8587 } 8588 8589 func (p *EncryptionWithColumnKey) Equals(other *EncryptionWithColumnKey) bool { 8590 if p == other { 8591 return true 8592 } else if p == nil || other == nil { 8593 return false 8594 } 8595 if len(p.PathInSchema) != len(other.PathInSchema) { 8596 return false 8597 } 8598 for i, _tgt := range p.PathInSchema { 8599 _src9 := other.PathInSchema[i] 8600 if _tgt != _src9 { 8601 return false 8602 } 8603 } 8604 if bytes.Compare(p.KeyMetadata, other.KeyMetadata) != 0 { 8605 return false 8606 } 8607 return true 8608 } 8609 8610 func (p *EncryptionWithColumnKey) String() string { 8611 if p == nil { 8612 return "<nil>" 8613 } 8614 return fmt.Sprintf("EncryptionWithColumnKey(%+v)", *p) 8615 } 8616 8617 // Attributes: 8618 // - ENCRYPTION_WITH_FOOTER_KEY 8619 // - ENCRYPTION_WITH_COLUMN_KEY 8620 type ColumnCryptoMetaData struct { 8621 ENCRYPTION_WITH_FOOTER_KEY *EncryptionWithFooterKey `thrift:"ENCRYPTION_WITH_FOOTER_KEY,1" db:"ENCRYPTION_WITH_FOOTER_KEY" json:"ENCRYPTION_WITH_FOOTER_KEY,omitempty"` 8622 ENCRYPTION_WITH_COLUMN_KEY *EncryptionWithColumnKey `thrift:"ENCRYPTION_WITH_COLUMN_KEY,2" db:"ENCRYPTION_WITH_COLUMN_KEY" json:"ENCRYPTION_WITH_COLUMN_KEY,omitempty"` 8623 } 8624 8625 func NewColumnCryptoMetaData() *ColumnCryptoMetaData { 8626 return &ColumnCryptoMetaData{} 8627 } 8628 8629 var ColumnCryptoMetaData_ENCRYPTION_WITH_FOOTER_KEY_DEFAULT *EncryptionWithFooterKey 8630 8631 func (p *ColumnCryptoMetaData) GetENCRYPTION_WITH_FOOTER_KEY() *EncryptionWithFooterKey { 8632 if !p.IsSetENCRYPTION_WITH_FOOTER_KEY() { 8633 return ColumnCryptoMetaData_ENCRYPTION_WITH_FOOTER_KEY_DEFAULT 8634 } 8635 return p.ENCRYPTION_WITH_FOOTER_KEY 8636 } 8637 8638 var ColumnCryptoMetaData_ENCRYPTION_WITH_COLUMN_KEY_DEFAULT *EncryptionWithColumnKey 8639 8640 func (p *ColumnCryptoMetaData) GetENCRYPTION_WITH_COLUMN_KEY() *EncryptionWithColumnKey { 8641 if !p.IsSetENCRYPTION_WITH_COLUMN_KEY() { 8642 return ColumnCryptoMetaData_ENCRYPTION_WITH_COLUMN_KEY_DEFAULT 8643 } 8644 return p.ENCRYPTION_WITH_COLUMN_KEY 8645 } 8646 func (p *ColumnCryptoMetaData) CountSetFieldsColumnCryptoMetaData() int { 8647 count := 0 8648 if p.IsSetENCRYPTION_WITH_FOOTER_KEY() { 8649 count++ 8650 } 8651 if p.IsSetENCRYPTION_WITH_COLUMN_KEY() { 8652 count++ 8653 } 8654 return count 8655 8656 } 8657 8658 func (p *ColumnCryptoMetaData) IsSetENCRYPTION_WITH_FOOTER_KEY() bool { 8659 return p.ENCRYPTION_WITH_FOOTER_KEY != nil 8660 } 8661 8662 func (p *ColumnCryptoMetaData) IsSetENCRYPTION_WITH_COLUMN_KEY() bool { 8663 return p.ENCRYPTION_WITH_COLUMN_KEY != nil 8664 } 8665 8666 func (p *ColumnCryptoMetaData) Read(ctx context.Context, iprot thrift.TProtocol) error { 8667 if _, err := iprot.ReadStructBegin(ctx); err != nil { 8668 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 8669 } 8670 8671 for { 8672 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 8673 if err != nil { 8674 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 8675 } 8676 if fieldTypeId == thrift.STOP { 8677 break 8678 } 8679 switch fieldId { 8680 case 1: 8681 if fieldTypeId == thrift.STRUCT { 8682 if err := p.ReadField1(ctx, iprot); err != nil { 8683 return err 8684 } 8685 } else { 8686 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8687 return err 8688 } 8689 } 8690 case 2: 8691 if fieldTypeId == thrift.STRUCT { 8692 if err := p.ReadField2(ctx, iprot); err != nil { 8693 return err 8694 } 8695 } else { 8696 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8697 return err 8698 } 8699 } 8700 default: 8701 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8702 return err 8703 } 8704 } 8705 if err := iprot.ReadFieldEnd(ctx); err != nil { 8706 return err 8707 } 8708 } 8709 if err := iprot.ReadStructEnd(ctx); err != nil { 8710 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 8711 } 8712 return nil 8713 } 8714 8715 func (p *ColumnCryptoMetaData) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 8716 p.ENCRYPTION_WITH_FOOTER_KEY = &EncryptionWithFooterKey{} 8717 if err := p.ENCRYPTION_WITH_FOOTER_KEY.Read(ctx, iprot); err != nil { 8718 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ENCRYPTION_WITH_FOOTER_KEY), err) 8719 } 8720 return nil 8721 } 8722 8723 func (p *ColumnCryptoMetaData) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 8724 p.ENCRYPTION_WITH_COLUMN_KEY = &EncryptionWithColumnKey{} 8725 if err := p.ENCRYPTION_WITH_COLUMN_KEY.Read(ctx, iprot); err != nil { 8726 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ENCRYPTION_WITH_COLUMN_KEY), err) 8727 } 8728 return nil 8729 } 8730 8731 func (p *ColumnCryptoMetaData) Write(ctx context.Context, oprot thrift.TProtocol) error { 8732 if c := p.CountSetFieldsColumnCryptoMetaData(); c != 1 { 8733 return fmt.Errorf("%T write union: exactly one field must be set (%d set)", p, c) 8734 } 8735 if err := oprot.WriteStructBegin(ctx, "ColumnCryptoMetaData"); err != nil { 8736 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 8737 } 8738 if p != nil { 8739 if err := p.writeField1(ctx, oprot); err != nil { 8740 return err 8741 } 8742 if err := p.writeField2(ctx, oprot); err != nil { 8743 return err 8744 } 8745 } 8746 if err := oprot.WriteFieldStop(ctx); err != nil { 8747 return thrift.PrependError("write field stop error: ", err) 8748 } 8749 if err := oprot.WriteStructEnd(ctx); err != nil { 8750 return thrift.PrependError("write struct stop error: ", err) 8751 } 8752 return nil 8753 } 8754 8755 func (p *ColumnCryptoMetaData) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 8756 if p.IsSetENCRYPTION_WITH_FOOTER_KEY() { 8757 if err := oprot.WriteFieldBegin(ctx, "ENCRYPTION_WITH_FOOTER_KEY", thrift.STRUCT, 1); err != nil { 8758 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ENCRYPTION_WITH_FOOTER_KEY: ", p), err) 8759 } 8760 if err := p.ENCRYPTION_WITH_FOOTER_KEY.Write(ctx, oprot); err != nil { 8761 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ENCRYPTION_WITH_FOOTER_KEY), err) 8762 } 8763 if err := oprot.WriteFieldEnd(ctx); err != nil { 8764 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ENCRYPTION_WITH_FOOTER_KEY: ", p), err) 8765 } 8766 } 8767 return err 8768 } 8769 8770 func (p *ColumnCryptoMetaData) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 8771 if p.IsSetENCRYPTION_WITH_COLUMN_KEY() { 8772 if err := oprot.WriteFieldBegin(ctx, "ENCRYPTION_WITH_COLUMN_KEY", thrift.STRUCT, 2); err != nil { 8773 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:ENCRYPTION_WITH_COLUMN_KEY: ", p), err) 8774 } 8775 if err := p.ENCRYPTION_WITH_COLUMN_KEY.Write(ctx, oprot); err != nil { 8776 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ENCRYPTION_WITH_COLUMN_KEY), err) 8777 } 8778 if err := oprot.WriteFieldEnd(ctx); err != nil { 8779 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:ENCRYPTION_WITH_COLUMN_KEY: ", p), err) 8780 } 8781 } 8782 return err 8783 } 8784 8785 func (p *ColumnCryptoMetaData) Equals(other *ColumnCryptoMetaData) bool { 8786 if p == other { 8787 return true 8788 } else if p == nil || other == nil { 8789 return false 8790 } 8791 if !p.ENCRYPTION_WITH_FOOTER_KEY.Equals(other.ENCRYPTION_WITH_FOOTER_KEY) { 8792 return false 8793 } 8794 if !p.ENCRYPTION_WITH_COLUMN_KEY.Equals(other.ENCRYPTION_WITH_COLUMN_KEY) { 8795 return false 8796 } 8797 return true 8798 } 8799 8800 func (p *ColumnCryptoMetaData) String() string { 8801 if p == nil { 8802 return "<nil>" 8803 } 8804 return fmt.Sprintf("ColumnCryptoMetaData(%+v)", *p) 8805 } 8806 8807 // Attributes: 8808 // - FilePath: File where column data is stored. If not set, assumed to be same file as 8809 // metadata. This path is relative to the current file. 8810 // 8811 // - FileOffset: Byte offset in file_path to the ColumnMetaData * 8812 // - MetaData: Column metadata for this chunk. This is the same content as what is at 8813 // file_path/file_offset. Having it here has it replicated in the file 8814 // metadata. 8815 // 8816 // - OffsetIndexOffset: File offset of ColumnChunk's OffsetIndex * 8817 // - OffsetIndexLength: Size of ColumnChunk's OffsetIndex, in bytes * 8818 // - ColumnIndexOffset: File offset of ColumnChunk's ColumnIndex * 8819 // - ColumnIndexLength: Size of ColumnChunk's ColumnIndex, in bytes * 8820 // - CryptoMetadata: Crypto metadata of encrypted columns * 8821 // - EncryptedColumnMetadata: Encrypted column metadata for this chunk * 8822 type ColumnChunk struct { 8823 FilePath *string `thrift:"file_path,1" db:"file_path" json:"file_path,omitempty"` 8824 FileOffset int64 `thrift:"file_offset,2,required" db:"file_offset" json:"file_offset"` 8825 MetaData *ColumnMetaData `thrift:"meta_data,3" db:"meta_data" json:"meta_data,omitempty"` 8826 OffsetIndexOffset *int64 `thrift:"offset_index_offset,4" db:"offset_index_offset" json:"offset_index_offset,omitempty"` 8827 OffsetIndexLength *int32 `thrift:"offset_index_length,5" db:"offset_index_length" json:"offset_index_length,omitempty"` 8828 ColumnIndexOffset *int64 `thrift:"column_index_offset,6" db:"column_index_offset" json:"column_index_offset,omitempty"` 8829 ColumnIndexLength *int32 `thrift:"column_index_length,7" db:"column_index_length" json:"column_index_length,omitempty"` 8830 CryptoMetadata *ColumnCryptoMetaData `thrift:"crypto_metadata,8" db:"crypto_metadata" json:"crypto_metadata,omitempty"` 8831 EncryptedColumnMetadata []byte `thrift:"encrypted_column_metadata,9" db:"encrypted_column_metadata" json:"encrypted_column_metadata,omitempty"` 8832 } 8833 8834 func NewColumnChunk() *ColumnChunk { 8835 return &ColumnChunk{} 8836 } 8837 8838 var ColumnChunk_FilePath_DEFAULT string 8839 8840 func (p *ColumnChunk) GetFilePath() string { 8841 if !p.IsSetFilePath() { 8842 return ColumnChunk_FilePath_DEFAULT 8843 } 8844 return *p.FilePath 8845 } 8846 8847 func (p *ColumnChunk) GetFileOffset() int64 { 8848 return p.FileOffset 8849 } 8850 8851 var ColumnChunk_MetaData_DEFAULT *ColumnMetaData 8852 8853 func (p *ColumnChunk) GetMetaData() *ColumnMetaData { 8854 if !p.IsSetMetaData() { 8855 return ColumnChunk_MetaData_DEFAULT 8856 } 8857 return p.MetaData 8858 } 8859 8860 var ColumnChunk_OffsetIndexOffset_DEFAULT int64 8861 8862 func (p *ColumnChunk) GetOffsetIndexOffset() int64 { 8863 if !p.IsSetOffsetIndexOffset() { 8864 return ColumnChunk_OffsetIndexOffset_DEFAULT 8865 } 8866 return *p.OffsetIndexOffset 8867 } 8868 8869 var ColumnChunk_OffsetIndexLength_DEFAULT int32 8870 8871 func (p *ColumnChunk) GetOffsetIndexLength() int32 { 8872 if !p.IsSetOffsetIndexLength() { 8873 return ColumnChunk_OffsetIndexLength_DEFAULT 8874 } 8875 return *p.OffsetIndexLength 8876 } 8877 8878 var ColumnChunk_ColumnIndexOffset_DEFAULT int64 8879 8880 func (p *ColumnChunk) GetColumnIndexOffset() int64 { 8881 if !p.IsSetColumnIndexOffset() { 8882 return ColumnChunk_ColumnIndexOffset_DEFAULT 8883 } 8884 return *p.ColumnIndexOffset 8885 } 8886 8887 var ColumnChunk_ColumnIndexLength_DEFAULT int32 8888 8889 func (p *ColumnChunk) GetColumnIndexLength() int32 { 8890 if !p.IsSetColumnIndexLength() { 8891 return ColumnChunk_ColumnIndexLength_DEFAULT 8892 } 8893 return *p.ColumnIndexLength 8894 } 8895 8896 var ColumnChunk_CryptoMetadata_DEFAULT *ColumnCryptoMetaData 8897 8898 func (p *ColumnChunk) GetCryptoMetadata() *ColumnCryptoMetaData { 8899 if !p.IsSetCryptoMetadata() { 8900 return ColumnChunk_CryptoMetadata_DEFAULT 8901 } 8902 return p.CryptoMetadata 8903 } 8904 8905 var ColumnChunk_EncryptedColumnMetadata_DEFAULT []byte 8906 8907 func (p *ColumnChunk) GetEncryptedColumnMetadata() []byte { 8908 return p.EncryptedColumnMetadata 8909 } 8910 func (p *ColumnChunk) IsSetFilePath() bool { 8911 return p.FilePath != nil 8912 } 8913 8914 func (p *ColumnChunk) IsSetMetaData() bool { 8915 return p.MetaData != nil 8916 } 8917 8918 func (p *ColumnChunk) IsSetOffsetIndexOffset() bool { 8919 return p.OffsetIndexOffset != nil 8920 } 8921 8922 func (p *ColumnChunk) IsSetOffsetIndexLength() bool { 8923 return p.OffsetIndexLength != nil 8924 } 8925 8926 func (p *ColumnChunk) IsSetColumnIndexOffset() bool { 8927 return p.ColumnIndexOffset != nil 8928 } 8929 8930 func (p *ColumnChunk) IsSetColumnIndexLength() bool { 8931 return p.ColumnIndexLength != nil 8932 } 8933 8934 func (p *ColumnChunk) IsSetCryptoMetadata() bool { 8935 return p.CryptoMetadata != nil 8936 } 8937 8938 func (p *ColumnChunk) IsSetEncryptedColumnMetadata() bool { 8939 return p.EncryptedColumnMetadata != nil 8940 } 8941 8942 func (p *ColumnChunk) Read(ctx context.Context, iprot thrift.TProtocol) error { 8943 if _, err := iprot.ReadStructBegin(ctx); err != nil { 8944 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 8945 } 8946 8947 var issetFileOffset bool = false 8948 8949 for { 8950 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 8951 if err != nil { 8952 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 8953 } 8954 if fieldTypeId == thrift.STOP { 8955 break 8956 } 8957 switch fieldId { 8958 case 1: 8959 if fieldTypeId == thrift.STRING { 8960 if err := p.ReadField1(ctx, iprot); err != nil { 8961 return err 8962 } 8963 } else { 8964 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8965 return err 8966 } 8967 } 8968 case 2: 8969 if fieldTypeId == thrift.I64 { 8970 if err := p.ReadField2(ctx, iprot); err != nil { 8971 return err 8972 } 8973 issetFileOffset = true 8974 } else { 8975 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8976 return err 8977 } 8978 } 8979 case 3: 8980 if fieldTypeId == thrift.STRUCT { 8981 if err := p.ReadField3(ctx, iprot); err != nil { 8982 return err 8983 } 8984 } else { 8985 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8986 return err 8987 } 8988 } 8989 case 4: 8990 if fieldTypeId == thrift.I64 { 8991 if err := p.ReadField4(ctx, iprot); err != nil { 8992 return err 8993 } 8994 } else { 8995 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 8996 return err 8997 } 8998 } 8999 case 5: 9000 if fieldTypeId == thrift.I32 { 9001 if err := p.ReadField5(ctx, iprot); err != nil { 9002 return err 9003 } 9004 } else { 9005 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9006 return err 9007 } 9008 } 9009 case 6: 9010 if fieldTypeId == thrift.I64 { 9011 if err := p.ReadField6(ctx, iprot); err != nil { 9012 return err 9013 } 9014 } else { 9015 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9016 return err 9017 } 9018 } 9019 case 7: 9020 if fieldTypeId == thrift.I32 { 9021 if err := p.ReadField7(ctx, iprot); err != nil { 9022 return err 9023 } 9024 } else { 9025 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9026 return err 9027 } 9028 } 9029 case 8: 9030 if fieldTypeId == thrift.STRUCT { 9031 if err := p.ReadField8(ctx, iprot); err != nil { 9032 return err 9033 } 9034 } else { 9035 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9036 return err 9037 } 9038 } 9039 case 9: 9040 if fieldTypeId == thrift.STRING { 9041 if err := p.ReadField9(ctx, iprot); err != nil { 9042 return err 9043 } 9044 } else { 9045 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9046 return err 9047 } 9048 } 9049 default: 9050 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9051 return err 9052 } 9053 } 9054 if err := iprot.ReadFieldEnd(ctx); err != nil { 9055 return err 9056 } 9057 } 9058 if err := iprot.ReadStructEnd(ctx); err != nil { 9059 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 9060 } 9061 if !issetFileOffset { 9062 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FileOffset is not set")) 9063 } 9064 return nil 9065 } 9066 9067 func (p *ColumnChunk) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 9068 if v, err := iprot.ReadString(ctx); err != nil { 9069 return thrift.PrependError("error reading field 1: ", err) 9070 } else { 9071 p.FilePath = &v 9072 } 9073 return nil 9074 } 9075 9076 func (p *ColumnChunk) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 9077 if v, err := iprot.ReadI64(ctx); err != nil { 9078 return thrift.PrependError("error reading field 2: ", err) 9079 } else { 9080 p.FileOffset = v 9081 } 9082 return nil 9083 } 9084 9085 func (p *ColumnChunk) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 9086 p.MetaData = &ColumnMetaData{} 9087 if err := p.MetaData.Read(ctx, iprot); err != nil { 9088 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.MetaData), err) 9089 } 9090 return nil 9091 } 9092 9093 func (p *ColumnChunk) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 9094 if v, err := iprot.ReadI64(ctx); err != nil { 9095 return thrift.PrependError("error reading field 4: ", err) 9096 } else { 9097 p.OffsetIndexOffset = &v 9098 } 9099 return nil 9100 } 9101 9102 func (p *ColumnChunk) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 9103 if v, err := iprot.ReadI32(ctx); err != nil { 9104 return thrift.PrependError("error reading field 5: ", err) 9105 } else { 9106 p.OffsetIndexLength = &v 9107 } 9108 return nil 9109 } 9110 9111 func (p *ColumnChunk) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 9112 if v, err := iprot.ReadI64(ctx); err != nil { 9113 return thrift.PrependError("error reading field 6: ", err) 9114 } else { 9115 p.ColumnIndexOffset = &v 9116 } 9117 return nil 9118 } 9119 9120 func (p *ColumnChunk) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 9121 if v, err := iprot.ReadI32(ctx); err != nil { 9122 return thrift.PrependError("error reading field 7: ", err) 9123 } else { 9124 p.ColumnIndexLength = &v 9125 } 9126 return nil 9127 } 9128 9129 func (p *ColumnChunk) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 9130 p.CryptoMetadata = &ColumnCryptoMetaData{} 9131 if err := p.CryptoMetadata.Read(ctx, iprot); err != nil { 9132 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.CryptoMetadata), err) 9133 } 9134 return nil 9135 } 9136 9137 func (p *ColumnChunk) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { 9138 if v, err := iprot.ReadBinary(ctx); err != nil { 9139 return thrift.PrependError("error reading field 9: ", err) 9140 } else { 9141 p.EncryptedColumnMetadata = v 9142 } 9143 return nil 9144 } 9145 9146 func (p *ColumnChunk) Write(ctx context.Context, oprot thrift.TProtocol) error { 9147 if err := oprot.WriteStructBegin(ctx, "ColumnChunk"); err != nil { 9148 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 9149 } 9150 if p != nil { 9151 if err := p.writeField1(ctx, oprot); err != nil { 9152 return err 9153 } 9154 if err := p.writeField2(ctx, oprot); err != nil { 9155 return err 9156 } 9157 if err := p.writeField3(ctx, oprot); err != nil { 9158 return err 9159 } 9160 if err := p.writeField4(ctx, oprot); err != nil { 9161 return err 9162 } 9163 if err := p.writeField5(ctx, oprot); err != nil { 9164 return err 9165 } 9166 if err := p.writeField6(ctx, oprot); err != nil { 9167 return err 9168 } 9169 if err := p.writeField7(ctx, oprot); err != nil { 9170 return err 9171 } 9172 if err := p.writeField8(ctx, oprot); err != nil { 9173 return err 9174 } 9175 if err := p.writeField9(ctx, oprot); err != nil { 9176 return err 9177 } 9178 } 9179 if err := oprot.WriteFieldStop(ctx); err != nil { 9180 return thrift.PrependError("write field stop error: ", err) 9181 } 9182 if err := oprot.WriteStructEnd(ctx); err != nil { 9183 return thrift.PrependError("write struct stop error: ", err) 9184 } 9185 return nil 9186 } 9187 9188 func (p *ColumnChunk) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 9189 if p.IsSetFilePath() { 9190 if err := oprot.WriteFieldBegin(ctx, "file_path", thrift.STRING, 1); err != nil { 9191 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:file_path: ", p), err) 9192 } 9193 if err := oprot.WriteString(ctx, string(*p.FilePath)); err != nil { 9194 return thrift.PrependError(fmt.Sprintf("%T.file_path (1) field write error: ", p), err) 9195 } 9196 if err := oprot.WriteFieldEnd(ctx); err != nil { 9197 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:file_path: ", p), err) 9198 } 9199 } 9200 return err 9201 } 9202 9203 func (p *ColumnChunk) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 9204 if err := oprot.WriteFieldBegin(ctx, "file_offset", thrift.I64, 2); err != nil { 9205 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:file_offset: ", p), err) 9206 } 9207 if err := oprot.WriteI64(ctx, int64(p.FileOffset)); err != nil { 9208 return thrift.PrependError(fmt.Sprintf("%T.file_offset (2) field write error: ", p), err) 9209 } 9210 if err := oprot.WriteFieldEnd(ctx); err != nil { 9211 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:file_offset: ", p), err) 9212 } 9213 return err 9214 } 9215 9216 func (p *ColumnChunk) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 9217 if p.IsSetMetaData() { 9218 if err := oprot.WriteFieldBegin(ctx, "meta_data", thrift.STRUCT, 3); err != nil { 9219 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:meta_data: ", p), err) 9220 } 9221 if err := p.MetaData.Write(ctx, oprot); err != nil { 9222 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.MetaData), err) 9223 } 9224 if err := oprot.WriteFieldEnd(ctx); err != nil { 9225 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:meta_data: ", p), err) 9226 } 9227 } 9228 return err 9229 } 9230 9231 func (p *ColumnChunk) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 9232 if p.IsSetOffsetIndexOffset() { 9233 if err := oprot.WriteFieldBegin(ctx, "offset_index_offset", thrift.I64, 4); err != nil { 9234 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:offset_index_offset: ", p), err) 9235 } 9236 if err := oprot.WriteI64(ctx, int64(*p.OffsetIndexOffset)); err != nil { 9237 return thrift.PrependError(fmt.Sprintf("%T.offset_index_offset (4) field write error: ", p), err) 9238 } 9239 if err := oprot.WriteFieldEnd(ctx); err != nil { 9240 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:offset_index_offset: ", p), err) 9241 } 9242 } 9243 return err 9244 } 9245 9246 func (p *ColumnChunk) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 9247 if p.IsSetOffsetIndexLength() { 9248 if err := oprot.WriteFieldBegin(ctx, "offset_index_length", thrift.I32, 5); err != nil { 9249 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:offset_index_length: ", p), err) 9250 } 9251 if err := oprot.WriteI32(ctx, int32(*p.OffsetIndexLength)); err != nil { 9252 return thrift.PrependError(fmt.Sprintf("%T.offset_index_length (5) field write error: ", p), err) 9253 } 9254 if err := oprot.WriteFieldEnd(ctx); err != nil { 9255 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:offset_index_length: ", p), err) 9256 } 9257 } 9258 return err 9259 } 9260 9261 func (p *ColumnChunk) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 9262 if p.IsSetColumnIndexOffset() { 9263 if err := oprot.WriteFieldBegin(ctx, "column_index_offset", thrift.I64, 6); err != nil { 9264 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:column_index_offset: ", p), err) 9265 } 9266 if err := oprot.WriteI64(ctx, int64(*p.ColumnIndexOffset)); err != nil { 9267 return thrift.PrependError(fmt.Sprintf("%T.column_index_offset (6) field write error: ", p), err) 9268 } 9269 if err := oprot.WriteFieldEnd(ctx); err != nil { 9270 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:column_index_offset: ", p), err) 9271 } 9272 } 9273 return err 9274 } 9275 9276 func (p *ColumnChunk) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 9277 if p.IsSetColumnIndexLength() { 9278 if err := oprot.WriteFieldBegin(ctx, "column_index_length", thrift.I32, 7); err != nil { 9279 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:column_index_length: ", p), err) 9280 } 9281 if err := oprot.WriteI32(ctx, int32(*p.ColumnIndexLength)); err != nil { 9282 return thrift.PrependError(fmt.Sprintf("%T.column_index_length (7) field write error: ", p), err) 9283 } 9284 if err := oprot.WriteFieldEnd(ctx); err != nil { 9285 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:column_index_length: ", p), err) 9286 } 9287 } 9288 return err 9289 } 9290 9291 func (p *ColumnChunk) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 9292 if p.IsSetCryptoMetadata() { 9293 if err := oprot.WriteFieldBegin(ctx, "crypto_metadata", thrift.STRUCT, 8); err != nil { 9294 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:crypto_metadata: ", p), err) 9295 } 9296 if err := p.CryptoMetadata.Write(ctx, oprot); err != nil { 9297 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.CryptoMetadata), err) 9298 } 9299 if err := oprot.WriteFieldEnd(ctx); err != nil { 9300 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:crypto_metadata: ", p), err) 9301 } 9302 } 9303 return err 9304 } 9305 9306 func (p *ColumnChunk) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { 9307 if p.IsSetEncryptedColumnMetadata() { 9308 if err := oprot.WriteFieldBegin(ctx, "encrypted_column_metadata", thrift.STRING, 9); err != nil { 9309 return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:encrypted_column_metadata: ", p), err) 9310 } 9311 if err := oprot.WriteBinary(ctx, p.EncryptedColumnMetadata); err != nil { 9312 return thrift.PrependError(fmt.Sprintf("%T.encrypted_column_metadata (9) field write error: ", p), err) 9313 } 9314 if err := oprot.WriteFieldEnd(ctx); err != nil { 9315 return thrift.PrependError(fmt.Sprintf("%T write field end error 9:encrypted_column_metadata: ", p), err) 9316 } 9317 } 9318 return err 9319 } 9320 9321 func (p *ColumnChunk) Equals(other *ColumnChunk) bool { 9322 if p == other { 9323 return true 9324 } else if p == nil || other == nil { 9325 return false 9326 } 9327 if p.FilePath != other.FilePath { 9328 if p.FilePath == nil || other.FilePath == nil { 9329 return false 9330 } 9331 if (*p.FilePath) != (*other.FilePath) { 9332 return false 9333 } 9334 } 9335 if p.FileOffset != other.FileOffset { 9336 return false 9337 } 9338 if !p.MetaData.Equals(other.MetaData) { 9339 return false 9340 } 9341 if p.OffsetIndexOffset != other.OffsetIndexOffset { 9342 if p.OffsetIndexOffset == nil || other.OffsetIndexOffset == nil { 9343 return false 9344 } 9345 if (*p.OffsetIndexOffset) != (*other.OffsetIndexOffset) { 9346 return false 9347 } 9348 } 9349 if p.OffsetIndexLength != other.OffsetIndexLength { 9350 if p.OffsetIndexLength == nil || other.OffsetIndexLength == nil { 9351 return false 9352 } 9353 if (*p.OffsetIndexLength) != (*other.OffsetIndexLength) { 9354 return false 9355 } 9356 } 9357 if p.ColumnIndexOffset != other.ColumnIndexOffset { 9358 if p.ColumnIndexOffset == nil || other.ColumnIndexOffset == nil { 9359 return false 9360 } 9361 if (*p.ColumnIndexOffset) != (*other.ColumnIndexOffset) { 9362 return false 9363 } 9364 } 9365 if p.ColumnIndexLength != other.ColumnIndexLength { 9366 if p.ColumnIndexLength == nil || other.ColumnIndexLength == nil { 9367 return false 9368 } 9369 if (*p.ColumnIndexLength) != (*other.ColumnIndexLength) { 9370 return false 9371 } 9372 } 9373 if !p.CryptoMetadata.Equals(other.CryptoMetadata) { 9374 return false 9375 } 9376 if bytes.Compare(p.EncryptedColumnMetadata, other.EncryptedColumnMetadata) != 0 { 9377 return false 9378 } 9379 return true 9380 } 9381 9382 func (p *ColumnChunk) String() string { 9383 if p == nil { 9384 return "<nil>" 9385 } 9386 return fmt.Sprintf("ColumnChunk(%+v)", *p) 9387 } 9388 9389 // Attributes: 9390 // - Columns: Metadata for each column chunk in this row group. 9391 // This list must have the same order as the SchemaElement list in FileMetaData. 9392 // 9393 // - TotalByteSize: Total byte size of all the uncompressed column data in this row group * 9394 // - NumRows: Number of rows in this row group * 9395 // - SortingColumns: If set, specifies a sort ordering of the rows in this RowGroup. 9396 // The sorting columns can be a subset of all the columns. 9397 // - FileOffset: Byte offset from beginning of file to first page (data or dictionary) 9398 // in this row group * 9399 // - TotalCompressedSize: Total byte size of all compressed (and potentially encrypted) column data 9400 // in this row group * 9401 // - Ordinal: Row group ordinal in the file * 9402 type RowGroup struct { 9403 Columns []*ColumnChunk `thrift:"columns,1,required" db:"columns" json:"columns"` 9404 TotalByteSize int64 `thrift:"total_byte_size,2,required" db:"total_byte_size" json:"total_byte_size"` 9405 NumRows int64 `thrift:"num_rows,3,required" db:"num_rows" json:"num_rows"` 9406 SortingColumns []*SortingColumn `thrift:"sorting_columns,4" db:"sorting_columns" json:"sorting_columns,omitempty"` 9407 FileOffset *int64 `thrift:"file_offset,5" db:"file_offset" json:"file_offset,omitempty"` 9408 TotalCompressedSize *int64 `thrift:"total_compressed_size,6" db:"total_compressed_size" json:"total_compressed_size,omitempty"` 9409 Ordinal *int16 `thrift:"ordinal,7" db:"ordinal" json:"ordinal,omitempty"` 9410 } 9411 9412 func NewRowGroup() *RowGroup { 9413 return &RowGroup{} 9414 } 9415 9416 func (p *RowGroup) GetColumns() []*ColumnChunk { 9417 return p.Columns 9418 } 9419 9420 func (p *RowGroup) GetTotalByteSize() int64 { 9421 return p.TotalByteSize 9422 } 9423 9424 func (p *RowGroup) GetNumRows() int64 { 9425 return p.NumRows 9426 } 9427 9428 var RowGroup_SortingColumns_DEFAULT []*SortingColumn 9429 9430 func (p *RowGroup) GetSortingColumns() []*SortingColumn { 9431 return p.SortingColumns 9432 } 9433 9434 var RowGroup_FileOffset_DEFAULT int64 9435 9436 func (p *RowGroup) GetFileOffset() int64 { 9437 if !p.IsSetFileOffset() { 9438 return RowGroup_FileOffset_DEFAULT 9439 } 9440 return *p.FileOffset 9441 } 9442 9443 var RowGroup_TotalCompressedSize_DEFAULT int64 9444 9445 func (p *RowGroup) GetTotalCompressedSize() int64 { 9446 if !p.IsSetTotalCompressedSize() { 9447 return RowGroup_TotalCompressedSize_DEFAULT 9448 } 9449 return *p.TotalCompressedSize 9450 } 9451 9452 var RowGroup_Ordinal_DEFAULT int16 9453 9454 func (p *RowGroup) GetOrdinal() int16 { 9455 if !p.IsSetOrdinal() { 9456 return RowGroup_Ordinal_DEFAULT 9457 } 9458 return *p.Ordinal 9459 } 9460 func (p *RowGroup) IsSetSortingColumns() bool { 9461 return p.SortingColumns != nil 9462 } 9463 9464 func (p *RowGroup) IsSetFileOffset() bool { 9465 return p.FileOffset != nil 9466 } 9467 9468 func (p *RowGroup) IsSetTotalCompressedSize() bool { 9469 return p.TotalCompressedSize != nil 9470 } 9471 9472 func (p *RowGroup) IsSetOrdinal() bool { 9473 return p.Ordinal != nil 9474 } 9475 9476 func (p *RowGroup) Read(ctx context.Context, iprot thrift.TProtocol) error { 9477 if _, err := iprot.ReadStructBegin(ctx); err != nil { 9478 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 9479 } 9480 9481 var issetColumns bool = false 9482 var issetTotalByteSize bool = false 9483 var issetNumRows bool = false 9484 9485 for { 9486 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 9487 if err != nil { 9488 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 9489 } 9490 if fieldTypeId == thrift.STOP { 9491 break 9492 } 9493 switch fieldId { 9494 case 1: 9495 if fieldTypeId == thrift.LIST { 9496 if err := p.ReadField1(ctx, iprot); err != nil { 9497 return err 9498 } 9499 issetColumns = true 9500 } else { 9501 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9502 return err 9503 } 9504 } 9505 case 2: 9506 if fieldTypeId == thrift.I64 { 9507 if err := p.ReadField2(ctx, iprot); err != nil { 9508 return err 9509 } 9510 issetTotalByteSize = true 9511 } else { 9512 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9513 return err 9514 } 9515 } 9516 case 3: 9517 if fieldTypeId == thrift.I64 { 9518 if err := p.ReadField3(ctx, iprot); err != nil { 9519 return err 9520 } 9521 issetNumRows = true 9522 } else { 9523 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9524 return err 9525 } 9526 } 9527 case 4: 9528 if fieldTypeId == thrift.LIST { 9529 if err := p.ReadField4(ctx, iprot); err != nil { 9530 return err 9531 } 9532 } else { 9533 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9534 return err 9535 } 9536 } 9537 case 5: 9538 if fieldTypeId == thrift.I64 { 9539 if err := p.ReadField5(ctx, iprot); err != nil { 9540 return err 9541 } 9542 } else { 9543 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9544 return err 9545 } 9546 } 9547 case 6: 9548 if fieldTypeId == thrift.I64 { 9549 if err := p.ReadField6(ctx, iprot); err != nil { 9550 return err 9551 } 9552 } else { 9553 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9554 return err 9555 } 9556 } 9557 case 7: 9558 if fieldTypeId == thrift.I16 { 9559 if err := p.ReadField7(ctx, iprot); err != nil { 9560 return err 9561 } 9562 } else { 9563 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9564 return err 9565 } 9566 } 9567 default: 9568 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9569 return err 9570 } 9571 } 9572 if err := iprot.ReadFieldEnd(ctx); err != nil { 9573 return err 9574 } 9575 } 9576 if err := iprot.ReadStructEnd(ctx); err != nil { 9577 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 9578 } 9579 if !issetColumns { 9580 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Columns is not set")) 9581 } 9582 if !issetTotalByteSize { 9583 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TotalByteSize is not set")) 9584 } 9585 if !issetNumRows { 9586 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumRows is not set")) 9587 } 9588 return nil 9589 } 9590 9591 func (p *RowGroup) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 9592 _, size, err := iprot.ReadListBegin(ctx) 9593 if size < 0 { 9594 return errors.New("list size is negative") 9595 } 9596 if err != nil { 9597 return thrift.PrependError("error reading list begin: ", err) 9598 } 9599 tSlice := make([]*ColumnChunk, 0, size) 9600 p.Columns = tSlice 9601 for i := 0; i < size; i++ { 9602 _elem10 := &ColumnChunk{} 9603 if err := _elem10.Read(ctx, iprot); err != nil { 9604 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) 9605 } 9606 p.Columns = append(p.Columns, _elem10) 9607 } 9608 if err := iprot.ReadListEnd(ctx); err != nil { 9609 return thrift.PrependError("error reading list end: ", err) 9610 } 9611 return nil 9612 } 9613 9614 func (p *RowGroup) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 9615 if v, err := iprot.ReadI64(ctx); err != nil { 9616 return thrift.PrependError("error reading field 2: ", err) 9617 } else { 9618 p.TotalByteSize = v 9619 } 9620 return nil 9621 } 9622 9623 func (p *RowGroup) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 9624 if v, err := iprot.ReadI64(ctx); err != nil { 9625 return thrift.PrependError("error reading field 3: ", err) 9626 } else { 9627 p.NumRows = v 9628 } 9629 return nil 9630 } 9631 9632 func (p *RowGroup) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 9633 _, size, err := iprot.ReadListBegin(ctx) 9634 if size < 0 { 9635 return errors.New("list size is negative") 9636 } 9637 if err != nil { 9638 return thrift.PrependError("error reading list begin: ", err) 9639 } 9640 tSlice := make([]*SortingColumn, 0, size) 9641 p.SortingColumns = tSlice 9642 for i := 0; i < size; i++ { 9643 _elem11 := &SortingColumn{} 9644 if err := _elem11.Read(ctx, iprot); err != nil { 9645 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem11), err) 9646 } 9647 p.SortingColumns = append(p.SortingColumns, _elem11) 9648 } 9649 if err := iprot.ReadListEnd(ctx); err != nil { 9650 return thrift.PrependError("error reading list end: ", err) 9651 } 9652 return nil 9653 } 9654 9655 func (p *RowGroup) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 9656 if v, err := iprot.ReadI64(ctx); err != nil { 9657 return thrift.PrependError("error reading field 5: ", err) 9658 } else { 9659 p.FileOffset = &v 9660 } 9661 return nil 9662 } 9663 9664 func (p *RowGroup) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 9665 if v, err := iprot.ReadI64(ctx); err != nil { 9666 return thrift.PrependError("error reading field 6: ", err) 9667 } else { 9668 p.TotalCompressedSize = &v 9669 } 9670 return nil 9671 } 9672 9673 func (p *RowGroup) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 9674 if v, err := iprot.ReadI16(ctx); err != nil { 9675 return thrift.PrependError("error reading field 7: ", err) 9676 } else { 9677 p.Ordinal = &v 9678 } 9679 return nil 9680 } 9681 9682 func (p *RowGroup) Write(ctx context.Context, oprot thrift.TProtocol) error { 9683 if err := oprot.WriteStructBegin(ctx, "RowGroup"); err != nil { 9684 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 9685 } 9686 if p != nil { 9687 if err := p.writeField1(ctx, oprot); err != nil { 9688 return err 9689 } 9690 if err := p.writeField2(ctx, oprot); err != nil { 9691 return err 9692 } 9693 if err := p.writeField3(ctx, oprot); err != nil { 9694 return err 9695 } 9696 if err := p.writeField4(ctx, oprot); err != nil { 9697 return err 9698 } 9699 if err := p.writeField5(ctx, oprot); err != nil { 9700 return err 9701 } 9702 if err := p.writeField6(ctx, oprot); err != nil { 9703 return err 9704 } 9705 if err := p.writeField7(ctx, oprot); err != nil { 9706 return err 9707 } 9708 } 9709 if err := oprot.WriteFieldStop(ctx); err != nil { 9710 return thrift.PrependError("write field stop error: ", err) 9711 } 9712 if err := oprot.WriteStructEnd(ctx); err != nil { 9713 return thrift.PrependError("write struct stop error: ", err) 9714 } 9715 return nil 9716 } 9717 9718 func (p *RowGroup) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 9719 if err := oprot.WriteFieldBegin(ctx, "columns", thrift.LIST, 1); err != nil { 9720 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:columns: ", p), err) 9721 } 9722 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Columns)); err != nil { 9723 return thrift.PrependError("error writing list begin: ", err) 9724 } 9725 for _, v := range p.Columns { 9726 if err := v.Write(ctx, oprot); err != nil { 9727 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 9728 } 9729 } 9730 if err := oprot.WriteListEnd(ctx); err != nil { 9731 return thrift.PrependError("error writing list end: ", err) 9732 } 9733 if err := oprot.WriteFieldEnd(ctx); err != nil { 9734 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:columns: ", p), err) 9735 } 9736 return err 9737 } 9738 9739 func (p *RowGroup) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 9740 if err := oprot.WriteFieldBegin(ctx, "total_byte_size", thrift.I64, 2); err != nil { 9741 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:total_byte_size: ", p), err) 9742 } 9743 if err := oprot.WriteI64(ctx, int64(p.TotalByteSize)); err != nil { 9744 return thrift.PrependError(fmt.Sprintf("%T.total_byte_size (2) field write error: ", p), err) 9745 } 9746 if err := oprot.WriteFieldEnd(ctx); err != nil { 9747 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:total_byte_size: ", p), err) 9748 } 9749 return err 9750 } 9751 9752 func (p *RowGroup) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 9753 if err := oprot.WriteFieldBegin(ctx, "num_rows", thrift.I64, 3); err != nil { 9754 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:num_rows: ", p), err) 9755 } 9756 if err := oprot.WriteI64(ctx, int64(p.NumRows)); err != nil { 9757 return thrift.PrependError(fmt.Sprintf("%T.num_rows (3) field write error: ", p), err) 9758 } 9759 if err := oprot.WriteFieldEnd(ctx); err != nil { 9760 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:num_rows: ", p), err) 9761 } 9762 return err 9763 } 9764 9765 func (p *RowGroup) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 9766 if p.IsSetSortingColumns() { 9767 if err := oprot.WriteFieldBegin(ctx, "sorting_columns", thrift.LIST, 4); err != nil { 9768 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:sorting_columns: ", p), err) 9769 } 9770 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.SortingColumns)); err != nil { 9771 return thrift.PrependError("error writing list begin: ", err) 9772 } 9773 for _, v := range p.SortingColumns { 9774 if err := v.Write(ctx, oprot); err != nil { 9775 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 9776 } 9777 } 9778 if err := oprot.WriteListEnd(ctx); err != nil { 9779 return thrift.PrependError("error writing list end: ", err) 9780 } 9781 if err := oprot.WriteFieldEnd(ctx); err != nil { 9782 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:sorting_columns: ", p), err) 9783 } 9784 } 9785 return err 9786 } 9787 9788 func (p *RowGroup) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 9789 if p.IsSetFileOffset() { 9790 if err := oprot.WriteFieldBegin(ctx, "file_offset", thrift.I64, 5); err != nil { 9791 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:file_offset: ", p), err) 9792 } 9793 if err := oprot.WriteI64(ctx, int64(*p.FileOffset)); err != nil { 9794 return thrift.PrependError(fmt.Sprintf("%T.file_offset (5) field write error: ", p), err) 9795 } 9796 if err := oprot.WriteFieldEnd(ctx); err != nil { 9797 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:file_offset: ", p), err) 9798 } 9799 } 9800 return err 9801 } 9802 9803 func (p *RowGroup) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 9804 if p.IsSetTotalCompressedSize() { 9805 if err := oprot.WriteFieldBegin(ctx, "total_compressed_size", thrift.I64, 6); err != nil { 9806 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:total_compressed_size: ", p), err) 9807 } 9808 if err := oprot.WriteI64(ctx, int64(*p.TotalCompressedSize)); err != nil { 9809 return thrift.PrependError(fmt.Sprintf("%T.total_compressed_size (6) field write error: ", p), err) 9810 } 9811 if err := oprot.WriteFieldEnd(ctx); err != nil { 9812 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:total_compressed_size: ", p), err) 9813 } 9814 } 9815 return err 9816 } 9817 9818 func (p *RowGroup) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 9819 if p.IsSetOrdinal() { 9820 if err := oprot.WriteFieldBegin(ctx, "ordinal", thrift.I16, 7); err != nil { 9821 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:ordinal: ", p), err) 9822 } 9823 if err := oprot.WriteI16(ctx, int16(*p.Ordinal)); err != nil { 9824 return thrift.PrependError(fmt.Sprintf("%T.ordinal (7) field write error: ", p), err) 9825 } 9826 if err := oprot.WriteFieldEnd(ctx); err != nil { 9827 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:ordinal: ", p), err) 9828 } 9829 } 9830 return err 9831 } 9832 9833 func (p *RowGroup) Equals(other *RowGroup) bool { 9834 if p == other { 9835 return true 9836 } else if p == nil || other == nil { 9837 return false 9838 } 9839 if len(p.Columns) != len(other.Columns) { 9840 return false 9841 } 9842 for i, _tgt := range p.Columns { 9843 _src12 := other.Columns[i] 9844 if !_tgt.Equals(_src12) { 9845 return false 9846 } 9847 } 9848 if p.TotalByteSize != other.TotalByteSize { 9849 return false 9850 } 9851 if p.NumRows != other.NumRows { 9852 return false 9853 } 9854 if len(p.SortingColumns) != len(other.SortingColumns) { 9855 return false 9856 } 9857 for i, _tgt := range p.SortingColumns { 9858 _src13 := other.SortingColumns[i] 9859 if !_tgt.Equals(_src13) { 9860 return false 9861 } 9862 } 9863 if p.FileOffset != other.FileOffset { 9864 if p.FileOffset == nil || other.FileOffset == nil { 9865 return false 9866 } 9867 if (*p.FileOffset) != (*other.FileOffset) { 9868 return false 9869 } 9870 } 9871 if p.TotalCompressedSize != other.TotalCompressedSize { 9872 if p.TotalCompressedSize == nil || other.TotalCompressedSize == nil { 9873 return false 9874 } 9875 if (*p.TotalCompressedSize) != (*other.TotalCompressedSize) { 9876 return false 9877 } 9878 } 9879 if p.Ordinal != other.Ordinal { 9880 if p.Ordinal == nil || other.Ordinal == nil { 9881 return false 9882 } 9883 if (*p.Ordinal) != (*other.Ordinal) { 9884 return false 9885 } 9886 } 9887 return true 9888 } 9889 9890 func (p *RowGroup) String() string { 9891 if p == nil { 9892 return "<nil>" 9893 } 9894 return fmt.Sprintf("RowGroup(%+v)", *p) 9895 } 9896 9897 // Empty struct to signal the order defined by the physical or logical type 9898 type TypeDefinedOrder struct { 9899 } 9900 9901 func NewTypeDefinedOrder() *TypeDefinedOrder { 9902 return &TypeDefinedOrder{} 9903 } 9904 9905 func (p *TypeDefinedOrder) Read(ctx context.Context, iprot thrift.TProtocol) error { 9906 if _, err := iprot.ReadStructBegin(ctx); err != nil { 9907 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 9908 } 9909 9910 for { 9911 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 9912 if err != nil { 9913 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 9914 } 9915 if fieldTypeId == thrift.STOP { 9916 break 9917 } 9918 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 9919 return err 9920 } 9921 if err := iprot.ReadFieldEnd(ctx); err != nil { 9922 return err 9923 } 9924 } 9925 if err := iprot.ReadStructEnd(ctx); err != nil { 9926 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 9927 } 9928 return nil 9929 } 9930 9931 func (p *TypeDefinedOrder) Write(ctx context.Context, oprot thrift.TProtocol) error { 9932 if err := oprot.WriteStructBegin(ctx, "TypeDefinedOrder"); err != nil { 9933 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 9934 } 9935 if p != nil { 9936 } 9937 if err := oprot.WriteFieldStop(ctx); err != nil { 9938 return thrift.PrependError("write field stop error: ", err) 9939 } 9940 if err := oprot.WriteStructEnd(ctx); err != nil { 9941 return thrift.PrependError("write struct stop error: ", err) 9942 } 9943 return nil 9944 } 9945 9946 func (p *TypeDefinedOrder) Equals(other *TypeDefinedOrder) bool { 9947 if p == other { 9948 return true 9949 } else if p == nil || other == nil { 9950 return false 9951 } 9952 return true 9953 } 9954 9955 func (p *TypeDefinedOrder) String() string { 9956 if p == nil { 9957 return "<nil>" 9958 } 9959 return fmt.Sprintf("TypeDefinedOrder(%+v)", *p) 9960 } 9961 9962 // Union to specify the order used for the min_value and max_value fields for a 9963 // column. This union takes the role of an enhanced enum that allows rich 9964 // elements (which will be needed for a collation-based ordering in the future). 9965 // 9966 // Possible values are: 9967 // * TypeDefinedOrder - the column uses the order defined by its logical or 9968 // physical type (if there is no logical type). 9969 // 9970 // If the reader does not support the value of this union, min and max stats 9971 // for this column should be ignored. 9972 // 9973 // Attributes: 9974 // - TYPE_ORDER: The sort orders for logical types are: 9975 // UTF8 - unsigned byte-wise comparison 9976 // INT8 - signed comparison 9977 // INT16 - signed comparison 9978 // INT32 - signed comparison 9979 // INT64 - signed comparison 9980 // UINT8 - unsigned comparison 9981 // UINT16 - unsigned comparison 9982 // UINT32 - unsigned comparison 9983 // UINT64 - unsigned comparison 9984 // DECIMAL - signed comparison of the represented value 9985 // DATE - signed comparison 9986 // TIME_MILLIS - signed comparison 9987 // TIME_MICROS - signed comparison 9988 // TIMESTAMP_MILLIS - signed comparison 9989 // TIMESTAMP_MICROS - signed comparison 9990 // INTERVAL - unsigned comparison 9991 // JSON - unsigned byte-wise comparison 9992 // BSON - unsigned byte-wise comparison 9993 // ENUM - unsigned byte-wise comparison 9994 // LIST - undefined 9995 // MAP - undefined 9996 // 9997 // In the absence of logical types, the sort order is determined by the physical type: 9998 // BOOLEAN - false, true 9999 // INT32 - signed comparison 10000 // INT64 - signed comparison 10001 // INT96 (only used for legacy timestamps) - undefined 10002 // FLOAT - signed comparison of the represented value (*) 10003 // DOUBLE - signed comparison of the represented value (*) 10004 // BYTE_ARRAY - unsigned byte-wise comparison 10005 // FIXED_LEN_BYTE_ARRAY - unsigned byte-wise comparison 10006 // 10007 // (*) Because the sorting order is not specified properly for floating 10008 // point values (relations vs. total ordering) the following 10009 // compatibility rules should be applied when reading statistics: 10010 // - If the min is a NaN, it should be ignored. 10011 // - If the max is a NaN, it should be ignored. 10012 // - If the min is +0, the row group may contain -0 values as well. 10013 // - If the max is -0, the row group may contain +0 values as well. 10014 // - When looking for NaN values, min and max should be ignored. 10015 type ColumnOrder struct { 10016 TYPE_ORDER *TypeDefinedOrder `thrift:"TYPE_ORDER,1" db:"TYPE_ORDER" json:"TYPE_ORDER,omitempty"` 10017 } 10018 10019 func NewColumnOrder() *ColumnOrder { 10020 return &ColumnOrder{} 10021 } 10022 10023 var ColumnOrder_TYPE_ORDER_DEFAULT *TypeDefinedOrder 10024 10025 func (p *ColumnOrder) GetTYPE_ORDER() *TypeDefinedOrder { 10026 if !p.IsSetTYPE_ORDER() { 10027 return ColumnOrder_TYPE_ORDER_DEFAULT 10028 } 10029 return p.TYPE_ORDER 10030 } 10031 func (p *ColumnOrder) CountSetFieldsColumnOrder() int { 10032 count := 0 10033 if p.IsSetTYPE_ORDER() { 10034 count++ 10035 } 10036 return count 10037 10038 } 10039 10040 func (p *ColumnOrder) IsSetTYPE_ORDER() bool { 10041 return p.TYPE_ORDER != nil 10042 } 10043 10044 func (p *ColumnOrder) Read(ctx context.Context, iprot thrift.TProtocol) error { 10045 if _, err := iprot.ReadStructBegin(ctx); err != nil { 10046 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 10047 } 10048 10049 for { 10050 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 10051 if err != nil { 10052 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 10053 } 10054 if fieldTypeId == thrift.STOP { 10055 break 10056 } 10057 switch fieldId { 10058 case 1: 10059 if fieldTypeId == thrift.STRUCT { 10060 if err := p.ReadField1(ctx, iprot); err != nil { 10061 return err 10062 } 10063 } else { 10064 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10065 return err 10066 } 10067 } 10068 default: 10069 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10070 return err 10071 } 10072 } 10073 if err := iprot.ReadFieldEnd(ctx); err != nil { 10074 return err 10075 } 10076 } 10077 if err := iprot.ReadStructEnd(ctx); err != nil { 10078 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 10079 } 10080 return nil 10081 } 10082 10083 func (p *ColumnOrder) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 10084 p.TYPE_ORDER = &TypeDefinedOrder{} 10085 if err := p.TYPE_ORDER.Read(ctx, iprot); err != nil { 10086 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.TYPE_ORDER), err) 10087 } 10088 return nil 10089 } 10090 10091 func (p *ColumnOrder) Write(ctx context.Context, oprot thrift.TProtocol) error { 10092 if c := p.CountSetFieldsColumnOrder(); c != 1 { 10093 return fmt.Errorf("%T write union: exactly one field must be set (%d set)", p, c) 10094 } 10095 if err := oprot.WriteStructBegin(ctx, "ColumnOrder"); err != nil { 10096 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 10097 } 10098 if p != nil { 10099 if err := p.writeField1(ctx, oprot); err != nil { 10100 return err 10101 } 10102 } 10103 if err := oprot.WriteFieldStop(ctx); err != nil { 10104 return thrift.PrependError("write field stop error: ", err) 10105 } 10106 if err := oprot.WriteStructEnd(ctx); err != nil { 10107 return thrift.PrependError("write struct stop error: ", err) 10108 } 10109 return nil 10110 } 10111 10112 func (p *ColumnOrder) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 10113 if p.IsSetTYPE_ORDER() { 10114 if err := oprot.WriteFieldBegin(ctx, "TYPE_ORDER", thrift.STRUCT, 1); err != nil { 10115 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:TYPE_ORDER: ", p), err) 10116 } 10117 if err := p.TYPE_ORDER.Write(ctx, oprot); err != nil { 10118 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.TYPE_ORDER), err) 10119 } 10120 if err := oprot.WriteFieldEnd(ctx); err != nil { 10121 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:TYPE_ORDER: ", p), err) 10122 } 10123 } 10124 return err 10125 } 10126 10127 func (p *ColumnOrder) Equals(other *ColumnOrder) bool { 10128 if p == other { 10129 return true 10130 } else if p == nil || other == nil { 10131 return false 10132 } 10133 if !p.TYPE_ORDER.Equals(other.TYPE_ORDER) { 10134 return false 10135 } 10136 return true 10137 } 10138 10139 func (p *ColumnOrder) String() string { 10140 if p == nil { 10141 return "<nil>" 10142 } 10143 return fmt.Sprintf("ColumnOrder(%+v)", *p) 10144 } 10145 10146 // Attributes: 10147 // - Offset: Offset of the page in the file * 10148 // - CompressedPageSize: Size of the page, including header. Sum of compressed_page_size and header 10149 // length 10150 // - FirstRowIndex: Index within the RowGroup of the first row of the page; this means pages 10151 // change on record boundaries (r = 0). 10152 type PageLocation struct { 10153 Offset int64 `thrift:"offset,1,required" db:"offset" json:"offset"` 10154 CompressedPageSize int32 `thrift:"compressed_page_size,2,required" db:"compressed_page_size" json:"compressed_page_size"` 10155 FirstRowIndex int64 `thrift:"first_row_index,3,required" db:"first_row_index" json:"first_row_index"` 10156 } 10157 10158 func NewPageLocation() *PageLocation { 10159 return &PageLocation{} 10160 } 10161 10162 func (p *PageLocation) GetOffset() int64 { 10163 return p.Offset 10164 } 10165 10166 func (p *PageLocation) GetCompressedPageSize() int32 { 10167 return p.CompressedPageSize 10168 } 10169 10170 func (p *PageLocation) GetFirstRowIndex() int64 { 10171 return p.FirstRowIndex 10172 } 10173 func (p *PageLocation) Read(ctx context.Context, iprot thrift.TProtocol) error { 10174 if _, err := iprot.ReadStructBegin(ctx); err != nil { 10175 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 10176 } 10177 10178 var issetOffset bool = false 10179 var issetCompressedPageSize bool = false 10180 var issetFirstRowIndex bool = false 10181 10182 for { 10183 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 10184 if err != nil { 10185 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 10186 } 10187 if fieldTypeId == thrift.STOP { 10188 break 10189 } 10190 switch fieldId { 10191 case 1: 10192 if fieldTypeId == thrift.I64 { 10193 if err := p.ReadField1(ctx, iprot); err != nil { 10194 return err 10195 } 10196 issetOffset = true 10197 } else { 10198 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10199 return err 10200 } 10201 } 10202 case 2: 10203 if fieldTypeId == thrift.I32 { 10204 if err := p.ReadField2(ctx, iprot); err != nil { 10205 return err 10206 } 10207 issetCompressedPageSize = true 10208 } else { 10209 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10210 return err 10211 } 10212 } 10213 case 3: 10214 if fieldTypeId == thrift.I64 { 10215 if err := p.ReadField3(ctx, iprot); err != nil { 10216 return err 10217 } 10218 issetFirstRowIndex = true 10219 } else { 10220 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10221 return err 10222 } 10223 } 10224 default: 10225 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10226 return err 10227 } 10228 } 10229 if err := iprot.ReadFieldEnd(ctx); err != nil { 10230 return err 10231 } 10232 } 10233 if err := iprot.ReadStructEnd(ctx); err != nil { 10234 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 10235 } 10236 if !issetOffset { 10237 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Offset is not set")) 10238 } 10239 if !issetCompressedPageSize { 10240 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field CompressedPageSize is not set")) 10241 } 10242 if !issetFirstRowIndex { 10243 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FirstRowIndex is not set")) 10244 } 10245 return nil 10246 } 10247 10248 func (p *PageLocation) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 10249 if v, err := iprot.ReadI64(ctx); err != nil { 10250 return thrift.PrependError("error reading field 1: ", err) 10251 } else { 10252 p.Offset = v 10253 } 10254 return nil 10255 } 10256 10257 func (p *PageLocation) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 10258 if v, err := iprot.ReadI32(ctx); err != nil { 10259 return thrift.PrependError("error reading field 2: ", err) 10260 } else { 10261 p.CompressedPageSize = v 10262 } 10263 return nil 10264 } 10265 10266 func (p *PageLocation) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 10267 if v, err := iprot.ReadI64(ctx); err != nil { 10268 return thrift.PrependError("error reading field 3: ", err) 10269 } else { 10270 p.FirstRowIndex = v 10271 } 10272 return nil 10273 } 10274 10275 func (p *PageLocation) Write(ctx context.Context, oprot thrift.TProtocol) error { 10276 if err := oprot.WriteStructBegin(ctx, "PageLocation"); err != nil { 10277 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 10278 } 10279 if p != nil { 10280 if err := p.writeField1(ctx, oprot); err != nil { 10281 return err 10282 } 10283 if err := p.writeField2(ctx, oprot); err != nil { 10284 return err 10285 } 10286 if err := p.writeField3(ctx, oprot); err != nil { 10287 return err 10288 } 10289 } 10290 if err := oprot.WriteFieldStop(ctx); err != nil { 10291 return thrift.PrependError("write field stop error: ", err) 10292 } 10293 if err := oprot.WriteStructEnd(ctx); err != nil { 10294 return thrift.PrependError("write struct stop error: ", err) 10295 } 10296 return nil 10297 } 10298 10299 func (p *PageLocation) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 10300 if err := oprot.WriteFieldBegin(ctx, "offset", thrift.I64, 1); err != nil { 10301 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:offset: ", p), err) 10302 } 10303 if err := oprot.WriteI64(ctx, int64(p.Offset)); err != nil { 10304 return thrift.PrependError(fmt.Sprintf("%T.offset (1) field write error: ", p), err) 10305 } 10306 if err := oprot.WriteFieldEnd(ctx); err != nil { 10307 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:offset: ", p), err) 10308 } 10309 return err 10310 } 10311 10312 func (p *PageLocation) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 10313 if err := oprot.WriteFieldBegin(ctx, "compressed_page_size", thrift.I32, 2); err != nil { 10314 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:compressed_page_size: ", p), err) 10315 } 10316 if err := oprot.WriteI32(ctx, int32(p.CompressedPageSize)); err != nil { 10317 return thrift.PrependError(fmt.Sprintf("%T.compressed_page_size (2) field write error: ", p), err) 10318 } 10319 if err := oprot.WriteFieldEnd(ctx); err != nil { 10320 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:compressed_page_size: ", p), err) 10321 } 10322 return err 10323 } 10324 10325 func (p *PageLocation) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 10326 if err := oprot.WriteFieldBegin(ctx, "first_row_index", thrift.I64, 3); err != nil { 10327 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:first_row_index: ", p), err) 10328 } 10329 if err := oprot.WriteI64(ctx, int64(p.FirstRowIndex)); err != nil { 10330 return thrift.PrependError(fmt.Sprintf("%T.first_row_index (3) field write error: ", p), err) 10331 } 10332 if err := oprot.WriteFieldEnd(ctx); err != nil { 10333 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:first_row_index: ", p), err) 10334 } 10335 return err 10336 } 10337 10338 func (p *PageLocation) Equals(other *PageLocation) bool { 10339 if p == other { 10340 return true 10341 } else if p == nil || other == nil { 10342 return false 10343 } 10344 if p.Offset != other.Offset { 10345 return false 10346 } 10347 if p.CompressedPageSize != other.CompressedPageSize { 10348 return false 10349 } 10350 if p.FirstRowIndex != other.FirstRowIndex { 10351 return false 10352 } 10353 return true 10354 } 10355 10356 func (p *PageLocation) String() string { 10357 if p == nil { 10358 return "<nil>" 10359 } 10360 return fmt.Sprintf("PageLocation(%+v)", *p) 10361 } 10362 10363 // Attributes: 10364 // - PageLocations: PageLocations, ordered by increasing PageLocation.offset. It is required 10365 // that page_locations[i].first_row_index < page_locations[i+1].first_row_index. 10366 type OffsetIndex struct { 10367 PageLocations []*PageLocation `thrift:"page_locations,1,required" db:"page_locations" json:"page_locations"` 10368 } 10369 10370 func NewOffsetIndex() *OffsetIndex { 10371 return &OffsetIndex{} 10372 } 10373 10374 func (p *OffsetIndex) GetPageLocations() []*PageLocation { 10375 return p.PageLocations 10376 } 10377 func (p *OffsetIndex) Read(ctx context.Context, iprot thrift.TProtocol) error { 10378 if _, err := iprot.ReadStructBegin(ctx); err != nil { 10379 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 10380 } 10381 10382 var issetPageLocations bool = false 10383 10384 for { 10385 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 10386 if err != nil { 10387 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 10388 } 10389 if fieldTypeId == thrift.STOP { 10390 break 10391 } 10392 switch fieldId { 10393 case 1: 10394 if fieldTypeId == thrift.LIST { 10395 if err := p.ReadField1(ctx, iprot); err != nil { 10396 return err 10397 } 10398 issetPageLocations = true 10399 } else { 10400 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10401 return err 10402 } 10403 } 10404 default: 10405 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10406 return err 10407 } 10408 } 10409 if err := iprot.ReadFieldEnd(ctx); err != nil { 10410 return err 10411 } 10412 } 10413 if err := iprot.ReadStructEnd(ctx); err != nil { 10414 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 10415 } 10416 if !issetPageLocations { 10417 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field PageLocations is not set")) 10418 } 10419 return nil 10420 } 10421 10422 func (p *OffsetIndex) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 10423 _, size, err := iprot.ReadListBegin(ctx) 10424 if size < 0 { 10425 return errors.New("list size is negative") 10426 } 10427 if err != nil { 10428 return thrift.PrependError("error reading list begin: ", err) 10429 } 10430 tSlice := make([]*PageLocation, 0, size) 10431 p.PageLocations = tSlice 10432 for i := 0; i < size; i++ { 10433 _elem14 := &PageLocation{} 10434 if err := _elem14.Read(ctx, iprot); err != nil { 10435 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem14), err) 10436 } 10437 p.PageLocations = append(p.PageLocations, _elem14) 10438 } 10439 if err := iprot.ReadListEnd(ctx); err != nil { 10440 return thrift.PrependError("error reading list end: ", err) 10441 } 10442 return nil 10443 } 10444 10445 func (p *OffsetIndex) Write(ctx context.Context, oprot thrift.TProtocol) error { 10446 if err := oprot.WriteStructBegin(ctx, "OffsetIndex"); err != nil { 10447 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 10448 } 10449 if p != nil { 10450 if err := p.writeField1(ctx, oprot); err != nil { 10451 return err 10452 } 10453 } 10454 if err := oprot.WriteFieldStop(ctx); err != nil { 10455 return thrift.PrependError("write field stop error: ", err) 10456 } 10457 if err := oprot.WriteStructEnd(ctx); err != nil { 10458 return thrift.PrependError("write struct stop error: ", err) 10459 } 10460 return nil 10461 } 10462 10463 func (p *OffsetIndex) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 10464 if err := oprot.WriteFieldBegin(ctx, "page_locations", thrift.LIST, 1); err != nil { 10465 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:page_locations: ", p), err) 10466 } 10467 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.PageLocations)); err != nil { 10468 return thrift.PrependError("error writing list begin: ", err) 10469 } 10470 for _, v := range p.PageLocations { 10471 if err := v.Write(ctx, oprot); err != nil { 10472 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 10473 } 10474 } 10475 if err := oprot.WriteListEnd(ctx); err != nil { 10476 return thrift.PrependError("error writing list end: ", err) 10477 } 10478 if err := oprot.WriteFieldEnd(ctx); err != nil { 10479 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:page_locations: ", p), err) 10480 } 10481 return err 10482 } 10483 10484 func (p *OffsetIndex) Equals(other *OffsetIndex) bool { 10485 if p == other { 10486 return true 10487 } else if p == nil || other == nil { 10488 return false 10489 } 10490 if len(p.PageLocations) != len(other.PageLocations) { 10491 return false 10492 } 10493 for i, _tgt := range p.PageLocations { 10494 _src15 := other.PageLocations[i] 10495 if !_tgt.Equals(_src15) { 10496 return false 10497 } 10498 } 10499 return true 10500 } 10501 10502 func (p *OffsetIndex) String() string { 10503 if p == nil { 10504 return "<nil>" 10505 } 10506 return fmt.Sprintf("OffsetIndex(%+v)", *p) 10507 } 10508 10509 // Description for ColumnIndex. 10510 // Each <array-field>[i] refers to the page at OffsetIndex.page_locations[i] 10511 // 10512 // Attributes: 10513 // - NullPages: A list of Boolean values to determine the validity of the corresponding 10514 // min and max values. If true, a page contains only null values, and writers 10515 // have to set the corresponding entries in min_values and max_values to 10516 // byte[0], so that all lists have the same length. If false, the 10517 // corresponding entries in min_values and max_values must be valid. 10518 // - MinValues: Two lists containing lower and upper bounds for the values of each page. 10519 // These may be the actual minimum and maximum values found on a page, but 10520 // can also be (more compact) values that do not exist on a page. For 10521 // example, instead of storing ""Blart Versenwald III", a writer may set 10522 // min_values[i]="B", max_values[i]="C". Such more compact values must still 10523 // be valid values within the column's logical type. Readers must make sure 10524 // that list entries are populated before using them by inspecting null_pages. 10525 // - MaxValues 10526 // - BoundaryOrder: Stores whether both min_values and max_values are orderd and if so, in 10527 // which direction. This allows readers to perform binary searches in both 10528 // lists. Readers cannot assume that max_values[i] <= min_values[i+1], even 10529 // if the lists are ordered. 10530 // - NullCounts: A list containing the number of null values for each page * 10531 type ColumnIndex struct { 10532 NullPages []bool `thrift:"null_pages,1,required" db:"null_pages" json:"null_pages"` 10533 MinValues [][]byte `thrift:"min_values,2,required" db:"min_values" json:"min_values"` 10534 MaxValues [][]byte `thrift:"max_values,3,required" db:"max_values" json:"max_values"` 10535 BoundaryOrder BoundaryOrder `thrift:"boundary_order,4,required" db:"boundary_order" json:"boundary_order"` 10536 NullCounts []int64 `thrift:"null_counts,5" db:"null_counts" json:"null_counts,omitempty"` 10537 } 10538 10539 func NewColumnIndex() *ColumnIndex { 10540 return &ColumnIndex{} 10541 } 10542 10543 func (p *ColumnIndex) GetNullPages() []bool { 10544 return p.NullPages 10545 } 10546 10547 func (p *ColumnIndex) GetMinValues() [][]byte { 10548 return p.MinValues 10549 } 10550 10551 func (p *ColumnIndex) GetMaxValues() [][]byte { 10552 return p.MaxValues 10553 } 10554 10555 func (p *ColumnIndex) GetBoundaryOrder() BoundaryOrder { 10556 return p.BoundaryOrder 10557 } 10558 10559 var ColumnIndex_NullCounts_DEFAULT []int64 10560 10561 func (p *ColumnIndex) GetNullCounts() []int64 { 10562 return p.NullCounts 10563 } 10564 func (p *ColumnIndex) IsSetNullCounts() bool { 10565 return p.NullCounts != nil 10566 } 10567 10568 func (p *ColumnIndex) Read(ctx context.Context, iprot thrift.TProtocol) error { 10569 if _, err := iprot.ReadStructBegin(ctx); err != nil { 10570 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 10571 } 10572 10573 var issetNullPages bool = false 10574 var issetMinValues bool = false 10575 var issetMaxValues bool = false 10576 var issetBoundaryOrder bool = false 10577 10578 for { 10579 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 10580 if err != nil { 10581 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 10582 } 10583 if fieldTypeId == thrift.STOP { 10584 break 10585 } 10586 switch fieldId { 10587 case 1: 10588 if fieldTypeId == thrift.LIST { 10589 if err := p.ReadField1(ctx, iprot); err != nil { 10590 return err 10591 } 10592 issetNullPages = true 10593 } else { 10594 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10595 return err 10596 } 10597 } 10598 case 2: 10599 if fieldTypeId == thrift.LIST { 10600 if err := p.ReadField2(ctx, iprot); err != nil { 10601 return err 10602 } 10603 issetMinValues = true 10604 } else { 10605 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10606 return err 10607 } 10608 } 10609 case 3: 10610 if fieldTypeId == thrift.LIST { 10611 if err := p.ReadField3(ctx, iprot); err != nil { 10612 return err 10613 } 10614 issetMaxValues = true 10615 } else { 10616 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10617 return err 10618 } 10619 } 10620 case 4: 10621 if fieldTypeId == thrift.I32 { 10622 if err := p.ReadField4(ctx, iprot); err != nil { 10623 return err 10624 } 10625 issetBoundaryOrder = true 10626 } else { 10627 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10628 return err 10629 } 10630 } 10631 case 5: 10632 if fieldTypeId == thrift.LIST { 10633 if err := p.ReadField5(ctx, iprot); err != nil { 10634 return err 10635 } 10636 } else { 10637 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10638 return err 10639 } 10640 } 10641 default: 10642 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 10643 return err 10644 } 10645 } 10646 if err := iprot.ReadFieldEnd(ctx); err != nil { 10647 return err 10648 } 10649 } 10650 if err := iprot.ReadStructEnd(ctx); err != nil { 10651 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 10652 } 10653 if !issetNullPages { 10654 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NullPages is not set")) 10655 } 10656 if !issetMinValues { 10657 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MinValues is not set")) 10658 } 10659 if !issetMaxValues { 10660 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MaxValues is not set")) 10661 } 10662 if !issetBoundaryOrder { 10663 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field BoundaryOrder is not set")) 10664 } 10665 return nil 10666 } 10667 10668 func (p *ColumnIndex) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 10669 _, size, err := iprot.ReadListBegin(ctx) 10670 if size < 0 { 10671 return errors.New("list size is negative") 10672 } 10673 if err != nil { 10674 return thrift.PrependError("error reading list begin: ", err) 10675 } 10676 tSlice := make([]bool, 0, size) 10677 p.NullPages = tSlice 10678 for i := 0; i < size; i++ { 10679 var _elem16 bool 10680 if v, err := iprot.ReadBool(ctx); err != nil { 10681 return thrift.PrependError("error reading field 0: ", err) 10682 } else { 10683 _elem16 = v 10684 } 10685 p.NullPages = append(p.NullPages, _elem16) 10686 } 10687 if err := iprot.ReadListEnd(ctx); err != nil { 10688 return thrift.PrependError("error reading list end: ", err) 10689 } 10690 return nil 10691 } 10692 10693 func (p *ColumnIndex) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 10694 _, size, err := iprot.ReadListBegin(ctx) 10695 if size < 0 { 10696 return errors.New("list size is negative") 10697 } 10698 if err != nil { 10699 return thrift.PrependError("error reading list begin: ", err) 10700 } 10701 tSlice := make([][]byte, 0, size) 10702 p.MinValues = tSlice 10703 for i := 0; i < size; i++ { 10704 var _elem17 []byte 10705 if v, err := iprot.ReadBinary(ctx); err != nil { 10706 return thrift.PrependError("error reading field 0: ", err) 10707 } else { 10708 _elem17 = v 10709 } 10710 p.MinValues = append(p.MinValues, _elem17) 10711 } 10712 if err := iprot.ReadListEnd(ctx); err != nil { 10713 return thrift.PrependError("error reading list end: ", err) 10714 } 10715 return nil 10716 } 10717 10718 func (p *ColumnIndex) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 10719 _, size, err := iprot.ReadListBegin(ctx) 10720 if size < 0 { 10721 return errors.New("list size is negative") 10722 } 10723 if err != nil { 10724 return thrift.PrependError("error reading list begin: ", err) 10725 } 10726 tSlice := make([][]byte, 0, size) 10727 p.MaxValues = tSlice 10728 for i := 0; i < size; i++ { 10729 var _elem18 []byte 10730 if v, err := iprot.ReadBinary(ctx); err != nil { 10731 return thrift.PrependError("error reading field 0: ", err) 10732 } else { 10733 _elem18 = v 10734 } 10735 p.MaxValues = append(p.MaxValues, _elem18) 10736 } 10737 if err := iprot.ReadListEnd(ctx); err != nil { 10738 return thrift.PrependError("error reading list end: ", err) 10739 } 10740 return nil 10741 } 10742 10743 func (p *ColumnIndex) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 10744 if v, err := iprot.ReadI32(ctx); err != nil { 10745 return thrift.PrependError("error reading field 4: ", err) 10746 } else { 10747 temp := BoundaryOrder(v) 10748 p.BoundaryOrder = temp 10749 } 10750 return nil 10751 } 10752 10753 func (p *ColumnIndex) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 10754 _, size, err := iprot.ReadListBegin(ctx) 10755 if size < 0 { 10756 return errors.New("list size is negative") 10757 } 10758 if err != nil { 10759 return thrift.PrependError("error reading list begin: ", err) 10760 } 10761 tSlice := make([]int64, 0, size) 10762 p.NullCounts = tSlice 10763 for i := 0; i < size; i++ { 10764 var _elem19 int64 10765 if v, err := iprot.ReadI64(ctx); err != nil { 10766 return thrift.PrependError("error reading field 0: ", err) 10767 } else { 10768 _elem19 = v 10769 } 10770 p.NullCounts = append(p.NullCounts, _elem19) 10771 } 10772 if err := iprot.ReadListEnd(ctx); err != nil { 10773 return thrift.PrependError("error reading list end: ", err) 10774 } 10775 return nil 10776 } 10777 10778 func (p *ColumnIndex) Write(ctx context.Context, oprot thrift.TProtocol) error { 10779 if err := oprot.WriteStructBegin(ctx, "ColumnIndex"); err != nil { 10780 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 10781 } 10782 if p != nil { 10783 if err := p.writeField1(ctx, oprot); err != nil { 10784 return err 10785 } 10786 if err := p.writeField2(ctx, oprot); err != nil { 10787 return err 10788 } 10789 if err := p.writeField3(ctx, oprot); err != nil { 10790 return err 10791 } 10792 if err := p.writeField4(ctx, oprot); err != nil { 10793 return err 10794 } 10795 if err := p.writeField5(ctx, oprot); err != nil { 10796 return err 10797 } 10798 } 10799 if err := oprot.WriteFieldStop(ctx); err != nil { 10800 return thrift.PrependError("write field stop error: ", err) 10801 } 10802 if err := oprot.WriteStructEnd(ctx); err != nil { 10803 return thrift.PrependError("write struct stop error: ", err) 10804 } 10805 return nil 10806 } 10807 10808 func (p *ColumnIndex) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 10809 if err := oprot.WriteFieldBegin(ctx, "null_pages", thrift.LIST, 1); err != nil { 10810 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:null_pages: ", p), err) 10811 } 10812 if err := oprot.WriteListBegin(ctx, thrift.BOOL, len(p.NullPages)); err != nil { 10813 return thrift.PrependError("error writing list begin: ", err) 10814 } 10815 for _, v := range p.NullPages { 10816 if err := oprot.WriteBool(ctx, bool(v)); err != nil { 10817 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) 10818 } 10819 } 10820 if err := oprot.WriteListEnd(ctx); err != nil { 10821 return thrift.PrependError("error writing list end: ", err) 10822 } 10823 if err := oprot.WriteFieldEnd(ctx); err != nil { 10824 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:null_pages: ", p), err) 10825 } 10826 return err 10827 } 10828 10829 func (p *ColumnIndex) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 10830 if err := oprot.WriteFieldBegin(ctx, "min_values", thrift.LIST, 2); err != nil { 10831 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:min_values: ", p), err) 10832 } 10833 if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.MinValues)); err != nil { 10834 return thrift.PrependError("error writing list begin: ", err) 10835 } 10836 for _, v := range p.MinValues { 10837 if err := oprot.WriteBinary(ctx, v); err != nil { 10838 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) 10839 } 10840 } 10841 if err := oprot.WriteListEnd(ctx); err != nil { 10842 return thrift.PrependError("error writing list end: ", err) 10843 } 10844 if err := oprot.WriteFieldEnd(ctx); err != nil { 10845 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:min_values: ", p), err) 10846 } 10847 return err 10848 } 10849 10850 func (p *ColumnIndex) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 10851 if err := oprot.WriteFieldBegin(ctx, "max_values", thrift.LIST, 3); err != nil { 10852 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:max_values: ", p), err) 10853 } 10854 if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.MaxValues)); err != nil { 10855 return thrift.PrependError("error writing list begin: ", err) 10856 } 10857 for _, v := range p.MaxValues { 10858 if err := oprot.WriteBinary(ctx, v); err != nil { 10859 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) 10860 } 10861 } 10862 if err := oprot.WriteListEnd(ctx); err != nil { 10863 return thrift.PrependError("error writing list end: ", err) 10864 } 10865 if err := oprot.WriteFieldEnd(ctx); err != nil { 10866 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:max_values: ", p), err) 10867 } 10868 return err 10869 } 10870 10871 func (p *ColumnIndex) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 10872 if err := oprot.WriteFieldBegin(ctx, "boundary_order", thrift.I32, 4); err != nil { 10873 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:boundary_order: ", p), err) 10874 } 10875 if err := oprot.WriteI32(ctx, int32(p.BoundaryOrder)); err != nil { 10876 return thrift.PrependError(fmt.Sprintf("%T.boundary_order (4) field write error: ", p), err) 10877 } 10878 if err := oprot.WriteFieldEnd(ctx); err != nil { 10879 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:boundary_order: ", p), err) 10880 } 10881 return err 10882 } 10883 10884 func (p *ColumnIndex) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 10885 if p.IsSetNullCounts() { 10886 if err := oprot.WriteFieldBegin(ctx, "null_counts", thrift.LIST, 5); err != nil { 10887 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:null_counts: ", p), err) 10888 } 10889 if err := oprot.WriteListBegin(ctx, thrift.I64, len(p.NullCounts)); err != nil { 10890 return thrift.PrependError("error writing list begin: ", err) 10891 } 10892 for _, v := range p.NullCounts { 10893 if err := oprot.WriteI64(ctx, int64(v)); err != nil { 10894 return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) 10895 } 10896 } 10897 if err := oprot.WriteListEnd(ctx); err != nil { 10898 return thrift.PrependError("error writing list end: ", err) 10899 } 10900 if err := oprot.WriteFieldEnd(ctx); err != nil { 10901 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:null_counts: ", p), err) 10902 } 10903 } 10904 return err 10905 } 10906 10907 func (p *ColumnIndex) Equals(other *ColumnIndex) bool { 10908 if p == other { 10909 return true 10910 } else if p == nil || other == nil { 10911 return false 10912 } 10913 if len(p.NullPages) != len(other.NullPages) { 10914 return false 10915 } 10916 for i, _tgt := range p.NullPages { 10917 _src20 := other.NullPages[i] 10918 if _tgt != _src20 { 10919 return false 10920 } 10921 } 10922 if len(p.MinValues) != len(other.MinValues) { 10923 return false 10924 } 10925 for i, _tgt := range p.MinValues { 10926 _src21 := other.MinValues[i] 10927 if bytes.Compare(_tgt, _src21) != 0 { 10928 return false 10929 } 10930 } 10931 if len(p.MaxValues) != len(other.MaxValues) { 10932 return false 10933 } 10934 for i, _tgt := range p.MaxValues { 10935 _src22 := other.MaxValues[i] 10936 if bytes.Compare(_tgt, _src22) != 0 { 10937 return false 10938 } 10939 } 10940 if p.BoundaryOrder != other.BoundaryOrder { 10941 return false 10942 } 10943 if len(p.NullCounts) != len(other.NullCounts) { 10944 return false 10945 } 10946 for i, _tgt := range p.NullCounts { 10947 _src23 := other.NullCounts[i] 10948 if _tgt != _src23 { 10949 return false 10950 } 10951 } 10952 return true 10953 } 10954 10955 func (p *ColumnIndex) String() string { 10956 if p == nil { 10957 return "<nil>" 10958 } 10959 return fmt.Sprintf("ColumnIndex(%+v)", *p) 10960 } 10961 10962 // Attributes: 10963 // - AadPrefix: AAD prefix * 10964 // - AadFileUnique: Unique file identifier part of AAD suffix * 10965 // - SupplyAadPrefix: In files encrypted with AAD prefix without storing it, 10966 // readers must supply the prefix * 10967 type AesGcmV1 struct { 10968 AadPrefix []byte `thrift:"aad_prefix,1" db:"aad_prefix" json:"aad_prefix,omitempty"` 10969 AadFileUnique []byte `thrift:"aad_file_unique,2" db:"aad_file_unique" json:"aad_file_unique,omitempty"` 10970 SupplyAadPrefix *bool `thrift:"supply_aad_prefix,3" db:"supply_aad_prefix" json:"supply_aad_prefix,omitempty"` 10971 } 10972 10973 func NewAesGcmV1() *AesGcmV1 { 10974 return &AesGcmV1{} 10975 } 10976 10977 var AesGcmV1_AadPrefix_DEFAULT []byte 10978 10979 func (p *AesGcmV1) GetAadPrefix() []byte { 10980 return p.AadPrefix 10981 } 10982 10983 var AesGcmV1_AadFileUnique_DEFAULT []byte 10984 10985 func (p *AesGcmV1) GetAadFileUnique() []byte { 10986 return p.AadFileUnique 10987 } 10988 10989 var AesGcmV1_SupplyAadPrefix_DEFAULT bool 10990 10991 func (p *AesGcmV1) GetSupplyAadPrefix() bool { 10992 if !p.IsSetSupplyAadPrefix() { 10993 return AesGcmV1_SupplyAadPrefix_DEFAULT 10994 } 10995 return *p.SupplyAadPrefix 10996 } 10997 func (p *AesGcmV1) IsSetAadPrefix() bool { 10998 return p.AadPrefix != nil 10999 } 11000 11001 func (p *AesGcmV1) IsSetAadFileUnique() bool { 11002 return p.AadFileUnique != nil 11003 } 11004 11005 func (p *AesGcmV1) IsSetSupplyAadPrefix() bool { 11006 return p.SupplyAadPrefix != nil 11007 } 11008 11009 func (p *AesGcmV1) Read(ctx context.Context, iprot thrift.TProtocol) error { 11010 if _, err := iprot.ReadStructBegin(ctx); err != nil { 11011 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 11012 } 11013 11014 for { 11015 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 11016 if err != nil { 11017 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 11018 } 11019 if fieldTypeId == thrift.STOP { 11020 break 11021 } 11022 switch fieldId { 11023 case 1: 11024 if fieldTypeId == thrift.STRING { 11025 if err := p.ReadField1(ctx, iprot); err != nil { 11026 return err 11027 } 11028 } else { 11029 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11030 return err 11031 } 11032 } 11033 case 2: 11034 if fieldTypeId == thrift.STRING { 11035 if err := p.ReadField2(ctx, iprot); err != nil { 11036 return err 11037 } 11038 } else { 11039 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11040 return err 11041 } 11042 } 11043 case 3: 11044 if fieldTypeId == thrift.BOOL { 11045 if err := p.ReadField3(ctx, iprot); err != nil { 11046 return err 11047 } 11048 } else { 11049 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11050 return err 11051 } 11052 } 11053 default: 11054 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11055 return err 11056 } 11057 } 11058 if err := iprot.ReadFieldEnd(ctx); err != nil { 11059 return err 11060 } 11061 } 11062 if err := iprot.ReadStructEnd(ctx); err != nil { 11063 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 11064 } 11065 return nil 11066 } 11067 11068 func (p *AesGcmV1) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 11069 if v, err := iprot.ReadBinary(ctx); err != nil { 11070 return thrift.PrependError("error reading field 1: ", err) 11071 } else { 11072 p.AadPrefix = v 11073 } 11074 return nil 11075 } 11076 11077 func (p *AesGcmV1) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 11078 if v, err := iprot.ReadBinary(ctx); err != nil { 11079 return thrift.PrependError("error reading field 2: ", err) 11080 } else { 11081 p.AadFileUnique = v 11082 } 11083 return nil 11084 } 11085 11086 func (p *AesGcmV1) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 11087 if v, err := iprot.ReadBool(ctx); err != nil { 11088 return thrift.PrependError("error reading field 3: ", err) 11089 } else { 11090 p.SupplyAadPrefix = &v 11091 } 11092 return nil 11093 } 11094 11095 func (p *AesGcmV1) Write(ctx context.Context, oprot thrift.TProtocol) error { 11096 if err := oprot.WriteStructBegin(ctx, "AesGcmV1"); err != nil { 11097 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 11098 } 11099 if p != nil { 11100 if err := p.writeField1(ctx, oprot); err != nil { 11101 return err 11102 } 11103 if err := p.writeField2(ctx, oprot); err != nil { 11104 return err 11105 } 11106 if err := p.writeField3(ctx, oprot); err != nil { 11107 return err 11108 } 11109 } 11110 if err := oprot.WriteFieldStop(ctx); err != nil { 11111 return thrift.PrependError("write field stop error: ", err) 11112 } 11113 if err := oprot.WriteStructEnd(ctx); err != nil { 11114 return thrift.PrependError("write struct stop error: ", err) 11115 } 11116 return nil 11117 } 11118 11119 func (p *AesGcmV1) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 11120 if p.IsSetAadPrefix() { 11121 if err := oprot.WriteFieldBegin(ctx, "aad_prefix", thrift.STRING, 1); err != nil { 11122 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:aad_prefix: ", p), err) 11123 } 11124 if err := oprot.WriteBinary(ctx, p.AadPrefix); err != nil { 11125 return thrift.PrependError(fmt.Sprintf("%T.aad_prefix (1) field write error: ", p), err) 11126 } 11127 if err := oprot.WriteFieldEnd(ctx); err != nil { 11128 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:aad_prefix: ", p), err) 11129 } 11130 } 11131 return err 11132 } 11133 11134 func (p *AesGcmV1) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 11135 if p.IsSetAadFileUnique() { 11136 if err := oprot.WriteFieldBegin(ctx, "aad_file_unique", thrift.STRING, 2); err != nil { 11137 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:aad_file_unique: ", p), err) 11138 } 11139 if err := oprot.WriteBinary(ctx, p.AadFileUnique); err != nil { 11140 return thrift.PrependError(fmt.Sprintf("%T.aad_file_unique (2) field write error: ", p), err) 11141 } 11142 if err := oprot.WriteFieldEnd(ctx); err != nil { 11143 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:aad_file_unique: ", p), err) 11144 } 11145 } 11146 return err 11147 } 11148 11149 func (p *AesGcmV1) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 11150 if p.IsSetSupplyAadPrefix() { 11151 if err := oprot.WriteFieldBegin(ctx, "supply_aad_prefix", thrift.BOOL, 3); err != nil { 11152 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:supply_aad_prefix: ", p), err) 11153 } 11154 if err := oprot.WriteBool(ctx, bool(*p.SupplyAadPrefix)); err != nil { 11155 return thrift.PrependError(fmt.Sprintf("%T.supply_aad_prefix (3) field write error: ", p), err) 11156 } 11157 if err := oprot.WriteFieldEnd(ctx); err != nil { 11158 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:supply_aad_prefix: ", p), err) 11159 } 11160 } 11161 return err 11162 } 11163 11164 func (p *AesGcmV1) Equals(other *AesGcmV1) bool { 11165 if p == other { 11166 return true 11167 } else if p == nil || other == nil { 11168 return false 11169 } 11170 if bytes.Compare(p.AadPrefix, other.AadPrefix) != 0 { 11171 return false 11172 } 11173 if bytes.Compare(p.AadFileUnique, other.AadFileUnique) != 0 { 11174 return false 11175 } 11176 if p.SupplyAadPrefix != other.SupplyAadPrefix { 11177 if p.SupplyAadPrefix == nil || other.SupplyAadPrefix == nil { 11178 return false 11179 } 11180 if (*p.SupplyAadPrefix) != (*other.SupplyAadPrefix) { 11181 return false 11182 } 11183 } 11184 return true 11185 } 11186 11187 func (p *AesGcmV1) String() string { 11188 if p == nil { 11189 return "<nil>" 11190 } 11191 return fmt.Sprintf("AesGcmV1(%+v)", *p) 11192 } 11193 11194 // Attributes: 11195 // - AadPrefix: AAD prefix * 11196 // - AadFileUnique: Unique file identifier part of AAD suffix * 11197 // - SupplyAadPrefix: In files encrypted with AAD prefix without storing it, 11198 // readers must supply the prefix * 11199 type AesGcmCtrV1 struct { 11200 AadPrefix []byte `thrift:"aad_prefix,1" db:"aad_prefix" json:"aad_prefix,omitempty"` 11201 AadFileUnique []byte `thrift:"aad_file_unique,2" db:"aad_file_unique" json:"aad_file_unique,omitempty"` 11202 SupplyAadPrefix *bool `thrift:"supply_aad_prefix,3" db:"supply_aad_prefix" json:"supply_aad_prefix,omitempty"` 11203 } 11204 11205 func NewAesGcmCtrV1() *AesGcmCtrV1 { 11206 return &AesGcmCtrV1{} 11207 } 11208 11209 var AesGcmCtrV1_AadPrefix_DEFAULT []byte 11210 11211 func (p *AesGcmCtrV1) GetAadPrefix() []byte { 11212 return p.AadPrefix 11213 } 11214 11215 var AesGcmCtrV1_AadFileUnique_DEFAULT []byte 11216 11217 func (p *AesGcmCtrV1) GetAadFileUnique() []byte { 11218 return p.AadFileUnique 11219 } 11220 11221 var AesGcmCtrV1_SupplyAadPrefix_DEFAULT bool 11222 11223 func (p *AesGcmCtrV1) GetSupplyAadPrefix() bool { 11224 if !p.IsSetSupplyAadPrefix() { 11225 return AesGcmCtrV1_SupplyAadPrefix_DEFAULT 11226 } 11227 return *p.SupplyAadPrefix 11228 } 11229 func (p *AesGcmCtrV1) IsSetAadPrefix() bool { 11230 return p.AadPrefix != nil 11231 } 11232 11233 func (p *AesGcmCtrV1) IsSetAadFileUnique() bool { 11234 return p.AadFileUnique != nil 11235 } 11236 11237 func (p *AesGcmCtrV1) IsSetSupplyAadPrefix() bool { 11238 return p.SupplyAadPrefix != nil 11239 } 11240 11241 func (p *AesGcmCtrV1) Read(ctx context.Context, iprot thrift.TProtocol) error { 11242 if _, err := iprot.ReadStructBegin(ctx); err != nil { 11243 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 11244 } 11245 11246 for { 11247 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 11248 if err != nil { 11249 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 11250 } 11251 if fieldTypeId == thrift.STOP { 11252 break 11253 } 11254 switch fieldId { 11255 case 1: 11256 if fieldTypeId == thrift.STRING { 11257 if err := p.ReadField1(ctx, iprot); err != nil { 11258 return err 11259 } 11260 } else { 11261 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11262 return err 11263 } 11264 } 11265 case 2: 11266 if fieldTypeId == thrift.STRING { 11267 if err := p.ReadField2(ctx, iprot); err != nil { 11268 return err 11269 } 11270 } else { 11271 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11272 return err 11273 } 11274 } 11275 case 3: 11276 if fieldTypeId == thrift.BOOL { 11277 if err := p.ReadField3(ctx, iprot); err != nil { 11278 return err 11279 } 11280 } else { 11281 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11282 return err 11283 } 11284 } 11285 default: 11286 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11287 return err 11288 } 11289 } 11290 if err := iprot.ReadFieldEnd(ctx); err != nil { 11291 return err 11292 } 11293 } 11294 if err := iprot.ReadStructEnd(ctx); err != nil { 11295 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 11296 } 11297 return nil 11298 } 11299 11300 func (p *AesGcmCtrV1) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 11301 if v, err := iprot.ReadBinary(ctx); err != nil { 11302 return thrift.PrependError("error reading field 1: ", err) 11303 } else { 11304 p.AadPrefix = v 11305 } 11306 return nil 11307 } 11308 11309 func (p *AesGcmCtrV1) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 11310 if v, err := iprot.ReadBinary(ctx); err != nil { 11311 return thrift.PrependError("error reading field 2: ", err) 11312 } else { 11313 p.AadFileUnique = v 11314 } 11315 return nil 11316 } 11317 11318 func (p *AesGcmCtrV1) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 11319 if v, err := iprot.ReadBool(ctx); err != nil { 11320 return thrift.PrependError("error reading field 3: ", err) 11321 } else { 11322 p.SupplyAadPrefix = &v 11323 } 11324 return nil 11325 } 11326 11327 func (p *AesGcmCtrV1) Write(ctx context.Context, oprot thrift.TProtocol) error { 11328 if err := oprot.WriteStructBegin(ctx, "AesGcmCtrV1"); err != nil { 11329 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 11330 } 11331 if p != nil { 11332 if err := p.writeField1(ctx, oprot); err != nil { 11333 return err 11334 } 11335 if err := p.writeField2(ctx, oprot); err != nil { 11336 return err 11337 } 11338 if err := p.writeField3(ctx, oprot); err != nil { 11339 return err 11340 } 11341 } 11342 if err := oprot.WriteFieldStop(ctx); err != nil { 11343 return thrift.PrependError("write field stop error: ", err) 11344 } 11345 if err := oprot.WriteStructEnd(ctx); err != nil { 11346 return thrift.PrependError("write struct stop error: ", err) 11347 } 11348 return nil 11349 } 11350 11351 func (p *AesGcmCtrV1) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 11352 if p.IsSetAadPrefix() { 11353 if err := oprot.WriteFieldBegin(ctx, "aad_prefix", thrift.STRING, 1); err != nil { 11354 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:aad_prefix: ", p), err) 11355 } 11356 if err := oprot.WriteBinary(ctx, p.AadPrefix); err != nil { 11357 return thrift.PrependError(fmt.Sprintf("%T.aad_prefix (1) field write error: ", p), err) 11358 } 11359 if err := oprot.WriteFieldEnd(ctx); err != nil { 11360 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:aad_prefix: ", p), err) 11361 } 11362 } 11363 return err 11364 } 11365 11366 func (p *AesGcmCtrV1) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 11367 if p.IsSetAadFileUnique() { 11368 if err := oprot.WriteFieldBegin(ctx, "aad_file_unique", thrift.STRING, 2); err != nil { 11369 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:aad_file_unique: ", p), err) 11370 } 11371 if err := oprot.WriteBinary(ctx, p.AadFileUnique); err != nil { 11372 return thrift.PrependError(fmt.Sprintf("%T.aad_file_unique (2) field write error: ", p), err) 11373 } 11374 if err := oprot.WriteFieldEnd(ctx); err != nil { 11375 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:aad_file_unique: ", p), err) 11376 } 11377 } 11378 return err 11379 } 11380 11381 func (p *AesGcmCtrV1) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 11382 if p.IsSetSupplyAadPrefix() { 11383 if err := oprot.WriteFieldBegin(ctx, "supply_aad_prefix", thrift.BOOL, 3); err != nil { 11384 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:supply_aad_prefix: ", p), err) 11385 } 11386 if err := oprot.WriteBool(ctx, bool(*p.SupplyAadPrefix)); err != nil { 11387 return thrift.PrependError(fmt.Sprintf("%T.supply_aad_prefix (3) field write error: ", p), err) 11388 } 11389 if err := oprot.WriteFieldEnd(ctx); err != nil { 11390 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:supply_aad_prefix: ", p), err) 11391 } 11392 } 11393 return err 11394 } 11395 11396 func (p *AesGcmCtrV1) Equals(other *AesGcmCtrV1) bool { 11397 if p == other { 11398 return true 11399 } else if p == nil || other == nil { 11400 return false 11401 } 11402 if bytes.Compare(p.AadPrefix, other.AadPrefix) != 0 { 11403 return false 11404 } 11405 if bytes.Compare(p.AadFileUnique, other.AadFileUnique) != 0 { 11406 return false 11407 } 11408 if p.SupplyAadPrefix != other.SupplyAadPrefix { 11409 if p.SupplyAadPrefix == nil || other.SupplyAadPrefix == nil { 11410 return false 11411 } 11412 if (*p.SupplyAadPrefix) != (*other.SupplyAadPrefix) { 11413 return false 11414 } 11415 } 11416 return true 11417 } 11418 11419 func (p *AesGcmCtrV1) String() string { 11420 if p == nil { 11421 return "<nil>" 11422 } 11423 return fmt.Sprintf("AesGcmCtrV1(%+v)", *p) 11424 } 11425 11426 // Attributes: 11427 // - AES_GCM_V1 11428 // - AES_GCM_CTR_V1 11429 type EncryptionAlgorithm struct { 11430 AES_GCM_V1 *AesGcmV1 `thrift:"AES_GCM_V1,1" db:"AES_GCM_V1" json:"AES_GCM_V1,omitempty"` 11431 AES_GCM_CTR_V1 *AesGcmCtrV1 `thrift:"AES_GCM_CTR_V1,2" db:"AES_GCM_CTR_V1" json:"AES_GCM_CTR_V1,omitempty"` 11432 } 11433 11434 func NewEncryptionAlgorithm() *EncryptionAlgorithm { 11435 return &EncryptionAlgorithm{} 11436 } 11437 11438 var EncryptionAlgorithm_AES_GCM_V1_DEFAULT *AesGcmV1 11439 11440 func (p *EncryptionAlgorithm) GetAES_GCM_V1() *AesGcmV1 { 11441 if !p.IsSetAES_GCM_V1() { 11442 return EncryptionAlgorithm_AES_GCM_V1_DEFAULT 11443 } 11444 return p.AES_GCM_V1 11445 } 11446 11447 var EncryptionAlgorithm_AES_GCM_CTR_V1_DEFAULT *AesGcmCtrV1 11448 11449 func (p *EncryptionAlgorithm) GetAES_GCM_CTR_V1() *AesGcmCtrV1 { 11450 if !p.IsSetAES_GCM_CTR_V1() { 11451 return EncryptionAlgorithm_AES_GCM_CTR_V1_DEFAULT 11452 } 11453 return p.AES_GCM_CTR_V1 11454 } 11455 func (p *EncryptionAlgorithm) CountSetFieldsEncryptionAlgorithm() int { 11456 count := 0 11457 if p.IsSetAES_GCM_V1() { 11458 count++ 11459 } 11460 if p.IsSetAES_GCM_CTR_V1() { 11461 count++ 11462 } 11463 return count 11464 11465 } 11466 11467 func (p *EncryptionAlgorithm) IsSetAES_GCM_V1() bool { 11468 return p.AES_GCM_V1 != nil 11469 } 11470 11471 func (p *EncryptionAlgorithm) IsSetAES_GCM_CTR_V1() bool { 11472 return p.AES_GCM_CTR_V1 != nil 11473 } 11474 11475 func (p *EncryptionAlgorithm) Read(ctx context.Context, iprot thrift.TProtocol) error { 11476 if _, err := iprot.ReadStructBegin(ctx); err != nil { 11477 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 11478 } 11479 11480 for { 11481 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 11482 if err != nil { 11483 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 11484 } 11485 if fieldTypeId == thrift.STOP { 11486 break 11487 } 11488 switch fieldId { 11489 case 1: 11490 if fieldTypeId == thrift.STRUCT { 11491 if err := p.ReadField1(ctx, iprot); err != nil { 11492 return err 11493 } 11494 } else { 11495 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11496 return err 11497 } 11498 } 11499 case 2: 11500 if fieldTypeId == thrift.STRUCT { 11501 if err := p.ReadField2(ctx, iprot); err != nil { 11502 return err 11503 } 11504 } else { 11505 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11506 return err 11507 } 11508 } 11509 default: 11510 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11511 return err 11512 } 11513 } 11514 if err := iprot.ReadFieldEnd(ctx); err != nil { 11515 return err 11516 } 11517 } 11518 if err := iprot.ReadStructEnd(ctx); err != nil { 11519 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 11520 } 11521 return nil 11522 } 11523 11524 func (p *EncryptionAlgorithm) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 11525 p.AES_GCM_V1 = &AesGcmV1{} 11526 if err := p.AES_GCM_V1.Read(ctx, iprot); err != nil { 11527 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.AES_GCM_V1), err) 11528 } 11529 return nil 11530 } 11531 11532 func (p *EncryptionAlgorithm) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 11533 p.AES_GCM_CTR_V1 = &AesGcmCtrV1{} 11534 if err := p.AES_GCM_CTR_V1.Read(ctx, iprot); err != nil { 11535 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.AES_GCM_CTR_V1), err) 11536 } 11537 return nil 11538 } 11539 11540 func (p *EncryptionAlgorithm) Write(ctx context.Context, oprot thrift.TProtocol) error { 11541 if c := p.CountSetFieldsEncryptionAlgorithm(); c != 1 { 11542 return fmt.Errorf("%T write union: exactly one field must be set (%d set)", p, c) 11543 } 11544 if err := oprot.WriteStructBegin(ctx, "EncryptionAlgorithm"); err != nil { 11545 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 11546 } 11547 if p != nil { 11548 if err := p.writeField1(ctx, oprot); err != nil { 11549 return err 11550 } 11551 if err := p.writeField2(ctx, oprot); err != nil { 11552 return err 11553 } 11554 } 11555 if err := oprot.WriteFieldStop(ctx); err != nil { 11556 return thrift.PrependError("write field stop error: ", err) 11557 } 11558 if err := oprot.WriteStructEnd(ctx); err != nil { 11559 return thrift.PrependError("write struct stop error: ", err) 11560 } 11561 return nil 11562 } 11563 11564 func (p *EncryptionAlgorithm) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 11565 if p.IsSetAES_GCM_V1() { 11566 if err := oprot.WriteFieldBegin(ctx, "AES_GCM_V1", thrift.STRUCT, 1); err != nil { 11567 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:AES_GCM_V1: ", p), err) 11568 } 11569 if err := p.AES_GCM_V1.Write(ctx, oprot); err != nil { 11570 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.AES_GCM_V1), err) 11571 } 11572 if err := oprot.WriteFieldEnd(ctx); err != nil { 11573 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:AES_GCM_V1: ", p), err) 11574 } 11575 } 11576 return err 11577 } 11578 11579 func (p *EncryptionAlgorithm) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 11580 if p.IsSetAES_GCM_CTR_V1() { 11581 if err := oprot.WriteFieldBegin(ctx, "AES_GCM_CTR_V1", thrift.STRUCT, 2); err != nil { 11582 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:AES_GCM_CTR_V1: ", p), err) 11583 } 11584 if err := p.AES_GCM_CTR_V1.Write(ctx, oprot); err != nil { 11585 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.AES_GCM_CTR_V1), err) 11586 } 11587 if err := oprot.WriteFieldEnd(ctx); err != nil { 11588 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:AES_GCM_CTR_V1: ", p), err) 11589 } 11590 } 11591 return err 11592 } 11593 11594 func (p *EncryptionAlgorithm) Equals(other *EncryptionAlgorithm) bool { 11595 if p == other { 11596 return true 11597 } else if p == nil || other == nil { 11598 return false 11599 } 11600 if !p.AES_GCM_V1.Equals(other.AES_GCM_V1) { 11601 return false 11602 } 11603 if !p.AES_GCM_CTR_V1.Equals(other.AES_GCM_CTR_V1) { 11604 return false 11605 } 11606 return true 11607 } 11608 11609 func (p *EncryptionAlgorithm) String() string { 11610 if p == nil { 11611 return "<nil>" 11612 } 11613 return fmt.Sprintf("EncryptionAlgorithm(%+v)", *p) 11614 } 11615 11616 // Description for file metadata 11617 // 11618 // Attributes: 11619 // - Version: Version of this file * 11620 // - Schema: Parquet schema for this file. This schema contains metadata for all the columns. 11621 // The schema is represented as a tree with a single root. The nodes of the tree 11622 // are flattened to a list by doing a depth-first traversal. 11623 // The column metadata contains the path in the schema for that column which can be 11624 // used to map columns to nodes in the schema. 11625 // The first element is the root * 11626 // - NumRows: Number of rows in this file * 11627 // - RowGroups: Row groups in this file * 11628 // - KeyValueMetadata: Optional key/value metadata * 11629 // - CreatedBy: String for application that wrote this file. This should be in the format 11630 // <Application> version <App Version> (build <App Build Hash>). 11631 // e.g. impala version 1.0 (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55) 11632 // 11633 // - ColumnOrders: Sort order used for the min_value and max_value fields of each column in 11634 // this file. Sort orders are listed in the order matching the columns in the 11635 // schema. The indexes are not necessary the same though, because only leaf 11636 // nodes of the schema are represented in the list of sort orders. 11637 // 11638 // Without column_orders, the meaning of the min_value and max_value fields is 11639 // undefined. To ensure well-defined behaviour, if min_value and max_value are 11640 // written to a Parquet file, column_orders must be written as well. 11641 // 11642 // The obsolete min and max fields are always sorted by signed comparison 11643 // regardless of column_orders. 11644 // - EncryptionAlgorithm: Encryption algorithm. This field is set only in encrypted files 11645 // with plaintext footer. Files with encrypted footer store algorithm id 11646 // in FileCryptoMetaData structure. 11647 // - FooterSigningKeyMetadata: Retrieval metadata of key used for signing the footer. 11648 // Used only in encrypted files with plaintext footer. 11649 type FileMetaData struct { 11650 Version int32 `thrift:"version,1,required" db:"version" json:"version"` 11651 Schema []*SchemaElement `thrift:"schema,2,required" db:"schema" json:"schema"` 11652 NumRows int64 `thrift:"num_rows,3,required" db:"num_rows" json:"num_rows"` 11653 RowGroups []*RowGroup `thrift:"row_groups,4,required" db:"row_groups" json:"row_groups"` 11654 KeyValueMetadata []*KeyValue `thrift:"key_value_metadata,5" db:"key_value_metadata" json:"key_value_metadata,omitempty"` 11655 CreatedBy *string `thrift:"created_by,6" db:"created_by" json:"created_by,omitempty"` 11656 ColumnOrders []*ColumnOrder `thrift:"column_orders,7" db:"column_orders" json:"column_orders,omitempty"` 11657 EncryptionAlgorithm *EncryptionAlgorithm `thrift:"encryption_algorithm,8" db:"encryption_algorithm" json:"encryption_algorithm,omitempty"` 11658 FooterSigningKeyMetadata []byte `thrift:"footer_signing_key_metadata,9" db:"footer_signing_key_metadata" json:"footer_signing_key_metadata,omitempty"` 11659 } 11660 11661 func NewFileMetaData() *FileMetaData { 11662 return &FileMetaData{} 11663 } 11664 11665 func (p *FileMetaData) GetVersion() int32 { 11666 return p.Version 11667 } 11668 11669 func (p *FileMetaData) GetSchema() []*SchemaElement { 11670 return p.Schema 11671 } 11672 11673 func (p *FileMetaData) GetNumRows() int64 { 11674 return p.NumRows 11675 } 11676 11677 func (p *FileMetaData) GetRowGroups() []*RowGroup { 11678 return p.RowGroups 11679 } 11680 11681 var FileMetaData_KeyValueMetadata_DEFAULT []*KeyValue 11682 11683 func (p *FileMetaData) GetKeyValueMetadata() []*KeyValue { 11684 return p.KeyValueMetadata 11685 } 11686 11687 var FileMetaData_CreatedBy_DEFAULT string 11688 11689 func (p *FileMetaData) GetCreatedBy() string { 11690 if !p.IsSetCreatedBy() { 11691 return FileMetaData_CreatedBy_DEFAULT 11692 } 11693 return *p.CreatedBy 11694 } 11695 11696 var FileMetaData_ColumnOrders_DEFAULT []*ColumnOrder 11697 11698 func (p *FileMetaData) GetColumnOrders() []*ColumnOrder { 11699 return p.ColumnOrders 11700 } 11701 11702 var FileMetaData_EncryptionAlgorithm_DEFAULT *EncryptionAlgorithm 11703 11704 func (p *FileMetaData) GetEncryptionAlgorithm() *EncryptionAlgorithm { 11705 if !p.IsSetEncryptionAlgorithm() { 11706 return FileMetaData_EncryptionAlgorithm_DEFAULT 11707 } 11708 return p.EncryptionAlgorithm 11709 } 11710 11711 var FileMetaData_FooterSigningKeyMetadata_DEFAULT []byte 11712 11713 func (p *FileMetaData) GetFooterSigningKeyMetadata() []byte { 11714 return p.FooterSigningKeyMetadata 11715 } 11716 func (p *FileMetaData) IsSetKeyValueMetadata() bool { 11717 return p.KeyValueMetadata != nil 11718 } 11719 11720 func (p *FileMetaData) IsSetCreatedBy() bool { 11721 return p.CreatedBy != nil 11722 } 11723 11724 func (p *FileMetaData) IsSetColumnOrders() bool { 11725 return p.ColumnOrders != nil 11726 } 11727 11728 func (p *FileMetaData) IsSetEncryptionAlgorithm() bool { 11729 return p.EncryptionAlgorithm != nil 11730 } 11731 11732 func (p *FileMetaData) IsSetFooterSigningKeyMetadata() bool { 11733 return p.FooterSigningKeyMetadata != nil 11734 } 11735 11736 func (p *FileMetaData) Read(ctx context.Context, iprot thrift.TProtocol) error { 11737 if _, err := iprot.ReadStructBegin(ctx); err != nil { 11738 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 11739 } 11740 11741 var issetVersion bool = false 11742 var issetSchema bool = false 11743 var issetNumRows bool = false 11744 var issetRowGroups bool = false 11745 11746 for { 11747 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 11748 if err != nil { 11749 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 11750 } 11751 if fieldTypeId == thrift.STOP { 11752 break 11753 } 11754 switch fieldId { 11755 case 1: 11756 if fieldTypeId == thrift.I32 { 11757 if err := p.ReadField1(ctx, iprot); err != nil { 11758 return err 11759 } 11760 issetVersion = true 11761 } else { 11762 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11763 return err 11764 } 11765 } 11766 case 2: 11767 if fieldTypeId == thrift.LIST { 11768 if err := p.ReadField2(ctx, iprot); err != nil { 11769 return err 11770 } 11771 issetSchema = true 11772 } else { 11773 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11774 return err 11775 } 11776 } 11777 case 3: 11778 if fieldTypeId == thrift.I64 { 11779 if err := p.ReadField3(ctx, iprot); err != nil { 11780 return err 11781 } 11782 issetNumRows = true 11783 } else { 11784 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11785 return err 11786 } 11787 } 11788 case 4: 11789 if fieldTypeId == thrift.LIST { 11790 if err := p.ReadField4(ctx, iprot); err != nil { 11791 return err 11792 } 11793 issetRowGroups = true 11794 } else { 11795 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11796 return err 11797 } 11798 } 11799 case 5: 11800 if fieldTypeId == thrift.LIST { 11801 if err := p.ReadField5(ctx, iprot); err != nil { 11802 return err 11803 } 11804 } else { 11805 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11806 return err 11807 } 11808 } 11809 case 6: 11810 if fieldTypeId == thrift.STRING { 11811 if err := p.ReadField6(ctx, iprot); err != nil { 11812 return err 11813 } 11814 } else { 11815 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11816 return err 11817 } 11818 } 11819 case 7: 11820 if fieldTypeId == thrift.LIST { 11821 if err := p.ReadField7(ctx, iprot); err != nil { 11822 return err 11823 } 11824 } else { 11825 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11826 return err 11827 } 11828 } 11829 case 8: 11830 if fieldTypeId == thrift.STRUCT { 11831 if err := p.ReadField8(ctx, iprot); err != nil { 11832 return err 11833 } 11834 } else { 11835 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11836 return err 11837 } 11838 } 11839 case 9: 11840 if fieldTypeId == thrift.STRING { 11841 if err := p.ReadField9(ctx, iprot); err != nil { 11842 return err 11843 } 11844 } else { 11845 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11846 return err 11847 } 11848 } 11849 default: 11850 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 11851 return err 11852 } 11853 } 11854 if err := iprot.ReadFieldEnd(ctx); err != nil { 11855 return err 11856 } 11857 } 11858 if err := iprot.ReadStructEnd(ctx); err != nil { 11859 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 11860 } 11861 if !issetVersion { 11862 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Version is not set")) 11863 } 11864 if !issetSchema { 11865 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Schema is not set")) 11866 } 11867 if !issetNumRows { 11868 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field NumRows is not set")) 11869 } 11870 if !issetRowGroups { 11871 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RowGroups is not set")) 11872 } 11873 return nil 11874 } 11875 11876 func (p *FileMetaData) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 11877 if v, err := iprot.ReadI32(ctx); err != nil { 11878 return thrift.PrependError("error reading field 1: ", err) 11879 } else { 11880 p.Version = v 11881 } 11882 return nil 11883 } 11884 11885 func (p *FileMetaData) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 11886 _, size, err := iprot.ReadListBegin(ctx) 11887 if size < 0 { 11888 return errors.New("list size is negative") 11889 } 11890 if err != nil { 11891 return thrift.PrependError("error reading list begin: ", err) 11892 } 11893 tSlice := make([]*SchemaElement, 0, size) 11894 p.Schema = tSlice 11895 for i := 0; i < size; i++ { 11896 _elem24 := &SchemaElement{} 11897 if err := _elem24.Read(ctx, iprot); err != nil { 11898 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem24), err) 11899 } 11900 p.Schema = append(p.Schema, _elem24) 11901 } 11902 if err := iprot.ReadListEnd(ctx); err != nil { 11903 return thrift.PrependError("error reading list end: ", err) 11904 } 11905 return nil 11906 } 11907 11908 func (p *FileMetaData) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { 11909 if v, err := iprot.ReadI64(ctx); err != nil { 11910 return thrift.PrependError("error reading field 3: ", err) 11911 } else { 11912 p.NumRows = v 11913 } 11914 return nil 11915 } 11916 11917 func (p *FileMetaData) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { 11918 _, size, err := iprot.ReadListBegin(ctx) 11919 if size < 0 { 11920 return errors.New("list size is negative") 11921 } 11922 if err != nil { 11923 return thrift.PrependError("error reading list begin: ", err) 11924 } 11925 tSlice := make([]*RowGroup, 0, size) 11926 p.RowGroups = tSlice 11927 for i := 0; i < size; i++ { 11928 _elem25 := &RowGroup{} 11929 if err := _elem25.Read(ctx, iprot); err != nil { 11930 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem25), err) 11931 } 11932 p.RowGroups = append(p.RowGroups, _elem25) 11933 } 11934 if err := iprot.ReadListEnd(ctx); err != nil { 11935 return thrift.PrependError("error reading list end: ", err) 11936 } 11937 return nil 11938 } 11939 11940 func (p *FileMetaData) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { 11941 _, size, err := iprot.ReadListBegin(ctx) 11942 if size < 0 { 11943 return errors.New("list size is negative") 11944 } 11945 if err != nil { 11946 return thrift.PrependError("error reading list begin: ", err) 11947 } 11948 tSlice := make([]*KeyValue, 0, size) 11949 p.KeyValueMetadata = tSlice 11950 for i := 0; i < size; i++ { 11951 _elem26 := &KeyValue{} 11952 if err := _elem26.Read(ctx, iprot); err != nil { 11953 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem26), err) 11954 } 11955 p.KeyValueMetadata = append(p.KeyValueMetadata, _elem26) 11956 } 11957 if err := iprot.ReadListEnd(ctx); err != nil { 11958 return thrift.PrependError("error reading list end: ", err) 11959 } 11960 return nil 11961 } 11962 11963 func (p *FileMetaData) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { 11964 if v, err := iprot.ReadString(ctx); err != nil { 11965 return thrift.PrependError("error reading field 6: ", err) 11966 } else { 11967 p.CreatedBy = &v 11968 } 11969 return nil 11970 } 11971 11972 func (p *FileMetaData) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { 11973 _, size, err := iprot.ReadListBegin(ctx) 11974 if size < 0 { 11975 return errors.New("list size is negative") 11976 } 11977 if err != nil { 11978 return thrift.PrependError("error reading list begin: ", err) 11979 } 11980 tSlice := make([]*ColumnOrder, 0, size) 11981 p.ColumnOrders = tSlice 11982 for i := 0; i < size; i++ { 11983 _elem27 := &ColumnOrder{} 11984 if err := _elem27.Read(ctx, iprot); err != nil { 11985 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem27), err) 11986 } 11987 p.ColumnOrders = append(p.ColumnOrders, _elem27) 11988 } 11989 if err := iprot.ReadListEnd(ctx); err != nil { 11990 return thrift.PrependError("error reading list end: ", err) 11991 } 11992 return nil 11993 } 11994 11995 func (p *FileMetaData) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { 11996 p.EncryptionAlgorithm = &EncryptionAlgorithm{} 11997 if err := p.EncryptionAlgorithm.Read(ctx, iprot); err != nil { 11998 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.EncryptionAlgorithm), err) 11999 } 12000 return nil 12001 } 12002 12003 func (p *FileMetaData) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { 12004 if v, err := iprot.ReadBinary(ctx); err != nil { 12005 return thrift.PrependError("error reading field 9: ", err) 12006 } else { 12007 p.FooterSigningKeyMetadata = v 12008 } 12009 return nil 12010 } 12011 12012 func (p *FileMetaData) Write(ctx context.Context, oprot thrift.TProtocol) error { 12013 if err := oprot.WriteStructBegin(ctx, "FileMetaData"); err != nil { 12014 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 12015 } 12016 if p != nil { 12017 if err := p.writeField1(ctx, oprot); err != nil { 12018 return err 12019 } 12020 if err := p.writeField2(ctx, oprot); err != nil { 12021 return err 12022 } 12023 if err := p.writeField3(ctx, oprot); err != nil { 12024 return err 12025 } 12026 if err := p.writeField4(ctx, oprot); err != nil { 12027 return err 12028 } 12029 if err := p.writeField5(ctx, oprot); err != nil { 12030 return err 12031 } 12032 if err := p.writeField6(ctx, oprot); err != nil { 12033 return err 12034 } 12035 if err := p.writeField7(ctx, oprot); err != nil { 12036 return err 12037 } 12038 if err := p.writeField8(ctx, oprot); err != nil { 12039 return err 12040 } 12041 if err := p.writeField9(ctx, oprot); err != nil { 12042 return err 12043 } 12044 } 12045 if err := oprot.WriteFieldStop(ctx); err != nil { 12046 return thrift.PrependError("write field stop error: ", err) 12047 } 12048 if err := oprot.WriteStructEnd(ctx); err != nil { 12049 return thrift.PrependError("write struct stop error: ", err) 12050 } 12051 return nil 12052 } 12053 12054 func (p *FileMetaData) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 12055 if err := oprot.WriteFieldBegin(ctx, "version", thrift.I32, 1); err != nil { 12056 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:version: ", p), err) 12057 } 12058 if err := oprot.WriteI32(ctx, int32(p.Version)); err != nil { 12059 return thrift.PrependError(fmt.Sprintf("%T.version (1) field write error: ", p), err) 12060 } 12061 if err := oprot.WriteFieldEnd(ctx); err != nil { 12062 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:version: ", p), err) 12063 } 12064 return err 12065 } 12066 12067 func (p *FileMetaData) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 12068 if err := oprot.WriteFieldBegin(ctx, "schema", thrift.LIST, 2); err != nil { 12069 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:schema: ", p), err) 12070 } 12071 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Schema)); err != nil { 12072 return thrift.PrependError("error writing list begin: ", err) 12073 } 12074 for _, v := range p.Schema { 12075 if err := v.Write(ctx, oprot); err != nil { 12076 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 12077 } 12078 } 12079 if err := oprot.WriteListEnd(ctx); err != nil { 12080 return thrift.PrependError("error writing list end: ", err) 12081 } 12082 if err := oprot.WriteFieldEnd(ctx); err != nil { 12083 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:schema: ", p), err) 12084 } 12085 return err 12086 } 12087 12088 func (p *FileMetaData) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { 12089 if err := oprot.WriteFieldBegin(ctx, "num_rows", thrift.I64, 3); err != nil { 12090 return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:num_rows: ", p), err) 12091 } 12092 if err := oprot.WriteI64(ctx, int64(p.NumRows)); err != nil { 12093 return thrift.PrependError(fmt.Sprintf("%T.num_rows (3) field write error: ", p), err) 12094 } 12095 if err := oprot.WriteFieldEnd(ctx); err != nil { 12096 return thrift.PrependError(fmt.Sprintf("%T write field end error 3:num_rows: ", p), err) 12097 } 12098 return err 12099 } 12100 12101 func (p *FileMetaData) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { 12102 if err := oprot.WriteFieldBegin(ctx, "row_groups", thrift.LIST, 4); err != nil { 12103 return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:row_groups: ", p), err) 12104 } 12105 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.RowGroups)); err != nil { 12106 return thrift.PrependError("error writing list begin: ", err) 12107 } 12108 for _, v := range p.RowGroups { 12109 if err := v.Write(ctx, oprot); err != nil { 12110 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 12111 } 12112 } 12113 if err := oprot.WriteListEnd(ctx); err != nil { 12114 return thrift.PrependError("error writing list end: ", err) 12115 } 12116 if err := oprot.WriteFieldEnd(ctx); err != nil { 12117 return thrift.PrependError(fmt.Sprintf("%T write field end error 4:row_groups: ", p), err) 12118 } 12119 return err 12120 } 12121 12122 func (p *FileMetaData) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { 12123 if p.IsSetKeyValueMetadata() { 12124 if err := oprot.WriteFieldBegin(ctx, "key_value_metadata", thrift.LIST, 5); err != nil { 12125 return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:key_value_metadata: ", p), err) 12126 } 12127 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.KeyValueMetadata)); err != nil { 12128 return thrift.PrependError("error writing list begin: ", err) 12129 } 12130 for _, v := range p.KeyValueMetadata { 12131 if err := v.Write(ctx, oprot); err != nil { 12132 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 12133 } 12134 } 12135 if err := oprot.WriteListEnd(ctx); err != nil { 12136 return thrift.PrependError("error writing list end: ", err) 12137 } 12138 if err := oprot.WriteFieldEnd(ctx); err != nil { 12139 return thrift.PrependError(fmt.Sprintf("%T write field end error 5:key_value_metadata: ", p), err) 12140 } 12141 } 12142 return err 12143 } 12144 12145 func (p *FileMetaData) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { 12146 if p.IsSetCreatedBy() { 12147 if err := oprot.WriteFieldBegin(ctx, "created_by", thrift.STRING, 6); err != nil { 12148 return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:created_by: ", p), err) 12149 } 12150 if err := oprot.WriteString(ctx, string(*p.CreatedBy)); err != nil { 12151 return thrift.PrependError(fmt.Sprintf("%T.created_by (6) field write error: ", p), err) 12152 } 12153 if err := oprot.WriteFieldEnd(ctx); err != nil { 12154 return thrift.PrependError(fmt.Sprintf("%T write field end error 6:created_by: ", p), err) 12155 } 12156 } 12157 return err 12158 } 12159 12160 func (p *FileMetaData) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { 12161 if p.IsSetColumnOrders() { 12162 if err := oprot.WriteFieldBegin(ctx, "column_orders", thrift.LIST, 7); err != nil { 12163 return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:column_orders: ", p), err) 12164 } 12165 if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.ColumnOrders)); err != nil { 12166 return thrift.PrependError("error writing list begin: ", err) 12167 } 12168 for _, v := range p.ColumnOrders { 12169 if err := v.Write(ctx, oprot); err != nil { 12170 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) 12171 } 12172 } 12173 if err := oprot.WriteListEnd(ctx); err != nil { 12174 return thrift.PrependError("error writing list end: ", err) 12175 } 12176 if err := oprot.WriteFieldEnd(ctx); err != nil { 12177 return thrift.PrependError(fmt.Sprintf("%T write field end error 7:column_orders: ", p), err) 12178 } 12179 } 12180 return err 12181 } 12182 12183 func (p *FileMetaData) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { 12184 if p.IsSetEncryptionAlgorithm() { 12185 if err := oprot.WriteFieldBegin(ctx, "encryption_algorithm", thrift.STRUCT, 8); err != nil { 12186 return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:encryption_algorithm: ", p), err) 12187 } 12188 if err := p.EncryptionAlgorithm.Write(ctx, oprot); err != nil { 12189 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.EncryptionAlgorithm), err) 12190 } 12191 if err := oprot.WriteFieldEnd(ctx); err != nil { 12192 return thrift.PrependError(fmt.Sprintf("%T write field end error 8:encryption_algorithm: ", p), err) 12193 } 12194 } 12195 return err 12196 } 12197 12198 func (p *FileMetaData) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { 12199 if p.IsSetFooterSigningKeyMetadata() { 12200 if err := oprot.WriteFieldBegin(ctx, "footer_signing_key_metadata", thrift.STRING, 9); err != nil { 12201 return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:footer_signing_key_metadata: ", p), err) 12202 } 12203 if err := oprot.WriteBinary(ctx, p.FooterSigningKeyMetadata); err != nil { 12204 return thrift.PrependError(fmt.Sprintf("%T.footer_signing_key_metadata (9) field write error: ", p), err) 12205 } 12206 if err := oprot.WriteFieldEnd(ctx); err != nil { 12207 return thrift.PrependError(fmt.Sprintf("%T write field end error 9:footer_signing_key_metadata: ", p), err) 12208 } 12209 } 12210 return err 12211 } 12212 12213 func (p *FileMetaData) Equals(other *FileMetaData) bool { 12214 if p == other { 12215 return true 12216 } else if p == nil || other == nil { 12217 return false 12218 } 12219 if p.Version != other.Version { 12220 return false 12221 } 12222 if len(p.Schema) != len(other.Schema) { 12223 return false 12224 } 12225 for i, _tgt := range p.Schema { 12226 _src28 := other.Schema[i] 12227 if !_tgt.Equals(_src28) { 12228 return false 12229 } 12230 } 12231 if p.NumRows != other.NumRows { 12232 return false 12233 } 12234 if len(p.RowGroups) != len(other.RowGroups) { 12235 return false 12236 } 12237 for i, _tgt := range p.RowGroups { 12238 _src29 := other.RowGroups[i] 12239 if !_tgt.Equals(_src29) { 12240 return false 12241 } 12242 } 12243 if len(p.KeyValueMetadata) != len(other.KeyValueMetadata) { 12244 return false 12245 } 12246 for i, _tgt := range p.KeyValueMetadata { 12247 _src30 := other.KeyValueMetadata[i] 12248 if !_tgt.Equals(_src30) { 12249 return false 12250 } 12251 } 12252 if p.CreatedBy != other.CreatedBy { 12253 if p.CreatedBy == nil || other.CreatedBy == nil { 12254 return false 12255 } 12256 if (*p.CreatedBy) != (*other.CreatedBy) { 12257 return false 12258 } 12259 } 12260 if len(p.ColumnOrders) != len(other.ColumnOrders) { 12261 return false 12262 } 12263 for i, _tgt := range p.ColumnOrders { 12264 _src31 := other.ColumnOrders[i] 12265 if !_tgt.Equals(_src31) { 12266 return false 12267 } 12268 } 12269 if !p.EncryptionAlgorithm.Equals(other.EncryptionAlgorithm) { 12270 return false 12271 } 12272 if bytes.Compare(p.FooterSigningKeyMetadata, other.FooterSigningKeyMetadata) != 0 { 12273 return false 12274 } 12275 return true 12276 } 12277 12278 func (p *FileMetaData) String() string { 12279 if p == nil { 12280 return "<nil>" 12281 } 12282 return fmt.Sprintf("FileMetaData(%+v)", *p) 12283 } 12284 12285 // Crypto metadata for files with encrypted footer * 12286 // 12287 // Attributes: 12288 // - EncryptionAlgorithm: Encryption algorithm. This field is only used for files 12289 // with encrypted footer. Files with plaintext footer store algorithm id 12290 // inside footer (FileMetaData structure). 12291 // - KeyMetadata: Retrieval metadata of key used for encryption of footer, 12292 // and (possibly) columns * 12293 type FileCryptoMetaData struct { 12294 EncryptionAlgorithm *EncryptionAlgorithm `thrift:"encryption_algorithm,1,required" db:"encryption_algorithm" json:"encryption_algorithm"` 12295 KeyMetadata []byte `thrift:"key_metadata,2" db:"key_metadata" json:"key_metadata,omitempty"` 12296 } 12297 12298 func NewFileCryptoMetaData() *FileCryptoMetaData { 12299 return &FileCryptoMetaData{} 12300 } 12301 12302 var FileCryptoMetaData_EncryptionAlgorithm_DEFAULT *EncryptionAlgorithm 12303 12304 func (p *FileCryptoMetaData) GetEncryptionAlgorithm() *EncryptionAlgorithm { 12305 if !p.IsSetEncryptionAlgorithm() { 12306 return FileCryptoMetaData_EncryptionAlgorithm_DEFAULT 12307 } 12308 return p.EncryptionAlgorithm 12309 } 12310 12311 var FileCryptoMetaData_KeyMetadata_DEFAULT []byte 12312 12313 func (p *FileCryptoMetaData) GetKeyMetadata() []byte { 12314 return p.KeyMetadata 12315 } 12316 func (p *FileCryptoMetaData) IsSetEncryptionAlgorithm() bool { 12317 return p.EncryptionAlgorithm != nil 12318 } 12319 12320 func (p *FileCryptoMetaData) IsSetKeyMetadata() bool { 12321 return p.KeyMetadata != nil 12322 } 12323 12324 func (p *FileCryptoMetaData) Read(ctx context.Context, iprot thrift.TProtocol) error { 12325 if _, err := iprot.ReadStructBegin(ctx); err != nil { 12326 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) 12327 } 12328 12329 var issetEncryptionAlgorithm bool = false 12330 12331 for { 12332 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) 12333 if err != nil { 12334 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) 12335 } 12336 if fieldTypeId == thrift.STOP { 12337 break 12338 } 12339 switch fieldId { 12340 case 1: 12341 if fieldTypeId == thrift.STRUCT { 12342 if err := p.ReadField1(ctx, iprot); err != nil { 12343 return err 12344 } 12345 issetEncryptionAlgorithm = true 12346 } else { 12347 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 12348 return err 12349 } 12350 } 12351 case 2: 12352 if fieldTypeId == thrift.STRING { 12353 if err := p.ReadField2(ctx, iprot); err != nil { 12354 return err 12355 } 12356 } else { 12357 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 12358 return err 12359 } 12360 } 12361 default: 12362 if err := iprot.Skip(ctx, fieldTypeId); err != nil { 12363 return err 12364 } 12365 } 12366 if err := iprot.ReadFieldEnd(ctx); err != nil { 12367 return err 12368 } 12369 } 12370 if err := iprot.ReadStructEnd(ctx); err != nil { 12371 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 12372 } 12373 if !issetEncryptionAlgorithm { 12374 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field EncryptionAlgorithm is not set")) 12375 } 12376 return nil 12377 } 12378 12379 func (p *FileCryptoMetaData) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { 12380 p.EncryptionAlgorithm = &EncryptionAlgorithm{} 12381 if err := p.EncryptionAlgorithm.Read(ctx, iprot); err != nil { 12382 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.EncryptionAlgorithm), err) 12383 } 12384 return nil 12385 } 12386 12387 func (p *FileCryptoMetaData) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { 12388 if v, err := iprot.ReadBinary(ctx); err != nil { 12389 return thrift.PrependError("error reading field 2: ", err) 12390 } else { 12391 p.KeyMetadata = v 12392 } 12393 return nil 12394 } 12395 12396 func (p *FileCryptoMetaData) Write(ctx context.Context, oprot thrift.TProtocol) error { 12397 if err := oprot.WriteStructBegin(ctx, "FileCryptoMetaData"); err != nil { 12398 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 12399 } 12400 if p != nil { 12401 if err := p.writeField1(ctx, oprot); err != nil { 12402 return err 12403 } 12404 if err := p.writeField2(ctx, oprot); err != nil { 12405 return err 12406 } 12407 } 12408 if err := oprot.WriteFieldStop(ctx); err != nil { 12409 return thrift.PrependError("write field stop error: ", err) 12410 } 12411 if err := oprot.WriteStructEnd(ctx); err != nil { 12412 return thrift.PrependError("write struct stop error: ", err) 12413 } 12414 return nil 12415 } 12416 12417 func (p *FileCryptoMetaData) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { 12418 if err := oprot.WriteFieldBegin(ctx, "encryption_algorithm", thrift.STRUCT, 1); err != nil { 12419 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:encryption_algorithm: ", p), err) 12420 } 12421 if err := p.EncryptionAlgorithm.Write(ctx, oprot); err != nil { 12422 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.EncryptionAlgorithm), err) 12423 } 12424 if err := oprot.WriteFieldEnd(ctx); err != nil { 12425 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:encryption_algorithm: ", p), err) 12426 } 12427 return err 12428 } 12429 12430 func (p *FileCryptoMetaData) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { 12431 if p.IsSetKeyMetadata() { 12432 if err := oprot.WriteFieldBegin(ctx, "key_metadata", thrift.STRING, 2); err != nil { 12433 return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:key_metadata: ", p), err) 12434 } 12435 if err := oprot.WriteBinary(ctx, p.KeyMetadata); err != nil { 12436 return thrift.PrependError(fmt.Sprintf("%T.key_metadata (2) field write error: ", p), err) 12437 } 12438 if err := oprot.WriteFieldEnd(ctx); err != nil { 12439 return thrift.PrependError(fmt.Sprintf("%T write field end error 2:key_metadata: ", p), err) 12440 } 12441 } 12442 return err 12443 } 12444 12445 func (p *FileCryptoMetaData) Equals(other *FileCryptoMetaData) bool { 12446 if p == other { 12447 return true 12448 } else if p == nil || other == nil { 12449 return false 12450 } 12451 if !p.EncryptionAlgorithm.Equals(other.EncryptionAlgorithm) { 12452 return false 12453 } 12454 if bytes.Compare(p.KeyMetadata, other.KeyMetadata) != 0 { 12455 return false 12456 } 12457 return true 12458 } 12459 12460 func (p *FileCryptoMetaData) String() string { 12461 if p == nil { 12462 return "<nil>" 12463 } 12464 return fmt.Sprintf("FileCryptoMetaData(%+v)", *p) 12465 }