Jackie-Jiang commented on a change in pull request #4648: Enable DISTINCT and 
throw exceptions for not-supported cases
URL: https://github.com/apache/incubator-pinot/pull/4648#discussion_r329163048
 
 

 ##########
 File path: 
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
 ##########
 @@ -369,30 +371,57 @@ private boolean forceLog(BrokerResponse brokerResponse, 
long totalTimeMs) {
 
   /**
    * Broker side validation on the broker request.
-   * <p>Throw RuntimeException if query does not pass validation.
+   * <p>Throw exception if query does not pass validation.
    * <p>Current validations are:
    * <ul>
    *   <li>Value for 'TOP' for aggregation group-by query <= configured 
value</li>
    *   <li>Value for 'LIMIT' for selection query <= configured value</li>
+   *   <li>Unsupported DISTINCT queries</li>
    * </ul>
    */
-  private void validateRequest(BrokerRequest brokerRequest) {
-    if (brokerRequest.isSetAggregationsInfo() && brokerRequest.isSetGroupBy()) 
{
-      // aggregation with group by query
+  static void validateRequest(BrokerRequest brokerRequest, int 
queryResponseLimit) {
+    // verify LIMIT
+    // LIMIT is applicable to selection query or DISTINCT query
+    // LIMIT is store in BrokerRequest
+    int limit = brokerRequest.getLimit();
+    if (limit > queryResponseLimit) {
+      throw new RuntimeException(
 
 Review comment:
   IllegalStateException?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to