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


##########
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:
   Good point, done in 419f666cd9. The server now keeps the parsed overrides in 
a cache keyed by the `TableConfig` instance, with weak keys. Each table config 
is parsed once. A refreshed config is a new object, so it gets a new entry, and 
the replaced one can be garbage collected. I kept the cache in 
`ServerQueryExecutorV1Impl` instead of next to 
`getCachedTableConfigAndSchema()`, so that the `TableDataManager` interface 
doesn't change. With a new interface method, a test that mocks 
`TableDataManager` and doesn't stub it would get `null`, which means no 
overrides, and the overrides would be skipped without an error. 
`QueryExecutorTest#testRowFilterExpressionOverrideMapIsCachedPerTableConfig` 
covers it.
   
   Thanks also for the override fix.



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