Copilot commented on code in PR #13508:
URL: https://github.com/apache/skywalking/pull/13508#discussion_r2367429124


##########
oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/stream/BanyanDBLogQueryDAO.java:
##########
@@ -100,6 +106,13 @@ public void apply(StreamQuery query) {
                     }
                     query.and(having(LogRecord.TAGS, tagsConditions));
                 }
+                if (queryOrder == Order.ASC) {
+                    query.setOrderBy(
+                        new AbstractQuery.OrderBy(AbstractQuery.Sort.ASC));
+                } else {

Review Comment:
   The order by logic assumes that any non-ASC order should be DESC, but 
doesn't handle null or other potential Order values. Consider adding explicit 
null checking or handling for unexpected Order values to make the logic more 
robust.
   ```suggestion
                   if (queryOrder == null) {
                       // Default to DESC if queryOrder is null
                       query.setOrderBy(
                           new AbstractQuery.OrderBy(AbstractQuery.Sort.DESC));
                   } else if (queryOrder == Order.ASC) {
                       query.setOrderBy(
                           new AbstractQuery.OrderBy(AbstractQuery.Sort.ASC));
                   } else if (queryOrder == Order.DESC) {
                       query.setOrderBy(
                           new AbstractQuery.OrderBy(AbstractQuery.Sort.DESC));
                   } else {
                       // Unexpected value, default to DESC and optionally log 
a warning
   ```



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

Reply via email to