Fix Int8~Int32 empty result set type (#23852)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/23902/head^2
congqixia 2023-05-06 14:16:39 +08:00 committed by GitHub
parent 7f5294b1ef
commit 2cacda0d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -20,6 +20,19 @@ func genEmptyBoolFieldData(field *schemapb.FieldSchema) *schemapb.FieldData {
}
func genEmptyIntFieldData(field *schemapb.FieldSchema) *schemapb.FieldData {
return &schemapb.FieldData{
Type: field.GetDataType(),
FieldName: field.GetName(),
Field: &schemapb.FieldData_Scalars{
Scalars: &schemapb.ScalarField{
Data: &schemapb.ScalarField_IntData{IntData: &schemapb.IntArray{Data: nil}},
},
},
FieldId: field.GetFieldID(),
}
}
func genEmptyLongFieldData(field *schemapb.FieldSchema) *schemapb.FieldData {
return &schemapb.FieldData{
Type: field.GetDataType(),
FieldName: field.GetName(),
@ -142,8 +155,10 @@ func GenEmptyFieldData(field *schemapb.FieldSchema) (*schemapb.FieldData, error)
switch dataType {
case schemapb.DataType_Bool:
return genEmptyBoolFieldData(field), nil
case schemapb.DataType_Int8, schemapb.DataType_Int16, schemapb.DataType_Int32, schemapb.DataType_Int64:
case schemapb.DataType_Int8, schemapb.DataType_Int16, schemapb.DataType_Int32:
return genEmptyIntFieldData(field), nil
case schemapb.DataType_Int64:
return genEmptyLongFieldData(field), nil
case schemapb.DataType_Float:
return genEmptyFloatFieldData(field), nil
case schemapb.DataType_Double: