[Fix](Nereids) fix nereids fold failed by be return null exception (#19013)
```sql
select if(
date_format(CONCAT_WS('', '9999-07', '-26'), '%Y-%m') = DATE_FORMAT(curdate(), '%Y-%m'),
curdate(),
DATE_FORMAT(DATE_SUB(month_ceil(CONCAT_WS('', '9999-07', '-26')), 1), '%Y-%m-%d')
)
```
return null when construct new children of if(), we find that the the more than "0" index in result map doesn't replace the const map caused by incorrect value-assignment in code.
This commit is contained in:
@ -192,9 +192,9 @@ public class FoldConstantRuleOnBE extends AbstractExpressionRewriteRule {
|
||||
DataType t1 = DataType.convertFromString(staleExpr.getType().getPrimitiveType().toString());
|
||||
ret = Literal.of(staleExpr.getStringValue()).castTo(t1);
|
||||
} else {
|
||||
ret = constMap.get(e.getKey());
|
||||
ret = constMap.get(e1.getKey());
|
||||
}
|
||||
resultMap.put(e.getKey(), ret);
|
||||
resultMap.put(e1.getKey(), ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user