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

Signed-off-by: shuming.li <ming.moriarty@gmail.com>
Co-authored-by: shuming.li <ming.moriarty@gmail.com>
This commit is contained in:
mergify[bot] 2025-10-09 22:10:37 +08:00 committed by GitHub
parent 6d8f208910
commit 0652d618ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -312,7 +312,7 @@ 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));
}
@ -334,7 +334,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();
@ -348,7 +348,7 @@ public class MVPartitionExprResolver {
public Exprs visitTable(TableRelation node, MVExprContext context) {
SlotRef slot = context.getSlotRef();
TableName tableName = slot.getTblNameWithoutAnalyzed();
if (node.getName().equals(tableName)) {
if (node.getName() != null && node.getName().equals(tableName)) {
return Exprs.of(slot);
}
if (tableName != null && !node.getResolveTableName().equals(tableName)) {
@ -515,7 +515,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();