rename api

This commit is contained in:
chrislu 2024-04-28 12:40:00 -07:00
parent 5ce8f50546
commit 1a2332c257
3 changed files with 10 additions and 22 deletions

View File

@ -39,24 +39,12 @@ func (rtb *RecordTypeBuilder) SetField(name string, scalarType *schema_pb.Type)
return rtb
}
func (rtb *RecordTypeBuilder) SetBoolField(name string) *RecordTypeBuilder {
return rtb.SetField(name, TypeBoolean)
}
func (rtb *RecordTypeBuilder) SetIntegerField(name string) *RecordTypeBuilder {
return rtb.SetField(name, TypeInteger)
}
func (rtb *RecordTypeBuilder) SetLongField(name string) *RecordTypeBuilder {
return rtb.SetField(name, TypeLong)
}
func (rtb *RecordTypeBuilder) SetFloatField(name string) *RecordTypeBuilder {
return rtb.SetField(name, TypeFloat)
}
func (rtb *RecordTypeBuilder) SetDoubleField(name string) *RecordTypeBuilder {
return rtb.SetField(name, TypeDouble)
}
func (rtb *RecordTypeBuilder) SetBytesField(name string) *RecordTypeBuilder {
return rtb.SetField(name, TypeBytes)
}
func (rtb *RecordTypeBuilder) SetStringField(name string) *RecordTypeBuilder {
return rtb.SetField(name, TypeString)
}
@ -77,6 +65,6 @@ func (rtb *RecordTypeBuilder) SetListField(name string, elementType *schema_pb.T
return rtb
}
func List(elementType *schema_pb.Type) *schema_pb.Type {
func ListOf(elementType *schema_pb.Type) *schema_pb.Type {
return &schema_pb.Type{Kind: &schema_pb.Type_ListType{ListType: &schema_pb.ListType{ElementType: elementType}}}
}

View File

@ -44,7 +44,7 @@ func TestStructToSchema(t *testing.T) {
}{},
},
want: NewRecordTypeBuilder().
SetField("Field1", List(TypeInteger)).
SetField("Field1", ListOf(TypeInteger)).
SetField("Field2", TypeString).
Build(),
},
@ -97,7 +97,7 @@ func TestStructToSchema(t *testing.T) {
SetField("Field1", TypeInteger).
SetRecordField("Field2", NewRecordTypeBuilder().
SetField("Field3", TypeString).
SetField("Field4", List(TypeInteger)).
SetField("Field4", ListOf(TypeInteger)).
SetRecordField("Field5", NewRecordTypeBuilder().
SetField("Field6", TypeString).
SetField("Field7", TypeBytes),

View File

@ -19,15 +19,15 @@ func TestToParquetLevels(t *testing.T) {
name: "nested type",
args: args{
NewRecordTypeBuilder().
SetLongField("ID").
SetLongField("CreatedAt").
SetField("ID", TypeLong).
SetField("CreatedAt", TypeLong).
SetRecordField("Person", NewRecordTypeBuilder().
SetStringField("zName").
SetListField("emails", TypeString)).
SetStringField("Company").
SetField("zName", TypeString).
SetField("emails", ListOf(TypeString))).
SetField("Company", TypeString).
SetRecordField("Address", NewRecordTypeBuilder().
SetStringField("Street").
SetStringField("City")).Build(),
SetField("Street", TypeString).
SetField("City", TypeString)).Build(),
},
want: &ParquetLevels{
startColumnIndex: 0,