morrySnow commented on code in PR #40654: URL: https://github.com/apache/doris/pull/40654#discussion_r1766117795
########## fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java: ########## @@ -46,20 +46,18 @@ public class ColumnStatistic { private static final Logger LOG = LogManager.getLogger(ColumnStatistic.class); - public static ColumnStatistic UNKNOWN = new ColumnStatisticBuilder().setAvgSizeByte(1).setNdv(1) - .setNumNulls(1).setCount(1).setMaxValue(Double.POSITIVE_INFINITY).setMinValue(Double.NEGATIVE_INFINITY) + public static ColumnStatistic UNKNOWN = new ColumnStatisticBuilder(1).setAvgSizeByte(1).setNdv(1) + .setNumNulls(1).setMaxValue(Double.POSITIVE_INFINITY).setMinValue(Double.NEGATIVE_INFINITY) .setIsUnknown(true).setUpdatedTime("") .build(); - public static ColumnStatistic ZERO = new ColumnStatisticBuilder().setAvgSizeByte(0).setNdv(0) - .setNumNulls(0).setCount(0).setMaxValue(Double.NaN).setMinValue(Double.NaN) - .build(); - public static final Set<Type> UNSUPPORTED_TYPE = Sets.newHashSet( Type.HLL, Type.BITMAP, Type.ARRAY, Type.STRUCT, Type.MAP, Type.QUANTILE_STATE, Type.JSONB, Type.VARIANT, Type.TIME, Type.TIMEV2, Type.LAMBDA_FUNCTION ); + // ATTENTION: Stats deriving WILL NOT use 'count' field any longer. + // Use 'rowCount' field in Statistics if needed. Review Comment: nit: if we don't use this field anymore, should we just remove it? remove field do not break metadata ########## fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java: ########## @@ -274,13 +274,13 @@ public ColumnStatistic visitBinaryArithmetic(BinaryArithmetic binaryArithmetic, int exprResultTypeWidth = binaryArithmetic.getDataType().width(); double dataSize = exprResultTypeWidth * rowCount; if (binaryArithmetic instanceof Add) { - return new ColumnStatisticBuilder().setCount(rowCount).setNdv(ndv).setAvgSizeByte(leftColStats.avgSizeByte) Review Comment: why not set count? count will be 0? ########## fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticBuilder.java: ########## @@ -56,9 +56,24 @@ public ColumnStatisticBuilder(ColumnStatistic columnStatistic) { this.updatedTime = columnStatistic.updatedTime; } - public ColumnStatisticBuilder setCount(double count) { + // ATTENTION: DON'T USE FOLLOWING TWO DURING STATS DERIVING EXCEPT FOR INITIALIZATION + public ColumnStatisticBuilder(double count) { Review Comment: if count in ColumnStatistic is not used anymore, why still have a ctor with count? need count to compute datasize? -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org