Jackie-Jiang commented on a change in pull request #4216: PQL -> SQL enhancement - phase 1 - new Pinot Query Struct URL: https://github.com/apache/incubator-pinot/pull/4216#discussion_r290995127
########## File path: pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java ########## @@ -75,11 +119,9 @@ private static FilterQuery traverseFilterQueryAndPopulateMap(FilterQueryTree tre final List<Integer> f = new ArrayList<>(); if (null != tree.getChildren()) { for (final FilterQueryTree c : tree.getChildren()) { - int childNodeId = currentId.intValue(); - currentId.increment(); - - f.add(childNodeId); final FilterQuery q = traverseFilterQueryAndPopulateMap(c, filterQueryMap, currentId); + int childNodeId = q.getId(); Review comment: Good catch. I would recommend rewriting this method as follows, which to me is much more clear, and no need to put root into the map explicitly: ``` private static FilterQuery traverseFilterQueryAndPopulateMap(FilterQueryTree root, Map<Integer, FilterQuery> filterQueryMap) { List<Integer> childIds = new ArrayList<>(); List<FilterQueryTree> children = root.getChildren(); if (children != null) { for (FilterQueryTree child : children) { FilterQuery childQuery = traverseFilterQueryAndPopulateMap(child, filterQueryMap); childIds.add(childQuery.getId()); } } int id = filterQueryMap.size(); FilterQuery query = new FilterQuery(); filterQueryMap.put(id, query); query.setId(id); query.setNestedFilterQueryIds(childIds); query.setColumn(root.getColumn()); query.setOperator(root.getOperator()); query.setValue(root.getValue()); return query; } ``` Also, please fix the traverseHavingFilterQueryAndPopulateMap() as well. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org