From 1747642a6e4b6117daa26d6d8e06f7abd06deb08 Mon Sep 17 00:00:00 2001 From: yangjundong <1047934838@qq.com> Date: Sat, 16 Nov 2024 03:03:11 +0000 Subject: [PATCH] [fix][store] Fixup document datetime type error --- src/client_v2/document_index.cc | 2 +- src/document/document_index.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client_v2/document_index.cc b/src/client_v2/document_index.cc index f37e67245..635c4f8c4 100644 --- a/src/client_v2/document_index.cc +++ b/src/client_v2/document_index.cc @@ -125,7 +125,7 @@ void SendDocumentAdd(DocumentAddOptions const& opt) { document_value1.set_field_type(dingodb::pb::common::ScalarFieldType::DATETIME); auto now = std::chrono::system_clock::now(); std::string time_str = ToRFC3339(now); - document_value1.mutable_field_value()->set_string_data(time_str); + document_value1.mutable_field_value()->set_datetime_data(time_str); std::cout << "doc_id: " << opt.document_id << " ,time_str:" << time_str << std::endl; (*document_data)["col5"] = document_value1; } diff --git a/src/document/document_index.cc b/src/document/document_index.cc index ef972e969..d4e902851 100644 --- a/src/document/document_index.cc +++ b/src/document/document_index.cc @@ -265,7 +265,7 @@ butil::Status DocumentIndex::Add(const std::vector& break; case pb::common::ScalarFieldType::DATETIME: date_column_names.push_back(field_name); - date_column_docs.push_back(document_value.field_value().string_data()); + date_column_docs.push_back(document_value.field_value().datetime_data()); break; case pb::common::ScalarFieldType::BOOL: bool_column_names.push_back(field_name);