mirror of https://github.com/milvus-io/milvus.git
Enable print_log support json data type (#26118)
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>pull/26130/head
parent
6f89620a43
commit
2c6c7749e2
|
@ -321,6 +321,19 @@ func printPayloadValues(colType schemapb.DataType, reader PayloadReaderInterface
|
|||
}
|
||||
fmt.Println()
|
||||
}
|
||||
case schemapb.DataType_JSON:
|
||||
|
||||
rows, err := reader.GetPayloadLengthFromReader()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
val, err := reader.GetJSONFromPayload()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for i := 0; i < rows; i++ {
|
||||
fmt.Printf("\t\t%d : %s\n", i, val[i])
|
||||
}
|
||||
default:
|
||||
return errors.New("undefined data type")
|
||||
}
|
||||
|
|
|
@ -179,6 +179,13 @@ func TestPrintBinlogFiles(t *testing.T) {
|
|||
Description: "description_11",
|
||||
DataType: schemapb.DataType_FloatVector,
|
||||
},
|
||||
{
|
||||
FieldID: 110,
|
||||
Name: "field_json",
|
||||
IsPrimaryKey: false,
|
||||
Description: "description_12",
|
||||
DataType: schemapb.DataType_JSON,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -223,6 +230,12 @@ func TestPrintBinlogFiles(t *testing.T) {
|
|||
Data: []float32{0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7},
|
||||
Dim: 8,
|
||||
},
|
||||
110: &JSONFieldData{
|
||||
Data: [][]byte{
|
||||
[]byte(`{}`),
|
||||
[]byte(`{"key":"hello"}`),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -266,6 +279,12 @@ func TestPrintBinlogFiles(t *testing.T) {
|
|||
Data: []float32{0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7},
|
||||
Dim: 8,
|
||||
},
|
||||
110: &JSONFieldData{
|
||||
Data: [][]byte{
|
||||
[]byte(`{}`),
|
||||
[]byte(`{"key":"world"}`),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
firstBlobs, err := insertCodec.Serialize(1, 1, insertDataFirst)
|
||||
|
|
Loading…
Reference in New Issue