From 154afa1bf04edab0d7b39682b7056eafe227bb04 Mon Sep 17 00:00:00 2001 From: lipanpan03 <41904587+lipanpan03@users.noreply.github.com> Date: Fri, 9 Aug 2024 10:17:37 +0800 Subject: [PATCH] Fix browser server (#621) * fix ha * fix list * fix list * fix browser submodule --- deps/tugraph-db-browser | 2 +- src/cypher/arithmetic/arithmetic_expression.cpp | 9 +++++++-- src/cypher/cypher_types.h | 2 +- src/cypher/procedure/procedure.cpp | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/deps/tugraph-db-browser b/deps/tugraph-db-browser index a6264fd812..dd393160ec 160000 --- a/deps/tugraph-db-browser +++ b/deps/tugraph-db-browser @@ -1 +1 @@ -Subproject commit a6264fd812f67cbeb831ce4219c6a22b04a23fdf +Subproject commit dd393160ec76eec3e4afbf86be2e0aa2684fe3a2 diff --git a/src/cypher/arithmetic/arithmetic_expression.cpp b/src/cypher/arithmetic/arithmetic_expression.cpp index 76c4bfa13b..bffef07e19 100644 --- a/src/cypher/arithmetic/arithmetic_expression.cpp +++ b/src/cypher/arithmetic/arithmetic_expression.cpp @@ -1353,8 +1353,13 @@ cypher::FieldData BuiltinFunction::_ToList(RTContext *ctx, const Record &record, auto ret = cypher::FieldData::Array(0); for (auto &arg : args) { auto r = arg.Evaluate(ctx, record); - CYPHER_THROW_ASSERT(r.IsScalar()); - ret.array->emplace_back(r.constant.scalar); + if (r.IsScalar()) { + ret.array->emplace_back(r.constant.scalar); + } else if (r.IsArray()) { + ret.array->emplace_back(*r.constant.array); + } else if (r.IsMap()) { + ret.array->emplace_back(*r.constant.map); + } } return ret; } diff --git a/src/cypher/cypher_types.h b/src/cypher/cypher_types.h index 636c771f60..88a96b073e 100644 --- a/src/cypher/cypher_types.h +++ b/src/cypher/cypher_types.h @@ -365,7 +365,7 @@ struct FieldData { bool IsArray() const { return type == ARRAY; } - static FieldData Array(size_t n) { return FieldData(std::vector<::lgraph::FieldData>(n)); } + static FieldData Array(size_t n) { return FieldData(std::vector(n)); } bool IsMap() const { return type == MAP; } diff --git a/src/cypher/procedure/procedure.cpp b/src/cypher/procedure/procedure.cpp index 7edbd53202..dd86249e72 100644 --- a/src/cypher/procedure/procedure.cpp +++ b/src/cypher/procedure/procedure.cpp @@ -531,7 +531,7 @@ void BuiltinProcedure::DbUpsertVertex(RTContext *ctx, const Record *record, std::vector field_ids; std::vector fds; bool success = true; - if (line.IsMap()) { + if (!line.IsMap()) { THROW_CODE(InputError, "The type of the elements in the list must be map"); } for (auto& item : *line.map) {