9aman commented on code in PR #16043:
URL: https://github.com/apache/pinot/pull/16043#discussion_r2141912186


##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java:
##########
@@ -919,6 +922,32 @@ private CompileResult compileRequest(long requestId, 
String query, SqlNodeAndOpt
       throwAccessDeniedError(requestId, query, requestContext, tableName, 
authorizationResult);
     }
 
+    //get RLS/CLS filters now
+    TableRowColAuthResult rlsFilters = 
accessControl.getRowColFilters(requesterIdentity, tableName);
+
+    //rewrite query
+    Map<String, String> queryOptions =
+        pinotQuery.getQueryOptions() == null ? new HashMap<>() : 
pinotQuery.getQueryOptions();
+
+    Optional<Map<String, List<String>>> rlsFiltersMaybe = 
rlsFilters.getRLSFilters();
+    if (rlsFiltersMaybe.isPresent()) {
+      Map<String, List<String>> rowFilters = rlsFiltersMaybe.get();
+      StringBuilder sb = new StringBuilder();
+      for (String policyId : rowFilters.keySet()) {
+        List<String> filters = rowFilters.get(policyId);
+        for (int i = 0; i < filters.size(); i++) {
+          sb.append(filters.get(i));
+          if (i < filters.size() - 1) {
+            sb.append(" AND ");
+          }
+        }
+      }

Review Comment:
   Cleanedup. Now it's a single loop



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

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

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


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

Reply via email to