[BugFix] Fix create partitioned mv with NullPointerException (#63830)

Signed-off-by: shuming.li <ming.moriarty@gmail.com>
This commit is contained in:
shuming.li 2025-10-09 16:55:37 +08:00 committed by GitHub
parent bd3b311d7b
commit 128aabc9aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -315,7 +315,8 @@ public class MVPartitionExprResolver {
if (item instanceof SlotRef) {
SlotRef result = (SlotRef) item;
TableName actTableName = result.getTblNameWithoutAnalyzed();
if (result.getColumnName().equalsIgnoreCase(slot.getColumnName())
if (result.getColumnName() != null
&& result.getColumnName().equalsIgnoreCase(slot.getColumnName())
&& (expTableName == null || expTableName.equals(actTableName))) {
return visitExpr(context.withExpr(result).withRelation(relation));
}
@ -337,7 +338,7 @@ public class MVPartitionExprResolver {
SlotRef slot = context.getSlotRef();
if (slot.getTblNameWithoutAnalyzed() != null) {
String tableName = slot.getTblNameWithoutAnalyzed().getTbl();
if (!node.getAlias().getTbl().equalsIgnoreCase(tableName)) {
if (node.getAlias() != null && !node.getAlias().getTbl().equalsIgnoreCase(tableName)) {
return null;
}
slot = (SlotRef) slot.clone();
@ -518,7 +519,7 @@ public class MVPartitionExprResolver {
if (slot.getTblNameWithoutAnalyzed() != null) {
String tableName = slot.getTblNameWithoutAnalyzed().getTbl();
String cteName = node.getAlias() != null ? node.getAlias().getTbl() : node.getName();
if (!cteName.equalsIgnoreCase(tableName)) {
if (cteName != null && !cteName.equalsIgnoreCase(tableName)) {
return null;
}
slot = (SlotRef) slot.clone();