(pf *parquet.File, definitionLevel int, keyPath string, valuePath string, intPath string, isArrayPath string)
| 666 | } |
| 667 | |
| 668 | func aggregateGenericAttributes(pf *parquet.File, definitionLevel int, keyPath string, valuePath string, intPath string, isArrayPath string) (attributeSummary, error) { |
| 669 | makeIter := makeIterFunc(context.Background(), pf) |
| 670 | |
| 671 | required := []parquetquery.Iterator{ |
| 672 | makeIter(keyPath, parquetquery.NewSkipNilsPredicate(), "key"), |
| 673 | } |
| 674 | optional := []parquetquery.Iterator{ |
| 675 | makeIter(valuePath, parquetquery.NewSkipNilsPredicate(), "value"), |
| 676 | makeIter(intPath, parquetquery.NewSkipNilsPredicate(), "int"), |
| 677 | } |
| 678 | if isArrayPath != "" { |
| 679 | optional = append(optional, makeIter(isArrayPath, parquetquery.NewSkipNilsPredicate(), "isArray")) |
| 680 | } |
| 681 | |
| 682 | attrIter, err := parquetquery.NewLeftJoinIterator(definitionLevel, required, optional, &attrStatsCollector{}) |
| 683 | if err != nil { |
| 684 | return attributeSummary{}, err |
| 685 | } |
| 686 | defer attrIter.Close() |
| 687 | |
| 688 | var ( |
| 689 | attributes = make(map[string]*stringAttributeSummary, 1000) |
| 690 | stringArrayAttributes = make(map[string]*stringAttributeSummary, 1000) |
| 691 | integerAttributes = make(map[string]*integerAttributeSummary, 1000) |
| 692 | integerArrayAttributes = make(map[string]*integerAttributeSummary, 1000) |
| 693 | ) |
| 694 | |
| 695 | getString := func(name string, from map[string]*stringAttributeSummary) *stringAttributeSummary { |
| 696 | v, ok := from[name] |
| 697 | if !ok { |
| 698 | v = &stringAttributeSummary{ |
| 699 | name: name, |
| 700 | cardinality: make(cardinality), |
| 701 | } |
| 702 | from[name] = v |
| 703 | } |
| 704 | return v |
| 705 | } |
| 706 | |
| 707 | getInt := func(name string, from map[string]*integerAttributeSummary) *integerAttributeSummary { |
| 708 | v, ok := from[name] |
| 709 | if !ok { |
| 710 | v = &integerAttributeSummary{ |
| 711 | name: name, |
| 712 | } |
| 713 | from[name] = v |
| 714 | } |
| 715 | return v |
| 716 | } |
| 717 | |
| 718 | for res, err := attrIter.Next(); res != nil; res, err = attrIter.Next() { |
| 719 | if err != nil { |
| 720 | return attributeSummary{}, err |
| 721 | } |
| 722 | |
| 723 | for _, e := range res.OtherEntries { |
| 724 | stats, ok := e.Value.(*attrStats) |
| 725 | if !ok { |
no test coverage detected