fix: not set nullable when stream writer write headers (#35799)

#35802

Signed-off-by: lixinguo <xinguo.li@zilliz.com>
Co-authored-by: lixinguo <xinguo.li@zilliz.com>
This commit is contained in:
smellthemoon 2024-08-29 20:59:00 +08:00 committed by GitHub
parent d10aa4626f
commit a3f2f044d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 33 additions and 4 deletions

View File

@ -29,7 +29,7 @@ PayloadReader::PayloadReader(const uint8_t* data,
int length,
DataType data_type,
bool nullable)
: column_type_(data_type), nullable(nullable) {
: column_type_(data_type), nullable_(nullable) {
auto input = std::make_shared<arrow::io::BufferReader>(data, length);
init(input);
}
@ -73,7 +73,8 @@ PayloadReader::init(std::shared_ptr<arrow::io::BufferReader> input) {
st = arrow_reader->GetRecordBatchReader(&rb_reader);
AssertInfo(st.ok(), "get record batch reader");
field_data_ = CreateFieldData(column_type_, nullable, dim_, total_num_rows);
field_data_ =
CreateFieldData(column_type_, nullable_, dim_, total_num_rows);
for (arrow::Result<std::shared_ptr<arrow::RecordBatch>> maybe_batch :
*rb_reader) {
AssertInfo(maybe_batch.ok(), "get batch record success");

View File

@ -29,7 +29,7 @@ class PayloadReader {
explicit PayloadReader(const uint8_t* data,
int length,
DataType data_type,
bool nullable);
bool nullable_);
~PayloadReader() = default;
@ -44,7 +44,7 @@ class PayloadReader {
private:
DataType column_type_;
int dim_;
bool nullable;
bool nullable_;
FieldDataPtr field_data_;
};

View File

@ -319,6 +319,7 @@ func (bsw *BinlogStreamWriter) writeBinlogHeaders(w io.Writer) error {
de.PayloadDataType = bsw.fieldSchema.DataType
de.FieldID = bsw.fieldSchema.FieldID
de.descriptorEventData.AddExtra(originalSizeKey, strconv.Itoa(bsw.memorySize))
de.descriptorEventData.AddExtra(nullableKey, bsw.fieldSchema.Nullable)
if err := de.Write(w); err != nil {
return err
}

View File

@ -20,6 +20,7 @@ import (
"context"
"fmt"
"testing"
"time"
"github.com/stretchr/testify/suite"
"go.uber.org/zap"
@ -175,6 +176,32 @@ func (s *NullDataSuite) run() {
s.WaitForIndexBuilt(ctx, collectionName, fVecColumn.FieldName)
desCollResp, err := c.Proxy.DescribeCollection(ctx, &milvuspb.DescribeCollectionRequest{
CollectionName: collectionName,
})
s.NoError(err)
s.Equal(desCollResp.GetStatus().GetErrorCode(), commonpb.ErrorCode_Success)
compactResp, err := c.Proxy.ManualCompaction(ctx, &milvuspb.ManualCompactionRequest{
CollectionID: desCollResp.GetCollectionID(),
})
s.NoError(err)
s.Equal(compactResp.GetStatus().GetErrorCode(), commonpb.ErrorCode_Success)
compacted := func() bool {
resp, err := c.Proxy.GetCompactionState(ctx, &milvuspb.GetCompactionStateRequest{
CompactionID: compactResp.GetCompactionID(),
})
if err != nil {
return false
}
return resp.GetState() == commonpb.CompactionState_Completed
}
for !compacted() {
time.Sleep(3 * time.Second)
}
// load
loadStatus, err := c.Proxy.LoadCollection(ctx, &milvuspb.LoadCollectionRequest{
DbName: dbName,