PranaliM commented on a change in pull request #2260: CLOUDSTACK-10065: 
Optimize SQL queries in listTemplate API to improve performance
URL: https://github.com/apache/cloudstack/pull/2260#discussion_r148003391
 
 

 ##########
 File path: framework/db/src/com/cloud/utils/db/SqlGenerator.java
 ##########
 @@ -680,4 +680,21 @@ public String buildDistinctIdSql() {
 
         return sql.append("SELECT DISTINCT id FROM 
").append(buildTableReferences()).append(" WHERE 
").append(buildDiscriminatorClause().first()).toString();
     }
+
+    public String buildDistinctSql(String[] distinctColumnNames) {
+        StringBuilder sbColumn = new StringBuilder();
+
+        if(distinctColumnNames != null && distinctColumnNames.length > 0) {
+            for (String columnName : distinctColumnNames) {
+                sbColumn.append(columnName).append(", ");
+            }
+            sbColumn.delete(sbColumn.length() - 2, sbColumn.length());
+        }
+        else{
 
 Review comment:
   Fixed

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to