Files
traces/pkg/parquetquery/util.go
Joe ElliottandGitHub edb1f7fed3 Do less Nexting (#4753)
* this is garbage

Signed-off-by: Joe Elliott <[email protected]>

* filtery stuff

Signed-off-by: Joe Elliott <[email protected]>

* fix

Signed-off-by: Joe Elliott <[email protected]>

* max def everywhere

Signed-off-by: Joe Elliott <[email protected]>

* clean up benches

Signed-off-by: Joe Elliott <[email protected]>

* clean up

Signed-off-by: Joe Elliott <[email protected]>

* remove vendor chagnes

Signed-off-by: Joe Elliott <[email protected]>

* changelog

Signed-off-by: Joe Elliott <[email protected]>

* add details about bench env vars

Signed-off-by: Joe Elliott <[email protected]>

---------

Signed-off-by: Joe Elliott <[email protected]>
2025-02-28 08:08:18 -05:00

29 lines
526 B
Go

package parquetquery
import (
"strings"
pq "github.com/parquet-go/parquet-go"
)
func GetColumnIndexByPath(pf *pq.File, s string) (index, depth, maxDef int) {
colSelector := strings.Split(s, ".")
n := pf.Root()
for len(colSelector) > 0 {
n = n.Column(colSelector[0])
if n == nil {
return -1, -1, -1
}
colSelector = colSelector[1:]
depth++
}
return n.Index(), depth, n.MaxDefinitionLevel()
}
func HasColumn(pf *pq.File, s string) bool {
index, _, _ := GetColumnIndexByPath(pf, s)
return index >= 0
}