morrySnow commented on code in PR #21559:
URL: https://github.com/apache/doris/pull/21559#discussion_r1255931152
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java:
##########
@@ -486,8 +498,18 @@ public static Expression
processIntegralDivide(IntegralDivide divide, Expression
left = castIfNotSameType(left, t1);
right = castIfNotSameType(right, t2);
- Expression newLeft = TypeCoercionUtils.castIfNotSameType(left,
BigIntType.INSTANCE);
- Expression newRight = TypeCoercionUtils.castIfNotSameType(right,
BigIntType.INSTANCE);
+ DataType commonType = BigIntType.INSTANCE;
+ if (!t1.isStringLikeType() && !t2.isStringLikeType() &&
!t1.isDecimalLikeType() && !t2.isDecimalLikeType()) {
+ for (DataType dataType : TypeCoercionUtils.INTEGER_PRECEDENCE) {
+ if (t1.equals(dataType) || t2.equals(dataType)) {
+ commonType = dataType;
+ break;
+ }
+ }
+ }
Review Comment:
```suggestion
if (t1.isIntegralType() && t2.isIntegralType()) {
for (DataType dataType : TypeCoercionUtils.NUMERIC_PRECEDENCE) {
if (t1.equals(dataType) || t2.equals(dataType)) {
commonType = dataType;
break;
}
}
}
```
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/mv/AbstractSelectMaterializedIndexRule.java:
##########
@@ -98,12 +99,12 @@ protected boolean containAllRequiredColumns(
OlapTable table = scan.getTable();
Set<String> requiredMvColumnNames = requiredScanOutput.stream()
- .map(s ->
normalizeName(Column.getNameWithoutMvPrefix(s.getName())))
- .collect(Collectors.toSet());
+ .map(s ->
normalizeName(Column.getNameWithoutMvPrefix(s.getName())))
+ .collect(Collectors.toCollection(() -> new
TreeSet<String>(String.CASE_INSENSITIVE_ORDER)));
Set<String> mvColNames = table.getSchemaByIndexId(index.getId(),
true).stream()
.map(c ->
normalizeName(parseMvColumnToSql(c.getNameWithoutMvPrefix())))
- .collect(Collectors.toSet());
+ .collect(Collectors.toCollection(() -> new
TreeSet<String>(String.CASE_INSENSITIVE_ORDER)));
Review Comment:
i think we should refactor this code later, use nereids struct to present
mv's column to avoid string compare
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java:
##########
@@ -172,6 +172,10 @@ public ColumnStatistic visitSlotReference(SlotReference
slotReference, Statistic
public ColumnStatistic visitBinaryArithmetic(BinaryArithmetic
binaryArithmetic, Statistics context) {
ColumnStatistic leftColStats = binaryArithmetic.left().accept(this,
context);
ColumnStatistic rightColStats = binaryArithmetic.right().accept(this,
context);
+ if (leftColStats == null || rightColStats == null) {
+ return ColumnStatistic.UNKNOWN;
+ }
Review Comment:
why add this? this is not a right way. we should check why `leftColStats ==
null || leftColStats == null`, and let them return right value @englefly
@Kikyou1997 please help to check it
--
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]