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


##########
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:
   [P1] Include the storage binding in the file metadata memo key
   
   All Lance TVFs in a statement share this format's catalog id, so two calls 
with the same `s3://bucket/t.lance` and version 1 but different `s3.endpoint` 
values hit the same entry. `getFileTableHandle` reads both datasets, but the 
second memo insertion is discarded; `getTableSchema` and `FileSource.metadata` 
then use the first dataset's schema, fragments and row count with the second 
handle's storage. For example, a `UNION ALL` of `COUNT(*)` against two MinIO 
endpoints containing 1 and 2 rows returns the first resolved count twice when 
count pushdown is enabled. Include the storage binding in the memo identity, or 
retain metadata per TVF handle, and cover two endpoints sharing a URI/version.



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