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/04/26 12:09:34 UTC

[GitHub] [incubator-hugegraph] seagle-yuan opened a new pull request, #1852: fix core-issue checkstyle issue

seagle-yuan opened a new pull request, #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852

   fix checkstyle issue for package com.baidu.hugegraph.backend 


-- 
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


[GitHub] [incubator-hugegraph] imbajin commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
imbajin commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r870156401


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java:
##########
@@ -831,7 +831,7 @@ public boolean checkRangeIndex(HugeElement element, Condition cond) {
         }
 
         private static boolean removeFieldValue(Set<Object> values,
-                                                Object value){
+                                                Object value) {

Review Comment:
   fine, we don't need to change the align of old code.
   
   remember to rerun the failed ci 



-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] imbajin commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
imbajin commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r869967741


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java:
##########
@@ -831,7 +831,7 @@ public boolean checkRangeIndex(HugeElement element, Condition cond) {
         }
 
         private static boolean removeFieldValue(Set<Object> values,
-                                                Object value){
+                                                Object value) {

Review Comment:
   maybe we could merge them into one line



##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinarySerializer.java:
##########
@@ -871,9 +870,9 @@ public BackendEntry parse(BackendEntry originEntry) {
         BytesBuffer buffer = BytesBuffer.allocate(BytesBuffer.BUF_EDGE_ID);
         buffer.write(parsedEntry.id().asBytes());
         buffer.write(bytes);
-        parsedEntry = new BinaryBackendEntry(originEntry.type(),
-                                             new BinaryId(buffer.bytes(),
-                                                          BytesBuffer.wrap(buffer.bytes()).readEdgeId()));
+        parsedEntry = new BinaryBackendEntry(originEntry.type(), new BinaryId(buffer.bytes(),
+                                                BytesBuffer.wrap(buffer.bytes()).readEdgeId()));

Review Comment:
   should `BytesBuffer`  aline with originEntry?



-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r859641416


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java:
##########
@@ -71,63 +71,64 @@ public boolean equals(Object obj) {
         }
     }
 
-    public HugeType type();
+    HugeType type();
 
     @Override
-    public Id id();
+    Id id();
 
-    public Id originId();
+    Id originId();
 
-    public Id subId();
+    Id subId();
 
-    public long ttl();
+    long ttl();
 
-    public int columnsSize();
-    public Collection<BackendColumn> columns();
+    int columnsSize();
 
-    public void columns(Collection<BackendColumn> columns);
-    public void columns(BackendColumn column);
+    Collection<BackendColumn> columns();
 
-    public void merge(BackendEntry other);
-    public boolean mergeable(BackendEntry other);
+    void columns(Collection<BackendColumn> columns);
 
-    public void clear();
+    void columns(BackendColumn column);
 
-    public default boolean belongToMe(BackendColumn column) {
+    void merge(BackendEntry other);
+
+    boolean mergeable(BackendEntry other);
+
+    void clear();
+
+    default boolean belongToMe(BackendColumn column) {
         return Bytes.prefixWith(column.name, id().asBytes());
     }
 
-    public default boolean olap() {
+    default boolean olap() {
         return false;
     }
 
-    public interface BackendIterator<T> extends Iterator<T>, AutoCloseable {
+    interface BackendIterator<T> extends Iterator<T>, AutoCloseable {
 
         @Override
-        public void close();
+        void close();
 
-        public byte[] position();
+        byte[] position();
     }
 
-    public interface BackendColumnIterator
-           extends BackendIterator<BackendColumn> {
+    interface BackendColumnIterator extends BackendIterator<BackendColumn> {
 
-        public static BackendColumnIterator empty() {
+        static BackendColumnIterator empty() {
             return EMPTY;
         }
 
-        public static BackendColumnIterator iterator(BackendColumn element) {
+        static BackendColumnIterator iterator(BackendColumn element) {
             return new OneColumnIterator(element);
         }
 
-        public static BackendColumnIterator wrap(Iterator<BackendColumn> iter) {
+        static BackendColumnIterator wrap(Iterator<BackendColumn> iter) {
             return new BackendColumnIteratorWrapper(iter);
         }
 
-        public static final BackendColumnIterator EMPTY = new EmptyIterator();
+        BackendColumnIterator EMPTY = new EmptyIterator();

Review Comment:
   ok



-- 
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


[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1852: fix core-issue checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r858663207


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/RaftBackendStore.java:
##########
@@ -189,10 +189,9 @@ public void increaseCounter(HugeType type, long increment) {
 
     @Override
     public long getCounter(HugeType type) {
-         Object counter = this.queryByRaft(type, true,
-                                           o -> this.store.getCounter(type));
-         assert counter instanceof Long;
-         return (Long) counter;
+        Object counter = this.queryByRaft(type, true,o -> this.store.getCounter(type));

Review Comment:
   expect a space after "true,"



-- 
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


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-issue checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r858716618


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/raft/RaftBackendStore.java:
##########
@@ -189,10 +189,9 @@ public void increaseCounter(HugeType type, long increment) {
 
     @Override
     public long getCounter(HugeType type) {
-         Object counter = this.queryByRaft(type, true,
-                                           o -> this.store.getCounter(type));
-         assert counter instanceof Long;
-         return (Long) counter;
+        Object counter = this.queryByRaft(type, true,o -> this.store.getCounter(type));

Review Comment:
   ok,I had fixed it



-- 
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


[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r859642683


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStore.java:
##########
@@ -132,41 +141,41 @@ public default String olapTableName(Id id) {
     }
 
     // Increase next id for specific type
-    public void increaseCounter(HugeType type, long increment);
+    void increaseCounter(HugeType type, long increment);
 
     // Get current counter for a specific type
-    public long getCounter(HugeType type);
+    long getCounter(HugeType type);
 
-    public default void createOlapTable(Id pkId) {
+    default void createOlapTable(Id pkId) {
         throw new UnsupportedOperationException(
                   "BackendStore.createOlapTable()");
     }
 
-    public default void checkAndRegisterOlapTable(Id pkId) {
+    default void checkAndRegisterOlapTable(Id pkId) {
         throw new UnsupportedOperationException(
                   "BackendStore.checkAndRegisterOlapTable()");
     }
 
-    public default void clearOlapTable(Id pkId) {
+    default void clearOlapTable(Id pkId) {
         throw new UnsupportedOperationException(
                   "BackendStore.clearOlapTable()");
     }
 
-    public default void removeOlapTable(Id pkId) {
+    default void removeOlapTable(Id pkId) {
         throw new UnsupportedOperationException(
                   "BackendStore.removeOlapTable()");
     }
 
-    public default Map<String, String> createSnapshot(String snapshotDir) {
+    default Map<String, String> createSnapshot(String snapshotDir) {
         throw new UnsupportedOperationException("createSnapshot");
     }
 
-    public default void resumeSnapshot(String snapshotDir,
+    default void resumeSnapshot(String snapshotDir,

Review Comment:
   also update alignment



-- 
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


[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r859816036


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStore.java:
##########
@@ -101,11 +101,9 @@ default Id nextId(HugeType type) {
             }
         }
 
-        E.checkState(counter != 0L, "Please check whether '%s' is OK",
-                     this.provider().type());
+        E.checkState(counter != 0L, "Please check whether '%s' is OK", this.provider().type());
 
-        E.checkState(counter == expect, "'%s' is busy please try again",
-                     this.provider().type());
+        E.checkState(counter == expect, "'%s' is busy please try again", this.provider().type());

Review Comment:
   Can we limit line length to 80 chars as much as possible? We want to define 100 as the maximum line length, rather than guide length.



-- 
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


[GitHub] [incubator-hugegraph] javeme commented on pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#issuecomment-1120216601

   @seagle-yuan there are still comments~


-- 
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


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r867972197


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMutation.java:
##########
@@ -111,6 +111,19 @@ private void optimizeUpdates(BackendEntry entry, Action action) {
                                   " transaction between %s and %s",
                                   entry, originItem.entry()));
                     }
+
+                    if (originAction == Action.INSERT ||
+                        originAction == Action.DELETE) {
+                        throw incompatibleActionException(action, originAction);
+                    } else {
+                        Id subId = entry.subId();
+                        Id originSubId = originItem.entry().subId();
+                        assert subId != null;
+                        if (subId == originSubId || subId.equals(originSubId)) {
+                            iter.remove();
+                        }

Review Comment:
   if only keep lines 119-124
   
   
   these scripts are probably not able to pass



-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r867972197


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMutation.java:
##########
@@ -111,6 +111,19 @@ private void optimizeUpdates(BackendEntry entry, Action action) {
                                   " transaction between %s and %s",
                                   entry, originItem.entry()));
                     }
+
+                    if (originAction == Action.INSERT ||
+                        originAction == Action.DELETE) {
+                        throw incompatibleActionException(action, originAction);
+                    } else {
+                        Id subId = entry.subId();
+                        Id originSubId = originItem.entry().subId();
+                        assert subId != null;
+                        if (subId == originSubId || subId.equals(originSubId)) {
+                            iter.remove();
+                        }

Review Comment:
   if only keep lines 119-124
   `
   @Test
       public void testDeleteAndAppendEntry() {
           BackendMutation mutation = new BackendMutation();
           BackendEntry entry1 = constructBackendEntry("1");
           BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
           mutation.add(entry1, Action.DELETE);
           Assert.assertThrows(HugeException.class, () -> {
               mutation.add(entry2, Action.APPEND);
           });
       }
   `
   
   these scripts are probably not able to pass



-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r867972197


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMutation.java:
##########
@@ -111,6 +111,19 @@ private void optimizeUpdates(BackendEntry entry, Action action) {
                                   " transaction between %s and %s",
                                   entry, originItem.entry()));
                     }
+
+                    if (originAction == Action.INSERT ||
+                        originAction == Action.DELETE) {
+                        throw incompatibleActionException(action, originAction);
+                    } else {
+                        Id subId = entry.subId();
+                        Id originSubId = originItem.entry().subId();
+                        assert subId != null;
+                        if (subId == originSubId || subId.equals(originSubId)) {
+                            iter.remove();
+                        }

Review Comment:
   if only keep lines 119-124
   
       ```
   @Test
       public void testDeleteAndAppendEntry() {
           BackendMutation mutation = new BackendMutation();
           BackendEntry entry1 = constructBackendEntry("1");
           BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
   
           mutation.add(entry1, Action.DELETE);
           Assert.assertThrows(HugeException.class, () -> {
               mutation.add(entry2, Action.APPEND);
           });
       }
   ```
   
   
   these scripts are probably not able to pass



-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r867972197


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMutation.java:
##########
@@ -111,6 +111,19 @@ private void optimizeUpdates(BackendEntry entry, Action action) {
                                   " transaction between %s and %s",
                                   entry, originItem.entry()));
                     }
+
+                    if (originAction == Action.INSERT ||
+                        originAction == Action.DELETE) {
+                        throw incompatibleActionException(action, originAction);
+                    } else {
+                        Id subId = entry.subId();
+                        Id originSubId = originItem.entry().subId();
+                        assert subId != null;
+                        if (subId == originSubId || subId.equals(originSubId)) {
+                            iter.remove();
+                        }

Review Comment:
   if only keep lines 119-124
   
   
   ```
   @Test
       public void testDeleteAndAppendEntry() {
           BackendMutation mutation = new BackendMutation();
           BackendEntry entry1 = constructBackendEntry("1");
           BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
   
           mutation.add(entry1, Action.DELETE);
           Assert.assertThrows(HugeException.class, () -> {
               mutation.add(entry2, Action.APPEND);
           });
       }
   ```
   
   
   these scripts are probably not able to pass



-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r867972197


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMutation.java:
##########
@@ -111,6 +111,19 @@ private void optimizeUpdates(BackendEntry entry, Action action) {
                                   " transaction between %s and %s",
                                   entry, originItem.entry()));
                     }
+
+                    if (originAction == Action.INSERT ||
+                        originAction == Action.DELETE) {
+                        throw incompatibleActionException(action, originAction);
+                    } else {
+                        Id subId = entry.subId();
+                        Id originSubId = originItem.entry().subId();
+                        assert subId != null;
+                        if (subId == originSubId || subId.equals(originSubId)) {
+                            iter.remove();
+                        }

Review Comment:
   if only keep lines 119-124
   `
   @Test
       public void testDeleteAndAppendEntry() {
           BackendMutation mutation = new BackendMutation();
           BackendEntry entry1 = constructBackendEntry("1");
           BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
   
           mutation.add(entry1, Action.DELETE);
           Assert.assertThrows(HugeException.class, () -> {
               mutation.add(entry2, Action.APPEND);
           });
       }
   `
   
   these scripts are probably not able to pass



-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r860413992


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStore.java:
##########
@@ -101,11 +101,9 @@ default Id nextId(HugeType type) {
             }
         }
 
-        E.checkState(counter != 0L, "Please check whether '%s' is OK",
-                     this.provider().type());
+        E.checkState(counter != 0L, "Please check whether '%s' is OK", this.provider().type());
 
-        E.checkState(counter == expect, "'%s' is busy please try again",
-                     this.provider().type());
+        E.checkState(counter == expect, "'%s' is busy please try again", this.provider().type());

Review Comment:
   I think we need to set forceStrictCondition=false for Indentation check
   
   such as 
   ![2](https://user-images.githubusercontent.com/13429553/165665475-b20dfca6-85b7-4008-8663-bacc05e3c1b8.JPG)
   
   



-- 
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


[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r859567046


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java:
##########
@@ -71,63 +71,64 @@ public boolean equals(Object obj) {
         }
     }
 
-    public HugeType type();
+    HugeType type();
 
     @Override
-    public Id id();
+    Id id();
 
-    public Id originId();
+    Id originId();
 
-    public Id subId();
+    Id subId();
 
-    public long ttl();
+    long ttl();
 
-    public int columnsSize();
-    public Collection<BackendColumn> columns();
+    int columnsSize();
 
-    public void columns(Collection<BackendColumn> columns);
-    public void columns(BackendColumn column);
+    Collection<BackendColumn> columns();
 
-    public void merge(BackendEntry other);
-    public boolean mergeable(BackendEntry other);
+    void columns(Collection<BackendColumn> columns);
 
-    public void clear();
+    void columns(BackendColumn column);
 
-    public default boolean belongToMe(BackendColumn column) {
+    void merge(BackendEntry other);
+
+    boolean mergeable(BackendEntry other);
+
+    void clear();
+
+    default boolean belongToMe(BackendColumn column) {
         return Bytes.prefixWith(column.name, id().asBytes());
     }
 
-    public default boolean olap() {
+    default boolean olap() {
         return false;
     }
 
-    public interface BackendIterator<T> extends Iterator<T>, AutoCloseable {
+    interface BackendIterator<T> extends Iterator<T>, AutoCloseable {
 
         @Override
-        public void close();
+        void close();
 
-        public byte[] position();
+        byte[] position();
     }
 
-    public interface BackendColumnIterator
-           extends BackendIterator<BackendColumn> {
+    interface BackendColumnIterator extends BackendIterator<BackendColumn> {
 
-        public static BackendColumnIterator empty() {
+        static BackendColumnIterator empty() {
             return EMPTY;
         }
 
-        public static BackendColumnIterator iterator(BackendColumn element) {
+        static BackendColumnIterator iterator(BackendColumn element) {
             return new OneColumnIterator(element);
         }
 
-        public static BackendColumnIterator wrap(Iterator<BackendColumn> iter) {
+        static BackendColumnIterator wrap(Iterator<BackendColumn> iter) {
             return new BackendColumnIteratorWrapper(iter);
         }
 
-        public static final BackendColumnIterator EMPTY = new EmptyIterator();
+        BackendColumnIterator EMPTY = new EmptyIterator();

Review Comment:
   don't need `static final` mark?



##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java:
##########
@@ -71,63 +71,64 @@ public boolean equals(Object obj) {
         }
     }
 
-    public HugeType type();
+    HugeType type();
 
     @Override
-    public Id id();
+    Id id();
 
-    public Id originId();
+    Id originId();
 
-    public Id subId();
+    Id subId();
 
-    public long ttl();
+    long ttl();
 
-    public int columnsSize();
-    public Collection<BackendColumn> columns();
+    int columnsSize();
 
-    public void columns(Collection<BackendColumn> columns);
-    public void columns(BackendColumn column);
+    Collection<BackendColumn> columns();
 
-    public void merge(BackendEntry other);
-    public boolean mergeable(BackendEntry other);
+    void columns(Collection<BackendColumn> columns);
 
-    public void clear();
+    void columns(BackendColumn column);
 
-    public default boolean belongToMe(BackendColumn column) {
+    void merge(BackendEntry other);
+
+    boolean mergeable(BackendEntry other);
+
+    void clear();
+
+    default boolean belongToMe(BackendColumn column) {
         return Bytes.prefixWith(column.name, id().asBytes());
     }
 
-    public default boolean olap() {
+    default boolean olap() {
         return false;
     }
 
-    public interface BackendIterator<T> extends Iterator<T>, AutoCloseable {
+    interface BackendIterator<T> extends Iterator<T>, AutoCloseable {
 
         @Override
-        public void close();
+        void close();
 
-        public byte[] position();
+        byte[] position();
     }
 
-    public interface BackendColumnIterator
-           extends BackendIterator<BackendColumn> {
+    interface BackendColumnIterator extends BackendIterator<BackendColumn> {
 
-        public static BackendColumnIterator empty() {
+        static BackendColumnIterator empty() {
             return EMPTY;
         }
 
-        public static BackendColumnIterator iterator(BackendColumn element) {
+        static BackendColumnIterator iterator(BackendColumn element) {
             return new OneColumnIterator(element);
         }
 
-        public static BackendColumnIterator wrap(Iterator<BackendColumn> iter) {
+        static BackendColumnIterator wrap(Iterator<BackendColumn> iter) {
             return new BackendColumnIteratorWrapper(iter);
         }
 
-        public static final BackendColumnIterator EMPTY = new EmptyIterator();
+        BackendColumnIterator EMPTY = new EmptyIterator();
 
-        public static final class EmptyIterator
-                            implements BackendColumnIterator {
+        final class EmptyIterator implements BackendColumnIterator {

Review Comment:
   can we keep `static final `mark?



##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java:
##########
@@ -186,8 +186,7 @@ public byte[] position() {
             }
         }
 
-        public static final class BackendColumnIteratorWrapper
-                            implements BackendColumnIterator {
+        final class BackendColumnIteratorWrapper implements BackendColumnIterator {

Review Comment:
   can we keep static final mark?



##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java:
##########
@@ -150,8 +151,7 @@ public byte[] position() {
             }
         }
 
-        public static final class OneColumnIterator
-                            implements BackendColumnIterator {
+        final class OneColumnIterator implements BackendColumnIterator {

Review Comment:
   can we keep `static final` mark?



-- 
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


[GitHub] [incubator-hugegraph] javeme commented on pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#issuecomment-1116905379

   cassandra ci:
   ```java
   Error:  Tests run: 727, Failures: 3, Errors: 1, Skipped: 21, Time elapsed: 482.636 s <<< FAILURE! - in com.baidu.hugegraph.core.CoreTestSuite
   Error:  testQueryVertexBeforeAfterUpdateMultiPropertyWithIndex(com.baidu.hugegraph.core.VertexCoreTest)  Time elapsed: 0.541 s  <<< FAILURE!
   java.lang.AssertionError: expected:<1> but was:<0>
   	at com.baidu.hugegraph.core.VertexCoreTest.testQueryVertexBeforeAfterUpdateMultiPropertyWithIndex(VertexCoreTest.java:6465)
   
   Error:  testAddVertexWithCollectionIndex(com.baidu.hugegraph.core.VertexCoreTest)  Time elapsed: 0.523 s  <<< FAILURE!
   java.lang.AssertionError: expected:<1> but was:<0>
   	at com.baidu.hugegraph.core.VertexCoreTest.testAddVertexWithCollectionIndex(VertexCoreTest.java:676)
   
   Error:  testAddEdgeWithCollectionIndex(com.baidu.hugegraph.core.EdgeCoreTest)  Time elapsed: 0.37 s  <<< FAILURE!
   java.lang.AssertionError: expected:<1> but was:<0>
   	at com.baidu.hugegraph.core.EdgeCoreTest.testAddEdgeWithCollectionIndex(EdgeCoreTest.java:7334)
   
   Error:  testUpdateEdgePropertyWithRemoveAndSet(com.baidu.hugegraph.core.EdgeCoreTest)  Time elapsed: 0.49 s  <<< ERROR!
   java.lang.IllegalStateException: The property does not exist as it has no key, value, or associated element
   	at com.baidu.hugegraph.core.EdgeCoreTest.assertContains(EdgeCoreTest.java:7465)
   	at com.baidu.hugegraph.core.EdgeCoreTest.testUpdateEdgePropertyWithRemoveAndSet(EdgeCoreTest.java:5938)
   ```
   
   hbase ci:
   ```java
   Error:  Tests run: 727, Failures: 3, Errors: 0, Skipped: 35, Time elapsed: 873.651 s <<< FAILURE! - in com.baidu.hugegraph.core.CoreTestSuite
   Error:  testQueryVertexBeforeAfterUpdateMultiPropertyWithIndex(com.baidu.hugegraph.core.VertexCoreTest)  Time elapsed: 0.547 s  <<< FAILURE!
   java.lang.AssertionError: expected:<1> but was:<0>
   	at com.baidu.hugegraph.core.VertexCoreTest.testQueryVertexBeforeAfterUpdateMultiPropertyWithIndex(VertexCoreTest.java:6465)
   
   Error:  testAddVertexWithCollectionIndex(com.baidu.hugegraph.core.VertexCoreTest)  Time elapsed: 0.537 s  <<< FAILURE!
   java.lang.AssertionError: expected:<1> but was:<0>
   	at com.baidu.hugegraph.core.VertexCoreTest.testAddVertexWithCollectionIndex(VertexCoreTest.java:676)
   
   Error:  testAddEdgeWithCollectionIndex(com.baidu.hugegraph.core.EdgeCoreTest)  Time elapsed: 0.413 s  <<< FAILURE!
   java.lang.AssertionError: expected:<1> but was:<0>
   	at com.baidu.hugegraph.core.EdgeCoreTest.testAddEdgeWithCollectionIndex(EdgeCoreTest.java:7334)
   ```


-- 
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


[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r864427680


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/IdRangeQuery.java:
##########
@@ -102,12 +102,12 @@ public String toString() {
         assert sb.length() > 0;
         sb.deleteCharAt(sb.length() - 1); // Remove the last "`"
         sb.append(" id in range ")
-          .append(this.inclusiveStart ? "[" : "(")
-          .append(this.start)
-          .append(", ")
-          .append(this.end)
-          .append(this.inclusiveEnd ? "]" : ")")
-          .append("`");
+            .append(this.inclusiveStart ? "[" : "(")

Review Comment:
   can rename to `StringBuilder builder `



##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMutation.java:
##########
@@ -111,6 +111,7 @@ private void optimizeUpdates(BackendEntry entry, Action action) {
                                   " transaction between %s and %s",
                                   entry, originItem.entry()));
                     }
+                    break;

Review Comment:
   please check whether it's required by code logic



##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStore.java:
##########
@@ -111,62 +120,57 @@ public default void setCounterLowest(HugeType type, long lowest) {
         this.increaseCounter(type, increment);
     }
 
-    public default String olapTableName(HugeType type) {
+    default String olapTableName(HugeType type) {
         StringBuilder sb = new StringBuilder(7);
         sb.append(this.store())
-          .append("_")
-          .append(HugeType.OLAP.string())
-          .append("_")
-          .append(type.string());
+            .append("_")

Review Comment:
   ditto



##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java:
##########
@@ -424,7 +422,7 @@ private IdHolderList queryByLabel(ConditionQuery query) {
         }
 
         ConditionQuery indexQuery;
-        indexQuery = new ConditionQuery(indexType , query);
+        indexQuery = new ConditionQuery(indexType, query);

Review Comment:
   can merge into line 424



##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStore.java:
##########
@@ -111,62 +120,57 @@ public default void setCounterLowest(HugeType type, long lowest) {
         this.increaseCounter(type, increment);
     }
 
-    public default String olapTableName(HugeType type) {
+    default String olapTableName(HugeType type) {
         StringBuilder sb = new StringBuilder(7);
         sb.append(this.store())
-          .append("_")
-          .append(HugeType.OLAP.string())
-          .append("_")
-          .append(type.string());
+            .append("_")
+            .append(HugeType.OLAP.string())
+            .append("_")
+            .append(type.string());
         return sb.toString().toLowerCase();
     }
 
-    public default String olapTableName(Id id) {
+    default String olapTableName(Id id) {
         StringBuilder sb = new StringBuilder(5 + 4);
         sb.append(this.store())
-          .append("_")
-          .append(HugeType.OLAP.string())
-          .append("_")
-          .append(id.asLong());
+            .append("_")

Review Comment:
   ditto



-- 
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


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r867972197


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMutation.java:
##########
@@ -111,6 +111,19 @@ private void optimizeUpdates(BackendEntry entry, Action action) {
                                   " transaction between %s and %s",
                                   entry, originItem.entry()));
                     }
+
+                    if (originAction == Action.INSERT ||
+                        originAction == Action.DELETE) {
+                        throw incompatibleActionException(action, originAction);
+                    } else {
+                        Id subId = entry.subId();
+                        Id originSubId = originItem.entry().subId();
+                        assert subId != null;
+                        if (subId == originSubId || subId.equals(originSubId)) {
+                            iter.remove();
+                        }

Review Comment:
   if only keep lines 119-124
   `@Test
       public void testDeleteAndAppendEntry() {
           BackendMutation mutation = new BackendMutation();
           BackendEntry entry1 = constructBackendEntry("1");
           BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
   
           mutation.add(entry1, Action.DELETE);
           Assert.assertThrows(HugeException.class, () -> {
               mutation.add(entry2, Action.APPEND);
           });
       }`
   
   these scripts are probably not able to pass



-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] javeme merged pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme merged PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852


-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] codecov[bot] commented on pull request #1852: fix core-issue checkstyle issue

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#issuecomment-1109726389

   # [Codecov](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1852](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b3c4f5a) into [master](https://codecov.io/gh/apache/incubator-hugegraph/commit/0ed2e3b80789620d3e0da43216747502c7d3e729?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0ed2e3b) will **decrease** coverage by `19.88%`.
   > The diff coverage is `52.94%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             master    #1852       +/-   ##
   =============================================
   - Coverage     70.70%   50.82%   -19.89%     
   + Complexity      980      659      -321     
   =============================================
     Files           447      447               
     Lines         38041    37982       -59     
     Branches       5389     5367       -22     
   =============================================
   - Hits          26897    19303     -7594     
   - Misses         8508    16571     +8063     
   + Partials       2636     2108      -528     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...in/java/com/baidu/hugegraph/backend/id/EdgeId.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9jb20vYmFpZHUvaHVnZWdyYXBoL2JhY2tlbmQvaWQvRWRnZUlkLmphdmE=) | `67.56% <ø> (-11.57%)` | :arrow_down: |
   | [.../baidu/hugegraph/backend/query/ConditionQuery.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9jb20vYmFpZHUvaHVnZWdyYXBoL2JhY2tlbmQvcXVlcnkvQ29uZGl0aW9uUXVlcnkuamF2YQ==) | `82.72% <ø> (-3.17%)` | :arrow_down: |
   | [...egraph/backend/serializer/BinaryEntryIterator.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9jb20vYmFpZHUvaHVnZWdyYXBoL2JhY2tlbmQvc2VyaWFsaXplci9CaW5hcnlFbnRyeUl0ZXJhdG9yLmphdmE=) | `20.37% <ø> (-66.67%)` | :arrow_down: |
   | [...hugegraph/backend/serializer/BinarySerializer.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9jb20vYmFpZHUvaHVnZWdyYXBoL2JhY2tlbmQvc2VyaWFsaXplci9CaW5hcnlTZXJpYWxpemVyLmphdmE=) | `28.16% <0.00%> (-57.57%)` | :arrow_down: |
   | [.../baidu/hugegraph/backend/store/BackendSession.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9jb20vYmFpZHUvaHVnZWdyYXBoL2JhY2tlbmQvc3RvcmUvQmFja2VuZFNlc3Npb24uamF2YQ==) | `61.90% <ø> (-19.05%)` | :arrow_down: |
   | [...om/baidu/hugegraph/backend/store/BackendTable.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9jb20vYmFpZHUvaHVnZWdyYXBoL2JhY2tlbmQvc3RvcmUvQmFja2VuZFRhYmxlLmphdmE=) | `17.33% <ø> (-69.43%)` | :arrow_down: |
   | [...hugegraph/backend/store/raft/RaftBackendStore.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9jb20vYmFpZHUvaHVnZWdyYXBoL2JhY2tlbmQvc3RvcmUvcmFmdC9SYWZ0QmFja2VuZFN0b3JlLmphdmE=) | `0.00% <0.00%> (-75.00%)` | :arrow_down: |
   | [...om/baidu/hugegraph/backend/store/BackendEntry.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9jb20vYmFpZHUvaHVnZWdyYXBoL2JhY2tlbmQvc3RvcmUvQmFja2VuZEVudHJ5LmphdmE=) | `12.24% <25.00%> (-59.19%)` | :arrow_down: |
   | [...a/com/baidu/hugegraph/backend/query/Condition.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9jb20vYmFpZHUvaHVnZWdyYXBoL2JhY2tlbmQvcXVlcnkvQ29uZGl0aW9uLmphdmE=) | `61.01% <100.00%> (-17.33%)` | :arrow_down: |
   | [...hugegraph/backend/query/ConditionQueryFlatten.java](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aHVnZWdyYXBoLWNvcmUvc3JjL21haW4vamF2YS9jb20vYmFpZHUvaHVnZWdyYXBoL2JhY2tlbmQvcXVlcnkvQ29uZGl0aW9uUXVlcnlGbGF0dGVuLmphdmE=) | `70.83% <100.00%> (-4.90%)` | :arrow_down: |
   | ... and [202 more](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [0ed2e3b...b3c4f5a](https://codecov.io/gh/apache/incubator-hugegraph/pull/1852?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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


[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r865546006


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMutation.java:
##########
@@ -111,6 +111,19 @@ private void optimizeUpdates(BackendEntry entry, Action action) {
                                   " transaction between %s and %s",
                                   entry, originItem.entry()));
                     }
+
+                    if (originAction == Action.INSERT ||
+                        originAction == Action.DELETE) {
+                        throw incompatibleActionException(action, originAction);
+                    } else {
+                        Id subId = entry.subId();
+                        Id originSubId = originItem.entry().subId();
+                        assert subId != null;
+                        if (subId == originSubId || subId.equals(originSubId)) {
+                            iter.remove();
+                        }

Review Comment:
   just keep lines 119-124



-- 
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


[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r869883233


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMutation.java:
##########
@@ -111,6 +111,19 @@ private void optimizeUpdates(BackendEntry entry, Action action) {
                                   " transaction between %s and %s",
                                   entry, originItem.entry()));
                     }
+
+                    if (originAction == Action.INSERT ||
+                        originAction == Action.DELETE) {
+                        throw incompatibleActionException(action, originAction);
+                    } else {
+                        Id subId = entry.subId();
+                        Id originSubId = originItem.entry().subId();
+                        assert subId != null;
+                        if (subId == originSubId || subId.equals(originSubId)) {
+                            iter.remove();
+                        }

Review Comment:
   OK



-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r870111986


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java:
##########
@@ -831,7 +831,7 @@ public boolean checkRangeIndex(HugeElement element, Condition cond) {
         }
 
         private static boolean removeFieldValue(Set<Object> values,
-                                                Object value){
+                                                Object value) {

Review Comment:
   if merge , this line is more than 80 characters.
   
   https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r859816036



-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r867972197


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMutation.java:
##########
@@ -111,6 +111,19 @@ private void optimizeUpdates(BackendEntry entry, Action action) {
                                   " transaction between %s and %s",
                                   entry, originItem.entry()));
                     }
+
+                    if (originAction == Action.INSERT ||
+                        originAction == Action.DELETE) {
+                        throw incompatibleActionException(action, originAction);
+                    } else {
+                        Id subId = entry.subId();
+                        Id originSubId = originItem.entry().subId();
+                        assert subId != null;
+                        if (subId == originSubId || subId.equals(originSubId)) {
+                            iter.remove();
+                        }

Review Comment:
   if only keep lines 119-124
   `
       @Test
       public void testDeleteAndAppendEntry() {
           BackendMutation mutation = new BackendMutation();
           BackendEntry entry1 = constructBackendEntry("1");
           BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
   
           mutation.add(entry1, Action.DELETE);
           Assert.assertThrows(HugeException.class, () -> {
               mutation.add(entry2, Action.APPEND);
           });
       }
   `
   
   these scripts are probably not able to pass



-- 
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: commits-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r859615701


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java:
##########
@@ -71,63 +71,64 @@ public boolean equals(Object obj) {
         }
     }
 
-    public HugeType type();
+    HugeType type();
 
     @Override
-    public Id id();
+    Id id();
 
-    public Id originId();
+    Id originId();
 
-    public Id subId();
+    Id subId();
 
-    public long ttl();
+    long ttl();
 
-    public int columnsSize();
-    public Collection<BackendColumn> columns();
+    int columnsSize();
 
-    public void columns(Collection<BackendColumn> columns);
-    public void columns(BackendColumn column);
+    Collection<BackendColumn> columns();
 
-    public void merge(BackendEntry other);
-    public boolean mergeable(BackendEntry other);
+    void columns(Collection<BackendColumn> columns);
 
-    public void clear();
+    void columns(BackendColumn column);
 
-    public default boolean belongToMe(BackendColumn column) {
+    void merge(BackendEntry other);
+
+    boolean mergeable(BackendEntry other);
+
+    void clear();
+
+    default boolean belongToMe(BackendColumn column) {
         return Bytes.prefixWith(column.name, id().asBytes());
     }
 
-    public default boolean olap() {
+    default boolean olap() {
         return false;
     }
 
-    public interface BackendIterator<T> extends Iterator<T>, AutoCloseable {
+    interface BackendIterator<T> extends Iterator<T>, AutoCloseable {
 
         @Override
-        public void close();
+        void close();
 
-        public byte[] position();
+        byte[] position();
     }
 
-    public interface BackendColumnIterator
-           extends BackendIterator<BackendColumn> {
+    interface BackendColumnIterator extends BackendIterator<BackendColumn> {
 
-        public static BackendColumnIterator empty() {
+        static BackendColumnIterator empty() {
             return EMPTY;
         }
 
-        public static BackendColumnIterator iterator(BackendColumn element) {
+        static BackendColumnIterator iterator(BackendColumn element) {
             return new OneColumnIterator(element);
         }
 
-        public static BackendColumnIterator wrap(Iterator<BackendColumn> iter) {
+        static BackendColumnIterator wrap(Iterator<BackendColumn> iter) {
             return new BackendColumnIteratorWrapper(iter);
         }
 
-        public static final BackendColumnIterator EMPTY = new EmptyIterator();
+        BackendColumnIterator EMPTY = new EmptyIterator();

Review Comment:
   an interface can contain constant declarations. All constant values defined in an interface are implicitly public, static, and final. Once again, you can omit these modifiers.
   
   https://docs.oracle.com/javase/tutorial/java/IandI/interfaceDef.html



-- 
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


[GitHub] [incubator-hugegraph] seagle-yuan commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
seagle-yuan commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r859768084


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java:
##########
@@ -150,8 +151,7 @@ public byte[] position() {
             }
         }
 
-        public static final class OneColumnIterator
-                            implements BackendColumnIterator {
+        final class OneColumnIterator implements BackendColumnIterator {

Review Comment:
   static is redundant for inner classes of interfaces. 
   
   ![static](https://user-images.githubusercontent.com/13429553/165522755-908eaacd-83fb-40cf-a648-5f9ea36758fd.JPG)
   
   https://beginnersbook.com/2016/03/nested-or-inner-interfaces-in-java/#:~:text=Nested%20interfaces%20are%20static%20by,inside%20interface%20is%20public%20implicitly.
   
   



##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendEntry.java:
##########
@@ -71,63 +71,64 @@ public boolean equals(Object obj) {
         }
     }
 
-    public HugeType type();
+    HugeType type();
 
     @Override
-    public Id id();
+    Id id();
 
-    public Id originId();
+    Id originId();
 
-    public Id subId();
+    Id subId();
 
-    public long ttl();
+    long ttl();
 
-    public int columnsSize();
-    public Collection<BackendColumn> columns();
+    int columnsSize();
 
-    public void columns(Collection<BackendColumn> columns);
-    public void columns(BackendColumn column);
+    Collection<BackendColumn> columns();
 
-    public void merge(BackendEntry other);
-    public boolean mergeable(BackendEntry other);
+    void columns(Collection<BackendColumn> columns);
 
-    public void clear();
+    void columns(BackendColumn column);
 
-    public default boolean belongToMe(BackendColumn column) {
+    void merge(BackendEntry other);
+
+    boolean mergeable(BackendEntry other);
+
+    void clear();
+
+    default boolean belongToMe(BackendColumn column) {
         return Bytes.prefixWith(column.name, id().asBytes());
     }
 
-    public default boolean olap() {
+    default boolean olap() {
         return false;
     }
 
-    public interface BackendIterator<T> extends Iterator<T>, AutoCloseable {
+    interface BackendIterator<T> extends Iterator<T>, AutoCloseable {
 
         @Override
-        public void close();
+        void close();
 
-        public byte[] position();
+        byte[] position();
     }
 
-    public interface BackendColumnIterator
-           extends BackendIterator<BackendColumn> {
+    interface BackendColumnIterator extends BackendIterator<BackendColumn> {
 
-        public static BackendColumnIterator empty() {
+        static BackendColumnIterator empty() {
             return EMPTY;
         }
 
-        public static BackendColumnIterator iterator(BackendColumn element) {
+        static BackendColumnIterator iterator(BackendColumn element) {
             return new OneColumnIterator(element);
         }
 
-        public static BackendColumnIterator wrap(Iterator<BackendColumn> iter) {
+        static BackendColumnIterator wrap(Iterator<BackendColumn> iter) {
             return new BackendColumnIteratorWrapper(iter);
         }
 
-        public static final BackendColumnIterator EMPTY = new EmptyIterator();
+        BackendColumnIterator EMPTY = new EmptyIterator();
 
-        public static final class EmptyIterator
-                            implements BackendColumnIterator {
+        final class EmptyIterator implements BackendColumnIterator {

Review Comment:
   static is redundant for inner classes of interfaces. 



-- 
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


[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r860501292


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStore.java:
##########
@@ -101,11 +101,9 @@ default Id nextId(HugeType type) {
             }
         }
 
-        E.checkState(counter != 0L, "Please check whether '%s' is OK",
-                     this.provider().type());
+        E.checkState(counter != 0L, "Please check whether '%s' is OK", this.provider().type());
 
-        E.checkState(counter == expect, "'%s' is busy please try again",
-                     this.provider().type());
+        E.checkState(counter == expect, "'%s' is busy please try again", this.provider().type());

Review Comment:
   We already have a lot of code in this style, and we also recommend keeping alignment when indented. So it's a good choice to set `forceStrictCondition=false`.



-- 
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


[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #1852: fix core-backend checkstyle issue

Posted by GitBox <gi...@apache.org>.
javeme commented on code in PR #1852:
URL: https://github.com/apache/incubator-hugegraph/pull/1852#discussion_r864442318


##########
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendMutation.java:
##########
@@ -111,6 +111,7 @@ private void optimizeUpdates(BackendEntry entry, Action action) {
                                   " transaction between %s and %s",
                                   entry, originItem.entry()));
                     }
+                    break;

Review Comment:
   try to copy code block from lines 120~125



-- 
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