morningman commented on code in PR #70903:
URL: https://github.com/apache/doris/pull/70903#discussion_r4674590376


##########
fe/fe-connector/fe-connector-lance/src/main/java/org/apache/doris/connector/lance/LanceStatementScope.java:
##########
@@ -58,6 +60,16 @@ static LanceTableMetadata sharedMetadata(ConnectorSession 
session, LanceTableHan
         return metadata;
     }
 
+    /**
+     * The metadata of the dataset {@code handle} names, at its pinned 
version: read when the table function
+     * resolves the handle, and again by the scan only when the statement 
keeps no memo.
+     */
+    static LanceTableMetadata sharedFileMetadata(ConnectorSession session, 
LanceFileTableHandle handle,
+            Supplier<LanceTableMetadata> loader) {
+        return ConnectorStatementScopes.resolveInStatement(session, 
FILE_METADATA_NAMESPACE, "",
+                handle.getUri() + "@" + handle.getVersion(), loader);

Review Comment:
   Fixed in cc88d510b8c. Each `LanceFileTableHandle` now carries a resolution 
number that no other handle has, and `sharedFileMetadata` keys the memo by 
`uri@version#resolution`: the memo is kept per resolved handle, not per uri and 
version. A uri names no endpoint (`s3()` keeps `s3://bucket/key` and maps HTTP 
URLs to it), so the old key could not tell two stores apart.
   
   I did not put the storage binding into the key. It would bring credentials, 
even hashed, into it, and a partial choice of the options that name a store 
(endpoint, region, path style) would bring the collision back. It would also 
spare no read: every table function reads its dataset when `getFileTableHandle` 
resolves its handle, and the memo only spares that handle's scan a second read.
   
   Test: 
`LanceScanPlanProviderTest.fileTableFunctionsOfOneUriOnTwoEndpointsCountTheirOwnDatasets`
 plans `COUNT(*)` for two handles on one uri at one version with two endpoints, 
1 row and 2 rows. On 517a285442a it fails with `expected: <2> but was: <1>`; on 
cc88d510b8c it passes, as do the plugin's other 264 tests.



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