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_r290998808
########## File path: pinot-common/src/main/java/org/apache/pinot/pql/parsers/Pql2Compiler.java ########## @@ -111,6 +136,64 @@ public BrokerRequest compileToBrokerRequest(String expression) } } + private boolean validate(BrokerRequest br1, BrokerRequest br2) throws Exception { + //Having not yet supported + if (br1.getHavingFilterQuery() != null) { + return true; + } + boolean result = br1.equals(br2); + if (!result) { + StringBuilder sb = new StringBuilder(); + + if (br1.getFilterQuery() != null) { + if (!br1.getFilterQuery().equals(br2.getFilterQuery())) { + sb.append("br1.getFilterQuery() = ").append(br1.getFilterQuery()).append("\n") + .append("br2.getFilterQuery() = ").append(br2.getFilterQuery()); + LOGGER.error("Filter did not match after conversion.{}", sb); + return false; + } + + if (!br1.getFilterSubQueryMap().equals(br2.getFilterSubQueryMap())) { + sb.append("br1.getFilterSubQueryMap() = ").append(br1.getFilterSubQueryMap()).append("\n") + .append("br2.getFilterSubQueryMap() = ").append(br2.getFilterSubQueryMap()); + LOGGER.error("FilterSubQueryMap did not match after conversion. {}", sb); + return false; + } + } + if (br1.getSelections() != null) { + if (!br1.getSelections().equals(br2.getSelections())) { + sb.append("br1.getSelections() = ").append(br1.getSelections()).append("\n") + .append("br2.getSelections() = ").append(br2.getSelections()); + LOGGER.error("Selection did not match after conversion:{}", sb); + return false; + } + } + if (br1.getGroupBy() != null) { + if (!br1.getGroupBy().equals(br2.getGroupBy())) { + sb.append("br1.getGroupBy() = ").append(br1.getGroupBy()).append("\n") + .append("br2.getGroupBy() = ").append(br2.getGroupBy()); + LOGGER.error("Group By did not match conversion:{}", sb); + return false; + } + } + if (br1.getAggregationsInfo() != null) { + List<AggregationInfo> aggregationsInfo = br1.getAggregationsInfo(); + for (int i = 0; i < aggregationsInfo.size(); i++) { + AggregationInfo agg1 = br1.getAggregationsInfo().get(i); + AggregationInfo agg2 = br2.getAggregationsInfo().get(i); + if (!agg1.equals(agg2)) { + sb.append("br1.agg1 = ").append(agg1).append("\n") + .append("br2.agg2() = ").append(agg2); + LOGGER.error("AggregationInfo did not match after conversion: {}", sb); + return false; + } + } + } + } + return result; Review comment: Can result be false while none of the if conditions matches? ---------------------------------------------------------------- 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