Skip to content

Commit

Permalink
Merge branch 'master' into fix-3029-0
Browse files Browse the repository at this point in the history
  • Loading branch information
darionyaphet authored Oct 14, 2021
2 parents bacb3b8 + e1de5af commit 3eb2e34
Show file tree
Hide file tree
Showing 18 changed files with 795 additions and 297 deletions.
14 changes: 14 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.

# For more configuration details:
# https://docs.codecov.io/docs/codecov-yaml

# validate the configuration:
# curl -X POST --data-binary @codecov.yml https://codecov.io/validate

codecov:
allow_pseudo_compare: True
allow_coverage_offsets: True
4 changes: 4 additions & 0 deletions conf/nebula-graphd.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@
########## memory ##########
# System memory high watermark ratio
--system_memory_high_watermark_ratio=0.8

########## experimental feature ##########
# if use experimental features
--enable_experimental_feature=false
4 changes: 4 additions & 0 deletions conf/nebula-graphd.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@
########## memory ##########
# System memory high watermark ratio
--system_memory_high_watermark_ratio=0.8

########## experimental feature ##########
# if use experimental features
--enable_experimental_feature=false
11 changes: 11 additions & 0 deletions src/common/datatypes/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,14 @@ folly::dynamic Map::getMetaData() const {
}

} // namespace nebula

namespace std {
std::size_t hash<nebula::Map>::operator()(const nebula::Map& m) const noexcept {
size_t seed = 0;
for (auto& v : m.kvs) {
seed ^= hash<std::string>()(v.first) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
return seed;
}

} // namespace std
8 changes: 8 additions & 0 deletions src/common/datatypes/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,12 @@ struct Map {
inline std::ostream& operator<<(std::ostream& os, const Map& m) { return os << m.toString(); }

} // namespace nebula

namespace std {
template <>
struct hash<nebula::Map> {
std::size_t operator()(const nebula::Map& m) const noexcept;
};

} // namespace std
#endif // COMMON_DATATYPES_MAP_H_
11 changes: 11 additions & 0 deletions src/common/datatypes/Set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,14 @@ folly::dynamic Set::getMetaData() const {
}

} // namespace nebula

namespace std {
std::size_t hash<nebula::Set>::operator()(const nebula::Set& s) const noexcept {
size_t seed = 0;
for (auto& v : s.values) {
seed ^= hash<nebula::Value>()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
return seed;
}

} // namespace std
9 changes: 8 additions & 1 deletion src/common/datatypes/Set.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ struct Set {
};

inline std::ostream& operator<<(std::ostream& os, const Set& s) { return os << s.toString(); }

} // namespace nebula

namespace std {
template <>
struct hash<nebula::Set> {
std::size_t operator()(const nebula::Set& s) const noexcept;
};

} // namespace std
#endif // COMMON_DATATYPES_SET_H_
4 changes: 2 additions & 2 deletions src/common/datatypes/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ std::size_t hash<nebula::Value>::operator()(const nebula::Value& v) const noexce
return hash<nebula::Geography>()(v.getGeography());
}
case nebula::Value::Type::MAP: {
LOG(FATAL) << "Hash for MAP has not been implemented";
return hash<nebula::Map>()(v.getMap());
}
case nebula::Value::Type::SET: {
LOG(FATAL) << "Hash for SET has not been implemented";
return hash<nebula::Set>()(v.getSet());
}
case nebula::Value::Type::DATASET: {
LOG(FATAL) << "Hash for DATASET has not been implemented";
Expand Down
Loading

0 comments on commit 3eb2e34

Please sign in to comment.