From 384ed7a381d132d8b85d82d24bb513962e1fae95 Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 18 Apr 2024 22:41:20 -0700 Subject: [PATCH] add test --- weed/mq/schema/schema_builder_test.go | 9 --------- weed/mq/schema/write_parquet_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 weed/mq/schema/write_parquet_test.go diff --git a/weed/mq/schema/schema_builder_test.go b/weed/mq/schema/schema_builder_test.go index 71a884286..31a88bca9 100644 --- a/weed/mq/schema/schema_builder_test.go +++ b/weed/mq/schema/schema_builder_test.go @@ -14,13 +14,4 @@ func TestSchemaBuilder(t *testing.T) { recordType := rtb.Build() 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) - } diff --git a/weed/mq/schema/write_parquet_test.go b/weed/mq/schema/write_parquet_test.go new file mode 100644 index 000000000..7920bf3a1 --- /dev/null +++ b/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) + +}