diff --git a/fe/fe-core/src/main/java/com/starrocks/connector/kudu/KuduPredicateConverter.java b/fe/fe-core/src/main/java/com/starrocks/connector/kudu/KuduPredicateConverter.java index 6b185a2b3abe0..3ead338293a10 100644 --- a/fe/fe-core/src/main/java/com/starrocks/connector/kudu/KuduPredicateConverter.java +++ b/fe/fe-core/src/main/java/com/starrocks/connector/kudu/KuduPredicateConverter.java @@ -16,6 +16,8 @@ import com.google.common.collect.Lists; import com.starrocks.analysis.BinaryType; +import com.starrocks.catalog.Type; +import com.starrocks.connector.ColumnTypeConverter; import com.starrocks.sql.optimizer.operator.scalar.BinaryPredicateOperator; import com.starrocks.sql.optimizer.operator.scalar.CastOperator; import com.starrocks.sql.optimizer.operator.scalar.ColumnRefOperator; @@ -103,7 +105,10 @@ public List visitBinaryPredicate(BinaryPredicateOperator operator if (columnName == null) { return Lists.newArrayList(); } - Object literal = getLiteral(operator.getChild(1)); + ColumnSchema column = schema.getColumn(columnName); + Type targetType = ColumnTypeConverter.fromKuduType(column); + Optional casted = ((ConstantOperator) (operator.getChild(1))).castTo(targetType); + Object literal = getLiteral(casted.isPresent() ? casted.get() : operator.getChild(1)); if (literal == null) { return Lists.newArrayList(); } @@ -137,10 +142,15 @@ public List visitInPredicate(InPredicateOperator operator, Void c if (columnName == null) { return Lists.newArrayList(); } + ColumnSchema column = schema.getColumn(columnName); + Type targetType = ColumnTypeConverter.fromKuduType(column); + List valuesOperatorList = operator.getListChildren(); + List> casted = + valuesOperatorList.stream().map(x -> ((ConstantOperator) x).castTo(targetType)).collect(Collectors.toList()); List literalValues = new ArrayList<>(valuesOperatorList.size()); - for (ScalarOperator valueOperator : valuesOperatorList) { - Object literal = getLiteral(valueOperator); + for (int i = 0; i < valuesOperatorList.size(); i++) { + Object literal = getLiteral(casted.get(i).isPresent() ? casted.get(i).get() : valuesOperatorList.get(i)); if (literal == null) { return Lists.newArrayList(); }