Skip to content

Commit 39f94aa

Browse files
committed
Add missing pair_unique in output of dbms.graph.getGraphSchema()
1 parent 65635dd commit 39f94aa

File tree

4 files changed

+5
-16
lines changed

4 files changed

+5
-16
lines changed

src/core/edge_index.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,10 @@ class EdgeIndex {
475475
}
476476

477477
bool IsUnique() const {
478-
return type_ == IndexType::GlobalUniqueIndex || type_ == IndexType::PairUniqueIndex;
478+
return type_ == IndexType::GlobalUniqueIndex;
479+
}
480+
bool IsPairUnique() const {
481+
return type_ == IndexType::PairUniqueIndex;
479482
}
480483
IndexType GetType() const { return type_; }
481484

src/core/schema.cpp

-14
Original file line numberDiff line numberDiff line change
@@ -281,20 +281,6 @@ void Schema::DeleteCreatedEdgeIndex(KvTransaction& txn, const EdgeUid& euid, con
281281
}
282282
}
283283

284-
bool Schema::EdgeUniqueIndexConflict(KvTransaction& txn, const Value& record) {
285-
for (auto& idx : indexed_fields_) {
286-
auto& fe = fields_[idx];
287-
EdgeIndex* index = fe.GetEdgeIndex();
288-
FMA_ASSERT(index);
289-
if (!index->IsUnique()) continue;
290-
if (fe.GetIsNull(record)) continue;
291-
if (index->UniqueIndexConflict(txn, fe.GetConstRef(record))) {
292-
return true;
293-
}
294-
}
295-
return false;
296-
}
297-
298284
void Schema::AddEdgeToIndex(KvTransaction& txn, const EdgeUid& euid, const Value& record,
299285
std::vector<size_t>& created) {
300286
created.reserve(fields_.size());

src/core/schema.h

-1
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ class Schema {
499499

500500
void AddEdgeToIndex(KvTransaction& txn, const EdgeUid& euid, const Value& record,
501501
std::vector<size_t>& created);
502-
bool EdgeUniqueIndexConflict(KvTransaction& txn, const Value& record);
503502

504503
void AddVectorToVectorIndex(KvTransaction& txn, VertexId vid, const Value& record);
505504

src/cypher/procedure/procedure.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2241,6 +2241,7 @@ void BuiltinProcedure::DbmsGraphGetGraphSchema(RTContext *ctx, const Record *rec
22412241
if (vi) {
22422242
property["index"] = true;
22432243
property["unique"] = vi->IsUnique();
2244+
property["pair_unique"] = vi->IsPairUnique();
22442245
}
22452246
edge["properties"].push_back(property);
22462247
}

0 commit comments

Comments
 (0)