Copilot commented on code in PR #657:
URL: 
https://github.com/apache/incubator-hugegraph-toolchain/pull/657#discussion_r2020135997


##########
hugegraph-client/src/main/java/org/apache/hugegraph/api/traverser/CountAPI.java:
##########
@@ -22,28 +22,40 @@
 import org.apache.hugegraph.client.RestClient;
 import org.apache.hugegraph.rest.RestResult;
 import org.apache.hugegraph.structure.traverser.CountRequest;
+import org.apache.hugegraph.structure.traverser.CountResponse;
 import org.apache.hugegraph.util.E;
 
 public class CountAPI extends TraversersAPI {
 
     private static final String COUNT = "count";
 
-    public CountAPI(RestClient client, String graph) {
-        super(client, graph);
+    public CountAPI(RestClient client,  String graphSpace, String graph) {
+        super(client, graphSpace, graph);
     }
 
     @Override
     protected String type() {
         return "count";
     }
 
-    public long post(CountRequest request) {
+    public CountResponse post(CountRequest request) {
         this.client.checkApiVersion("0.55", "count");
         RestResult result = this.client.post(this.path(), request);
-        @SuppressWarnings("unchecked")
-        Map<String, Number> countMap = result.readObject(Map.class);
-        E.checkState(countMap.containsKey(COUNT),
-                     "The result doesn't have key '%s'", COUNT);
-        return countMap.get(COUNT).longValue();
+        // TODO: temp implementation
+        if (!result.content().contains("countMap")) {
+            @SuppressWarnings("unchecked")
+            Map<String, Number> countMap = result.readObject(Map.class);

Review Comment:
   The conditional check on the response content may be brittle; consider a 
more robust approach for distinguishing between response formats in the 
temporary implementation.
   ```suggestion
           Object responseObject = result.readObject(Object.class);
           if (responseObject instanceof Map) {
               @SuppressWarnings("unchecked")
               Map<String, Number> countMap = (Map<String, Number>) 
responseObject;
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to