wenzhenghu commented on code in PR #64035:
URL: https://github.com/apache/doris/pull/64035#discussion_r3348961500
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/StatementContext.java:
##########
@@ -992,6 +1045,172 @@ public void setSnapshot(MvccTableInfo mvccTableInfo,
MvccSnapshot snapshot) {
snapshots.put(mvccTableInfo, snapshot);
}
+ private Optional<String> getExternalMetadataPreloadSkipReason() {
+ if (connectContext == null || connectContext.getSessionVariable() ==
null
+ ||
!connectContext.getSessionVariable().isEnablePreloadExternalMetadata()) {
+ return Optional.of("session variable
enable_preload_external_metadata is disabled");
+ }
+ if (externalTablePreloadInfos.isEmpty()) {
+ return Optional.of("no external preload candidates were
collected");
+ }
+ if (containsPlanReadLockTable(tables.values())
+ || containsPlanReadLockTable(mtmvRelatedTables.values())
+ || containsPlanReadLockTable(insertTargetTables.values())) {
+ return Optional.empty();
+ }
+ return Optional.of("no internal tables require plan-time read lock");
+ }
+
+ private boolean containsPlanReadLockTable(Collection<TableIf> tableIfs) {
+ for (TableIf tableIf : tableIfs) {
+ if (tableIf.needReadLockWhenPlan()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean supportsExternalMetadataPreload(TableIf table) {
Review Comment:
> should impl as a trait on Table class
Thank you for your excellent review! Your deep mastery of OOP design and
Doris framework helps me fix the architectural flaw of this PR.
I totally accept your suggestions: I'll refactor the judgement method as a
Table trait and decouple preload logic into a standalone Planner Rule.
--
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]