Browse Source

add test

mq-subscribe
chrislu 8 months ago
parent
commit
384ed7a381
  1. 9
      weed/mq/schema/schema_builder_test.go
  2. 25
      weed/mq/schema/write_parquet_test.go

9
weed/mq/schema/schema_builder_test.go

@ -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)
} }

25
weed/mq/schema/write_parquet_test.go

@ -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)
}
Loading…
Cancel
Save