You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/05/20 20:40:25 UTC

[GitHub] [incubator-pinot] xiaohui-sun commented on a change in pull request #5413: [TE] alerts search and pagination endpoint

xiaohui-sun commented on a change in pull request #5413:
URL: https://github.com/apache/incubator-pinot/pull/5413#discussion_r428294317



##########
File path: thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datalayer/util/SqlQueryBuilder.java
##########
@@ -338,6 +338,46 @@ public PreparedStatement createFindByParamsStatement(Connection connection,
     return prepareStatement;
   }
 
+  public PreparedStatement createfindByParamsStatementWithLimit(Connection connection,
+      Class<? extends AbstractEntity> entityClass, Predicate predicate, Long limit, Long offset) throws Exception {
+    String tableName = entityMappingHolder.tableToEntityNameMap.inverse().get(entityClass.getSimpleName());
+    BiMap<String, String> entityNameToDBNameMapping =
+        entityMappingHolder.columnMappingPerTable.get(tableName).inverse();
+    StringBuilder sqlBuilder = new StringBuilder("SELECT * FROM " + tableName);
+    StringBuilder whereClause = new StringBuilder(" WHERE ");
+    List<Pair<String, Object>> parametersList = new ArrayList<>();
+    generateWhereClause(entityNameToDBNameMapping, predicate, parametersList, whereClause);
+    sqlBuilder.append(whereClause.toString());
+    sqlBuilder.append(" ORDER BY id DESC");

Review comment:
       Why we need to order by other columns? id is unique.




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org