From 60103171b620aac3b107b3ce256ccceaf27c973e Mon Sep 17 00:00:00 2001 From: chrislu Date: Sat, 27 Apr 2024 23:30:15 -0700 Subject: [PATCH] rename --- weed/mq/schema/value_builder.go | 32 ++++++++++++++-------------- weed/mq/schema/write_parquet_test.go | 12 +++++------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/weed/mq/schema/value_builder.go b/weed/mq/schema/value_builder.go index 600252833..0edb0684c 100644 --- a/weed/mq/schema/value_builder.go +++ b/weed/mq/schema/value_builder.go @@ -17,35 +17,35 @@ func (rvb *RecordValueBuilder) Build() *schema_pb.RecordValue { return rvb.recordValue } -func (rvb *RecordValueBuilder) AddBoolValue(key string, value bool) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetBoolValue(key string, value bool) *RecordValueBuilder { rvb.recordValue.Fields[key] = &schema_pb.Value{Kind: &schema_pb.Value_BoolValue{BoolValue: value}} return rvb } -func (rvb *RecordValueBuilder) AddIntValue(key string, value int32) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetIntValue(key string, value int32) *RecordValueBuilder { rvb.recordValue.Fields[key] = &schema_pb.Value{Kind: &schema_pb.Value_Int32Value{Int32Value: value}} return rvb } -func (rvb *RecordValueBuilder) AddLongValue(key string, value int64) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetLongValue(key string, value int64) *RecordValueBuilder { rvb.recordValue.Fields[key] = &schema_pb.Value{Kind: &schema_pb.Value_Int64Value{Int64Value: value}} return rvb } -func (rvb *RecordValueBuilder) AddFloatValue(key string, value float32) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetFloatValue(key string, value float32) *RecordValueBuilder { rvb.recordValue.Fields[key] = &schema_pb.Value{Kind: &schema_pb.Value_FloatValue{FloatValue: value}} return rvb } -func (rvb *RecordValueBuilder) AddDoubleValue(key string, value float64) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetDoubleValue(key string, value float64) *RecordValueBuilder { rvb.recordValue.Fields[key] = &schema_pb.Value{Kind: &schema_pb.Value_DoubleValue{DoubleValue: value}} return rvb } -func (rvb *RecordValueBuilder) AddBytesValue(key string, value []byte) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetBytesValue(key string, value []byte) *RecordValueBuilder { rvb.recordValue.Fields[key] = &schema_pb.Value{Kind: &schema_pb.Value_BytesValue{BytesValue: value}} return rvb } -func (rvb *RecordValueBuilder) AddStringValue(key string, value string) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetStringValue(key string, value string) *RecordValueBuilder { rvb.recordValue.Fields[key] = &schema_pb.Value{Kind: &schema_pb.Value_StringValue{StringValue: value}} return rvb } -func (rvb *RecordValueBuilder) AddRecordValue(key string, value *RecordValueBuilder) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetRecordValue(key string, value *RecordValueBuilder) *RecordValueBuilder { rvb.recordValue.Fields[key] = &schema_pb.Value{Kind: &schema_pb.Value_RecordValue{RecordValue: value.Build()}} return rvb } @@ -55,56 +55,56 @@ func (rvb *RecordValueBuilder) addListValue(key string, values []*schema_pb.Valu return rvb } -func (rvb *RecordValueBuilder) AddBoolListValue(key string, values ...bool) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetBoolListValue(key string, values ...bool) *RecordValueBuilder { var listValues []*schema_pb.Value for _, v := range values { listValues = append(listValues, &schema_pb.Value{Kind: &schema_pb.Value_BoolValue{BoolValue: v}}) } return rvb.addListValue(key, listValues) } -func (rvb *RecordValueBuilder) AddIntListValue(key string, values ...int32) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetIntListValue(key string, values ...int32) *RecordValueBuilder { var listValues []*schema_pb.Value for _, v := range values { listValues = append(listValues, &schema_pb.Value{Kind: &schema_pb.Value_Int32Value{Int32Value: v}}) } return rvb.addListValue(key, listValues) } -func (rvb *RecordValueBuilder) AddLongListValue(key string, values ...int64) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetLongListValue(key string, values ...int64) *RecordValueBuilder { var listValues []*schema_pb.Value for _, v := range values { listValues = append(listValues, &schema_pb.Value{Kind: &schema_pb.Value_Int64Value{Int64Value: v}}) } return rvb.addListValue(key, listValues) } -func (rvb *RecordValueBuilder) AddFloatListValue(key string, values ...float32) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetFloatListValue(key string, values ...float32) *RecordValueBuilder { var listValues []*schema_pb.Value for _, v := range values { listValues = append(listValues, &schema_pb.Value{Kind: &schema_pb.Value_FloatValue{FloatValue: v}}) } return rvb.addListValue(key, listValues) } -func (rvb *RecordValueBuilder) AddDoubleListValue(key string, values ...float64) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetDoubleListValue(key string, values ...float64) *RecordValueBuilder { var listValues []*schema_pb.Value for _, v := range values { listValues = append(listValues, &schema_pb.Value{Kind: &schema_pb.Value_DoubleValue{DoubleValue: v}}) } return rvb.addListValue(key, listValues) } -func (rvb *RecordValueBuilder) AddBytesListValue(key string, values ...[]byte) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetBytesListValue(key string, values ...[]byte) *RecordValueBuilder { var listValues []*schema_pb.Value for _, v := range values { listValues = append(listValues, &schema_pb.Value{Kind: &schema_pb.Value_BytesValue{BytesValue: v}}) } return rvb.addListValue(key, listValues) } -func (rvb *RecordValueBuilder) AddStringListValue(key string, values ...string) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetStringListValue(key string, values ...string) *RecordValueBuilder { var listValues []*schema_pb.Value for _, v := range values { listValues = append(listValues, &schema_pb.Value{Kind: &schema_pb.Value_StringValue{StringValue: v}}) } return rvb.addListValue(key, listValues) } -func (rvb *RecordValueBuilder) AddRecordListValue(key string, values ...*RecordValueBuilder) *RecordValueBuilder { +func (rvb *RecordValueBuilder) SetRecordListValue(key string, values ...*RecordValueBuilder) *RecordValueBuilder { var listValues []*schema_pb.Value for _, v := range values { listValues = append(listValues, &schema_pb.Value{Kind: &schema_pb.Value_RecordValue{RecordValue: v.Build()}}) diff --git a/weed/mq/schema/write_parquet_test.go b/weed/mq/schema/write_parquet_test.go index ac2d6b154..a744b7828 100644 --- a/weed/mq/schema/write_parquet_test.go +++ b/weed/mq/schema/write_parquet_test.go @@ -69,17 +69,17 @@ func testWritingParquetFile(t *testing.T, count int, filename string, parquetSch rowBuilder.Reset() // generate random data recordValue := NewRecordValueBuilder(). - AddLongValue("ID", 1+int64(i)). - AddLongValue("CreatedAt", 2+2*int64(i)). - AddRecordValue("Person", NewRecordValueBuilder(). - AddStringValue("zName", fmt.Sprintf("john_%d", i)). - AddStringListValue("emails", + SetLongValue("ID", 1+int64(i)). + SetLongValue("CreatedAt", 2+2*int64(i)). + SetRecordValue("Person", NewRecordValueBuilder(). + SetStringValue("zName", fmt.Sprintf("john_%d", i)). + SetStringListValue("emails", fmt.Sprintf("john_%d@a.com", i), fmt.Sprintf("john_%d@b.com", i), fmt.Sprintf("john_%d@c.com", i), fmt.Sprintf("john_%d@d.com", i), fmt.Sprintf("john_%d@e.com", i))). - AddStringValue("Company", fmt.Sprintf("company_%d", i)).Build() + SetStringValue("Company", fmt.Sprintf("company_%d", i)).Build() AddRecordValue(rowBuilder, recordType, parquetLevels, recordValue) if count < 10 {