From 23e5b36a776a10c76ac46b53baeaee7727918b13 Mon Sep 17 00:00:00 2001 From: Smith Cruise Date: Fri, 10 Mar 2023 18:03:53 +0800 Subject: [PATCH] [Enhancement] Improve log message in PruneComplexTypeUtil Signed-off-by: Smith Cruise (cherry picked from commit ac3b2bccfe2601d65318f1f6276c16ad9b3f476f) --- .../optimizer/rule/tree/PruneComplexTypeUtil.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/tree/PruneComplexTypeUtil.java b/fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/tree/PruneComplexTypeUtil.java index 3fdc2f931fa9a..cd19ef55ebde2 100644 --- a/fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/tree/PruneComplexTypeUtil.java +++ b/fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/tree/PruneComplexTypeUtil.java @@ -30,7 +30,8 @@ import com.starrocks.sql.optimizer.operator.scalar.ScalarOperator; import com.starrocks.sql.optimizer.operator.scalar.ScalarOperatorVisitor; import com.starrocks.sql.optimizer.operator.scalar.SubfieldOperator; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.util.Deque; import java.util.HashMap; @@ -39,7 +40,7 @@ import java.util.Map; public class PruneComplexTypeUtil { - private static final Logger LOGGER = Logger.getLogger(PruneComplexTypeUtil.class); + private static final Logger LOG = LogManager.getLogger(PruneComplexTypeUtil.class); // For example, we have a column col: MAP>> // And we have a sql: SELECT map_values(col).b.d, map_keys(col) from TABLE; @@ -117,8 +118,13 @@ private boolean checkCanPrune(ColumnRefOperator columnRefOperator, ScalarOperato return true; } + if (!columnRefOperator.getType().isComplexType() && !scalarOperator.getType().isComplexType()) { + // If columnRefOperator and scalarOperator both are not complex type, don't need to check + return true; + } + if (!columnRefOperator.getType().equals(scalarOperator.getType())) { - LOGGER.warn("ColumnRefOperator and ScalarOperator should has the same type."); + LOG.warn("Complex type columnRefOperator and scalarOperator should has the same type."); return false; } return true;