suxiaogang223 commented on code in PR #67209:
URL: https://github.com/apache/doris/pull/67209#discussion_r3977183769
##########
fe/fe-connector/fe-connector-trino/src/main/java/org/apache/doris/connector/trino/TrinoPredicateConverter.java:
##########
@@ -305,4 +306,20 @@ private BigDecimal toBigDecimal(Object value) {
}
return new BigDecimal(String.valueOf(value));
}
+
+ private Object convertStringLiteralValue(ConnectorLiteral literal) {
+ if (literal.isNull()) {
+ return null;
Review Comment:
Fixed in 029c300aa99 by the same CAST capability gate. CAST-bearing
EQ_FOR_NULL and IS NULL/IS NOT NULL conjuncts never reach
TrinoPredicateConverter, so malformed non-null strings remain available for
Doris cast/null evaluation. The existing uncast VARCHAR null-safe equality
behavior remains covered and unchanged.
##########
fe/fe-connector/fe-connector-trino/src/main/java/org/apache/doris/connector/trino/TrinoPredicateConverter.java:
##########
@@ -305,4 +306,20 @@ private BigDecimal toBigDecimal(Object value) {
}
return new BigDecimal(String.valueOf(value));
}
+
+ private Object convertStringLiteralValue(ConnectorLiteral literal) {
+ if (literal.isNull()) {
+ return null;
+ }
+ String literalType =
literal.getType().getTypeName().toUpperCase(Locale.ROOT);
+ switch (literalType) {
+ case "CHAR":
+ case "VARCHAR":
+ case "STRING":
+ return Slices.utf8Slice((String) literal.getValue());
+ default:
+ throw new UnsupportedOperationException(
Review Comment:
Fixed in 029c300aa99. UnsupportedOperationException is now the explicit
expected ineligible-pushdown path and logs at DEBUG in both the top-level and
AND-child fallbacks. Unexpected RuntimeException failures still log WARN.
Metadata-stage Trino filtering is also deferred, so the converter is no longer
invoked twice for the same predicate.
##########
fe/fe-connector/fe-connector-trino/src/main/java/org/apache/doris/connector/trino/TrinoPredicateConverter.java:
##########
@@ -277,7 +278,7 @@ private Object convertLiteralValue(Type type,
ConnectorExpression expr) {
case "CharType":
case "VarbinaryType":
case "VarcharType":
- return Slices.utf8Slice(String.valueOf(value));
+ return convertStringLiteralValue(literal);
case "DateType": {
Review Comment:
Fixed in 029c300aa99. Trino now returns false from
supportsCastPredicatePushdown, and metadata applyFilter defers filtering until
planScan. PluginDrivenScanNode therefore removes every conjunct containing a
CastExpr before Trino conversion, independent of the raw target type. This
covers DATE-to-BIGINT, DOUBLE-to-INT, comparisons, and IN rather than trying to
infer compatibility from the erased expression. The string literal check
remains as defense in depth.
##########
fe/fe-connector/fe-connector-trino/src/main/java/org/apache/doris/connector/trino/TrinoPredicateConverter.java:
##########
@@ -305,4 +306,20 @@ private BigDecimal toBigDecimal(Object value) {
}
return new BigDecimal(String.valueOf(value));
}
+
+ private Object convertStringLiteralValue(ConnectorLiteral literal) {
+ if (literal.isNull()) {
+ return null;
+ }
+ String literalType =
literal.getType().getTypeName().toUpperCase(Locale.ROOT);
+ switch (literalType) {
+ case "CHAR":
+ case "VARCHAR":
+ case "STRING":
+ return Slices.utf8Slice((String) literal.getValue());
+ default:
+ throw new UnsupportedOperationException(
+ "Cannot convert Doris literal type " + literalType + "
to a Trino string type");
Review Comment:
Fixed in 029c300aa99 with a conservative correctness gate.
TrinoScanPlanProvider applies a source LIMIT only when the scan has no filter
at all; any retained filter, including a widened/partial TupleDomain, disables
remote LIMIT. CAST-only predicates are stripped by PluginDrivenScanNode and
also receive sourceLimit=-1 through its existing gate.
TrinoScanPlanProviderTest covers filtered versus unfiltered LIMIT behavior;
safe unfiltered LIMIT pushdown remains available.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]