oleg-vlsk commented on code in PR #11425:
URL: https://github.com/apache/ignite/pull/11425#discussion_r1885404000


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/query/running/SqlPlanHistoryTracker.java:
##########
@@ -47,7 +42,7 @@ public SqlPlanHistoryTracker(int historySize) {
      * @param engine SQL engine.
      */
     public void addPlan(String plan, String qry, String schema, boolean loc, 
String engine) {
-        if (historySize <= 0)
+        if 
(sqlPlanHistory.getClass().equals(Collections.emptyMap().getClass()))

Review Comment:
   We can't use `sqlPlanHistory == Collections.emptyMap()` because
   
   _Operator '==' cannot be applied to 
'java.util.Map<org.apache.ignite.internal.processors.query.running.SqlPlan,java.lang.Long>',
 'java.util.Map<java.lang.Object,java.lang.Object>'_
   
   We also can use `sqlPlanHistory.equals(Collections.emptyMap())` because 
`AbstractMap#equals` identifies two map as equal if they both are empty. So 
`sqlPlanHistory.equals(Collections.emptyMap())` will return `TRUE` for a newly 
created `sqlPlanHistory` with `size=0`, and the method won't work correctly.
   
   If however we compare classes of `sqlPlanHistory` and 
`Collections.emptyMap()`, then the method works as we intended and 
`sqlPlanHistory.getClass().equals(Collections.emptyMap().getClass())` doesn't 
return `TRUE` for a newly created `sqlPlanHistory`.



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