You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hugegraph.apache.org by GitBox <gi...@apache.org> on 2022/11/02 14:21:55 UTC
[GitHub] [incubator-hugegraph] imbajin commented on a diff in pull request #2000: refactor(core): improve backend code by flow idea suggests
imbajin commented on code in PR #2000:
URL: https://github.com/apache/incubator-hugegraph/pull/2000#discussion_r1011832610
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/BackendException.java:
##########
@@ -45,8 +45,8 @@ public BackendException(Throwable cause) {
this("Exception in backend", cause);
}
- public static final void check(boolean expression,
- String message, Object... args)
+ public static void check(boolean expression,
+ String message, Object... args)
Review Comment:
could merge to one line for reading ( < 100 chars)
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/id/IdUtil.java:
##########
@@ -74,9 +74,7 @@ public static Id readBinString(Object id) {
public static String writeString(Id id) {
String idString = id.asString();
- StringBuilder sb = new StringBuilder(1 + idString.length());
- sb.append(id.type().prefix()).append(idString);
- return sb.toString();
+ return id.type().prefix() + idString;
Review Comment:
should warn if it influence the performance. some suggestions are not perf friendly
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java:
##########
@@ -699,9 +693,9 @@ private static String escapeSpecialValueIfNeeded(String value) {
if (value.isEmpty()) {
// Escape empty String to INDEX_SYM_EMPTY (char `\u0002`)
value = INDEX_SYM_EMPTY;
- } else if (value == INDEX_VALUE_EMPTY) {
+ } else if (INDEX_VALUE_EMPTY.equals(value)) {
value = "";
- } else if (value == INDEX_VALUE_NULL) {
+ } else if (INDEX_VALUE_NULL.equals(value)) {
Review Comment:
these lines don't want to compare string chars, see the comment with the variable
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org