This commit is contained in:
chrislu 2024-04-18 22:41:20 -07:00
parent 57949f9959
commit 384ed7a381
2 changed files with 25 additions and 9 deletions

View File

@ -14,13 +14,4 @@ func TestSchemaBuilder(t *testing.T) {
recordType := rtb.Build() recordType := rtb.Build()
fmt.Printf("RecordType: %v\n", recordType) fmt.Printf("RecordType: %v\n", recordType)
recordType2 := NewRecordTypeBuilder().
AddLongField("ID").
AddLongField("CreatedAt").
AddRecordField("Person", NewRecordTypeBuilder().
AddStringField("Name").
AddListField("emails", TypeString)).Build()
fmt.Printf("RecordType2: %v\n", recordType2)
} }

View File

@ -0,0 +1,25 @@
package schema
import (
"fmt"
"testing"
)
func TestWriteParquet(t *testing.T) {
// create a schema_pb.RecordType
recordType := NewRecordTypeBuilder().
AddLongField("ID").
AddLongField("CreatedAt").
AddRecordField("Person", NewRecordTypeBuilder().
AddStringField("Name").
AddListField("emails", TypeString)).Build()
fmt.Printf("RecordType: %v\n", recordType)
// create a parquet schema
parquetSchema, err := ToParquetSchema("example", recordType)
if err != nil {
t.Fatalf("ToParquetSchema failed: %v", err)
}
fmt.Printf("ParquetSchema: %v\n", parquetSchema)
}