github.com/vc42/parquet-go@v0.0.0-20240320194221-1a9adb5f23f5/column_mapping_test.go (about) 1 package parquet_test 2 3 import ( 4 "fmt" 5 "strings" 6 7 "github.com/vc42/parquet-go" 8 ) 9 10 func ExampleSchema_Lookup() { 11 schema := parquet.SchemaOf(struct { 12 FirstName string `parquet:"first_name"` 13 LastName string `parquet:"last_name"` 14 Attributes []struct { 15 Name string `parquet:"name"` 16 Value string `parquet:"value"` 17 } `parquet:"attributes"` 18 }{}) 19 20 for _, path := range schema.Columns() { 21 leaf, _ := schema.Lookup(path...) 22 fmt.Printf("%d => %q\n", leaf.ColumnIndex, strings.Join(path, ".")) 23 } 24 25 // Output: 26 // 0 => "first_name" 27 // 1 => "last_name" 28 // 2 => "attributes.name" 29 // 3 => "attributes.value" 30 }