englefly commented on code in PR #69322:
URL: https://github.com/apache/doris/pull/69322#discussion_r4335692169
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/HboUtils.java:
##########
@@ -376,7 +391,27 @@ private static Optional<List<PlanStatistics>>
getFilterAdjustedInputTableStatist
*/
public static PlanStatistics
getMatchedPlanStatistics(RecentRunsPlanStatistics planStatistics,
ConnectContext connectContext) {
- PlanStatistics matchedPlanStatistics = null;
+ RecentRunsPlanStatisticsEntry entry = getMatchedEntry(planStatistics,
connectContext);
+ return entry == null ? null : entry.getPlanStatistics();
+ }
+
+ /**
+ * The matched learned entry, i.e. its plan statistics together with the
input table statistics
+ * of the run it was measured in (the read side judges an entry by those,
see
+ * {@code HboStructFreshness.ofLearnedEntry}). Null when no entry matches.
+ */
+ public static RecentRunsPlanStatisticsEntry
getMatchedEntry(RecentRunsPlanStatistics planStatistics,
+ ConnectContext connectContext) {
+ // an entry injected by HBO SET LEARNED STATISTICS carries no input
table statistics; it is a
+ // wildcard that matches by fingerprint alone. A published entry
always carries the rows of at
+ // least one scan (see InputTableStatisticsInfo#hasInputTables, the
publish path drops entries
+ // which recorded none), so an empty input list can only be a manual
injection
+ for (RecentRunsPlanStatisticsEntry injected :
planStatistics.getRecentRunsStatistics()) {
Review Comment:
手动注入learned条目的场景是测试场景,生产环境不会用手动注入learned 条目
--
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]