mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* 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]>
29 lines
526 B
Go
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
|
|
}
|