github-actions[bot] commented on code in PR #66530:
URL: https://github.com/apache/doris/pull/66530#discussion_r3819795139


##########
fe/fe-connector/fe-connector-hive/src/main/java/org/apache/doris/connector/hive/HiveScanPlanProvider.java:
##########
@@ -131,6 +134,33 @@ public boolean usesHiveParquetInt96TimeZone() {
 
     @Override
     public List<ConnectorScanRange> planScan(ConnectorSession session, 
ConnectorScanRequest request) {
+        HiveTableHandle hiveHandle = (HiveTableHandle) 
request.getTableHandle();
+        if (!isExternalScanTaskReuseEnabled(session)) {
+            return doPlanScan(session, request);
+        }
+        if (hiveHandle.isTransactional()) {
+            // ACID / INSERT_ONLY reads open a per-scan read transaction with 
a write-id snapshot and
+            // a shared metastore lock; reusing the planned ranges would skip 
that transaction.
+            return doPlanScan(session, request);
+        }
+        // Statement-scoped reuse: within one statement the identical scan 
(same table, same
+        // partition set, same formats) plans once and every duplicated 
relation shares the result.
+        // The scope is NONE for offline planning and tests, in which case the 
loader runs on every
+        // call. Session variables are constant within a statement and 
deliberately absent.
+        String memoKey = "hive.scan-reuse:" + session.getCatalogId() + ":" + 
session.getQueryId();

Review Comment:
   **[P2] Keep scan memos under the connector namespace guards**
   
   This adds a value to the shared, untyped statement scope under an inline 
`hive.scan-reuse:*` key. Connector policy requires every such namespace to be a 
`*_NAMESPACE` constant prefixed by `ConnectorProvider.getType()` and covered by 
the reflection guard; Hive's provider type is `hms`, not `hive`, and an inline 
literal is invisible to that guard. A future `hive.*` owner can therefore 
collide here and return an incompatible typed value without any prefix test 
failing. The Hudi, Iceberg, and Paimon scan-reuse literals likewise evade the 
constant-and-test guard pattern. Please define connector-owned `*_NAMESPACE` 
constants (`hms.scan-reuse` here) and extend or add the prefix tests for all 
four.



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