xiangfu0 commented on code in PR #20183:
URL: https://github.com/apache/pinot/pull/20183#discussion_r4517477605


##########
pinot-core/src/main/java/org/apache/pinot/core/query/executor/ServerQueryExecutorV1Impl.java:
##########
@@ -292,6 +303,15 @@ private InstanceResponseBlock 
executeInternal(ServerQueryRequest queryRequest, E
 
     InstanceResponseBlock instanceResponse = null;
     try {
+      if (queryContext.getRowFilterExpression() != null && executionInfo 
instanceof SingleTableExecutionInfo
+          && 
!QueryOptionsUtils.isUseMultistageEngine(queryContext.getQueryOptions())) {
+        // SSE brokers apply physical table overrides to WHERE. Resolve the 
same map locally for the independent
+        // RLS policy, including requests from an older broker. MSE does not 
apply these table overrides to WHERE.
+        TableConfig tableConfig = ((SingleTableExecutionInfo) 
executionInfo).getTableDataManager()
+            .getCachedTableConfigAndSchema().getLeft();
+        queryContext.setRowFilterExpressionOverrideMap(
+            TableCache.createExpressionOverrideMap(tableNameWithType, 
tableConfig.getQueryConfig()));

Review Comment:
   Non-blocking: this re-parses every override with Calcite on each SSE request 
that carries an RLS policy, while the broker caches the map in `TableCache`. 
Locally that came to about 115 µs per request for 3 overrides (about 19 µs per 
expression, stable after warmup). That's small but not free on millisecond 
queries. Could the map be cached per table config, for example next to 
`getCachedTableConfigAndSchema()`?



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

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to