You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/09/27 00:57:38 UTC
[GitHub] [doris] weizhengte commented on a diff in pull request #8864: [feature-wip](statistics) step6: statistics is available
weizhengte commented on code in PR #8864:
URL: https://github.com/apache/doris/pull/8864#discussion_r980631453
##########
fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStats.java:
##########
@@ -72,16 +75,94 @@ public class ColumnStats {
private float avgSize = -1; // in bytes
private long maxSize = -1; // in bytes
private long numNulls = -1;
- private LiteralExpr minValue;
- private LiteralExpr maxValue;
-
- public static ColumnStats createDefaultColumnStats() {
- ColumnStats columnStats = new ColumnStats();
- columnStats.setAvgSize(1);
- columnStats.setMaxSize(1);
- columnStats.setNdv(1);
- columnStats.setNumNulls(0);
- return columnStats;
+
+ private LiteralExpr minValue = new NullLiteral();
+ private LiteralExpr maxValue = new NullLiteral();
+
+ /**
+ * Return default column statistic.
+ */
+ public static ColumnStats getDefaultColumnStats() {
+ return new ColumnStats();
+ }
+
+ /**
+ * Merge column statistics(the original statistics should not be modified)
+ *
+ * @param left statistics to be merged
+ * @param right statistics to be merged
+ */
+ public static ColumnStats aggColumnStats(ColumnStats left, ColumnStats right) {
Review Comment:
ok
##########
fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsJobManager.java:
##########
@@ -80,16 +80,24 @@ public Map<Long, StatisticsJob> getIdToStatisticsJob() {
}
public void createStatisticsJob(AnalyzeStmt analyzeStmt) throws UserException {
- // step1: init statistics job by analyzeStmt
- StatisticsJob statisticsJob = StatisticsJob.fromAnalyzeStmt(analyzeStmt);
- writeLock();
- try {
- // step2: check restrict
- checkRestrict(analyzeStmt.getDbId(), statisticsJob.getTblIds());
- // step3: create it
- createStatisticsJob(statisticsJob);
- } finally {
- writeUnlock();
+ // The current statistics are only used for CBO test,
+ // and are not available to users. (work in progress)
+ // TODO(wzt): Further tests are needed
+ if (Config.enable_cbo_statistics) {
Review Comment:
sure
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org