Skip to content

Commit

Permalink
Add missing pair_unique in output of dbms.graph.getGraphSchema() (T…
Browse files Browse the repository at this point in the history
  • Loading branch information
ljcui authored Oct 17, 2024
1 parent 65635dd commit 113dbc0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
5 changes: 4 additions & 1 deletion src/core/edge_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,10 @@ class EdgeIndex {
}

bool IsUnique() const {
return type_ == IndexType::GlobalUniqueIndex || type_ == IndexType::PairUniqueIndex;
return type_ == IndexType::GlobalUniqueIndex;
}
bool IsPairUnique() const {
return type_ == IndexType::PairUniqueIndex;
}
IndexType GetType() const { return type_; }

Expand Down
14 changes: 0 additions & 14 deletions src/core/schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,20 +281,6 @@ void Schema::DeleteCreatedEdgeIndex(KvTransaction& txn, const EdgeUid& euid, con
}
}

bool Schema::EdgeUniqueIndexConflict(KvTransaction& txn, const Value& record) {
for (auto& idx : indexed_fields_) {
auto& fe = fields_[idx];
EdgeIndex* index = fe.GetEdgeIndex();
FMA_ASSERT(index);
if (!index->IsUnique()) continue;
if (fe.GetIsNull(record)) continue;
if (index->UniqueIndexConflict(txn, fe.GetConstRef(record))) {
return true;
}
}
return false;
}

void Schema::AddEdgeToIndex(KvTransaction& txn, const EdgeUid& euid, const Value& record,
std::vector<size_t>& created) {
created.reserve(fields_.size());
Expand Down
1 change: 0 additions & 1 deletion src/core/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ class Schema {

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

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

Expand Down
1 change: 1 addition & 0 deletions src/cypher/procedure/procedure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2241,6 +2241,7 @@ void BuiltinProcedure::DbmsGraphGetGraphSchema(RTContext *ctx, const Record *rec
if (vi) {
property["index"] = true;
property["unique"] = vi->IsUnique();
property["pair_unique"] = vi->IsPairUnique();
}
edge["properties"].push_back(property);
}
Expand Down

0 comments on commit 113dbc0

Please sign in to comment.