diff --git a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java index e6636f75cf97..28ff9d6ff3da 100644 --- a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java +++ b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java @@ -85,7 +85,7 @@ private static LogicalProject constructNewProject(LogicalProject oldProject, Log RexNode newNode = newProjects.get(i); // Need to cast the result to the original type if the literal type is changed, e.g. VARCHAR literal is typed as // CHAR(STRING_LENGTH) in Calcite, but we need to cast it back to VARCHAR. - if (oldNode.getType() != newNode.getType()) { + if (!oldNode.getType().equals(newNode.getType())) { needCast = true; newNode = rexBuilder.makeCast(oldNode.getType(), newNode, true); }