()
| 93 | } |
| 94 | |
| 95 | func (cmd *attrIndexCmd) collectAttributeStats() (*fileStats, error) { |
| 96 | stats := fileStats{ |
| 97 | Attributes: make(map[string]attributeInfo, 200), |
| 98 | } |
| 99 | |
| 100 | in, pf, err := openParquetFile(cmd.In) |
| 101 | if err != nil { |
| 102 | return nil, err |
| 103 | } |
| 104 | defer in.Close() |
| 105 | |
| 106 | reader := parquet.NewGenericReader[vp4.Trace](pf) |
| 107 | defer reader.Close() |
| 108 | |
| 109 | var ( |
| 110 | traceBuffer = make([]vp4.Trace, 1024) |
| 111 | readCount int |
| 112 | ) |
| 113 | |
| 114 | for { |
| 115 | readCount, err = reader.Read(traceBuffer) |
| 116 | if err != nil { |
| 117 | if !errors.Is(err, io.EOF) { |
| 118 | return nil, err |
| 119 | } |
| 120 | break |
| 121 | } |
| 122 | |
| 123 | if readCount > 0 { |
| 124 | cmd.collectAttributeStatsForTraces(&stats, traceBuffer[:readCount]) |
| 125 | } |
| 126 | } |
| 127 | if readCount > 0 { |
| 128 | cmd.collectAttributeStatsForTraces(&stats, traceBuffer[:readCount]) |
| 129 | } |
| 130 | |
| 131 | return &stats, nil |
| 132 | } |
| 133 | |
| 134 | func (cmd *attrIndexCmd) collectAttributeStatsForTraces(stats *fileStats, traces []vp4.Trace) { |
| 135 | row := pq.EmptyRowNumber() |
no test coverage detected