suxiaogang223 commented on code in PR #67209:
URL: https://github.com/apache/doris/pull/67209#discussion_r4013154334
##########
fe/fe-connector/fe-connector-trino/src/test/java/org/apache/doris/connector/trino/TrinoPredicateConverterTest.java:
##########
@@ -162,6 +163,36 @@ public void testVarcharEqEncodesAsSlice() {
CONVERTER.convert(cmp));
}
+ @Test
+ public void testVarcharDatetimeComparisonDegradesToAll() {
+ // CAST(c_str AS DATETIME) >= TIMESTAMP '2026-08-24 00:00:00' reaches
this converter as
+ // c_str >= <DATETIME literal> because fe-core unwraps CastExpr.
Encoding the datetime as a
Review Comment:
Fixed in ef023941ae6. The authoritative
ConnectorPushdownOps.supportsCastPredicatePushdown Javadoc now lists the Trino
bridge among connectors returning false and explicitly states that the gate
covers CAST subclasses such as TRY_CAST. The direct TrinoPredicateConverter
test comment now describes its role as defense in depth instead of claiming
ordinary CAST reaches it through PluginDrivenScanNode.
##########
fe/fe-connector/fe-connector-trino/src/main/java/org/apache/doris/connector/trino/TrinoConnectorDorisMetadata.java:
##########
@@ -252,66 +249,22 @@ public Map<String, ConnectorColumnHandle>
getColumnHandles(
}
/**
- * The trino-connector bridge accepts CAST-bearing predicates ({@code
true}, the SPI default, stated here
- * rather than inherited).
- *
- * <p>This is a conscious acceptance of the risk the SPI documents, not a
claim of safety: the residual
- * predicate becomes a trino {@code Constraint} and is handed to the
embedded trino connector's own
- * {@code applyFilter}, which may turn it into source-side filtering with
that system's coercion rules. It
- * stays {@code true} because the bridge cannot tell which embedded
connector will do so, and dropping all
- * CAST-bearing conjuncts would silently de-optimize every trino
catalog.</p>
+ * CAST nodes are erased at the Doris connector-expression boundary, so
the bridge cannot prove that a
+ * domain over the raw Trino column preserves the casted Doris comparison.
Keep those predicates local.
*/
@Override
public boolean supportsCastPredicatePushdown(ConnectorSession session) {
- return true;
+ return false;
}
Review Comment:
Fixed in ef023941ae6. PluginDrivenScanNode.containsCastExpr now uses
predicate-based traversal with instanceof CastExpr instead of
TreeNode.collect(Class, ...), so TryCastExpr and future CastExpr subclasses are
detected even when nested under IS NULL or null-safe equality.
PluginDrivenScanNodeLimitStripTest covers nested TryCastExpr detection, and the
Trino Hive q34 regression now uses malformed k2 strings with both TRY_CAST(k2
AS INT) IS NULL and TRY_CAST(k2 AS INT) <=> NULL while preserving the existing
ordered output.
--
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]