github-actions[bot] commented on code in PR #69271:
URL: https://github.com/apache/doris/pull/69271#discussion_r4332437423


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java:
##########
@@ -1533,28 +1547,13 @@ private static Expression 
processComparisonPredicateInternal(ComparisonPredicate
         left = comparisonPredicate.left();
         right = comparisonPredicate.right();
 
-        if (isJoinCondition && comparisonPredicate instanceof EqualPredicate
-                && isTimeStampNsAndJoinCompatibleTemporalPair(
-                        left.getDataType(), right.getDataType())) {
-            left = strictCastIfNotSameType(left, TimeStampNsType.INSTANCE);
-            right = strictCastIfNotSameType(right, TimeStampNsType.INSTANCE);
-            return comparisonPredicate.withChildren(left, right);
-        }
-
         boolean timeStampNsDateLikePair = isTimeStampNsAndDateLikePair(
                 left.getDataType(), right.getDataType());
         Optional<DataType> commonType;
         if (timeStampNsDateLikePair) {
-            commonType = findExactCommonTypeForTimeStampNsAndDateLike(
-                    ImmutableList.of(left, right));
-            // The BE comparison kernel compares TIMESTAMP_NS and DATETIMEV2 
exactly. Date-like
-            // peers with no exact common type can first be widened losslessly 
to DATETIMEV2.
-            if (!commonType.isPresent()) {
-                Optional<Expression> normalized = 
normalizeTimeStampNsDateLikeComparison(comparisonPredicate);
-                if (normalized.isPresent()) {
-                    return normalized.get();
-                }
-            }
+            // Storage predicates require the constant and column to share a 
representation.
+            // Always promote the temporal peer, preserving nanoseconds and 
failing on overflow.
+            commonType = Optional.of(TimeStampNsType.INSTANCE);

Review Comment:
   [P2] Exclude the mock build row from strict ASOF key evaluation
   
   For `l ASOF INNER JOIN r MATCH_CONDITION(l.ts >= years_sub(r.dt, 400)) ON 
l.k = r.k`, let `l.ts` be 2024 and `r.dt` be a NOT NULL DATETIMEV2 value in 
2200. The reduced match condition is `l.ts >= strict CAST(years_sub(r.dt, 400) 
AS TIMESTAMP_NS)`, so every real build key is in range (1800). However, 
`HashJoinBuildSinkOperatorX::sink_impl` prepends a default row (`r.dt = 1970`), 
and `build_asof_index` executes this expression over the entire block. That 
synthetic key becomes 1570 and the strict cast returns `TIMESTAMP_NS overflow 
... row 0`, rejecting a valid join. INNER joins do not null the mock row as 
LEFT OUTER joins do. Please evaluate the ASOF key only on real build rows, or 
materialize it before inserting the sentinel, and cover a NOT NULL derived 
match key.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/Literal.java:
##########
@@ -260,6 +270,10 @@ protected Expression getDecimalLiteral(BigDecimal 
bigDecimal, DataType targetTyp
         }
     }
 
+    protected Expression uncheckedCastTo(DataType targetType, boolean 
strictCast) throws AnalysisException {
+        return uncheckedCastTo(targetType);

Review Comment:
   [P2] Carry effective strictness into scalar literal parsers
   
   This overload drops `strictCast` when dispatching to `StringLikeLiteral`, 
whose one-argument method reads `enable_strict_cast` again. With 
`enable_strict_cast=false` and `enable_new_type_coercion_behavior=false`, 
`array_concat([{1,datev2 '2024-01-01','2024!01!01'}], 
array(struct(1,cast('2024-01-01' as timestamp_ns),cast('2024-01-01' as 
timestamp_ns))))` gives the left literal a strict 
`ARRAY<STRUCT<...,TIMESTAMP_NS,TIMESTAMP_NS>>` cast because its DATEV2 field 
converts to TIMESTAMP_NS. FE folding still accepts the string field through its 
loose date grammar, whereas the same strict cast on BE rejects the `!` 
separators. Moving that source array into a typed column therefore changes 
success into an error. Please forward the effective flag into the scalar 
parsing methods, or retain the cast for BE execution, and cover this mixed-leaf 
case.



-- 
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]

Reply via email to