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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java:
##########
@@ -1322,8 +1347,9 @@ public static Expression 
processComparisonPredicate(ComparisonPredicate comparis
                 throw new AnalysisException("data type " + commonType.get()
                         + " could not used in ComparisonPredicate " + 
comparisonPredicate.toSql());
             }
-            left = castIfNotSameType(left, commonType.get());
-            right = castIfNotSameType(right, commonType.get());
+            boolean losslessDecimalCast = comparisonPredicate instanceof 
EqualPredicate;
+            left = castComparisonOperand(left, commonType.get(), 
losslessDecimalCast);

Review Comment:
   [P1] Apply lossless coercion to cached point parameters
   
   A cached server-prepared point query never reaches this coercion on later 
executions. For a row-store MOW table with a `DECIMAL(38,0)` key 100, execute 
`WHERE k = ?` once with VARCHAR `100` to cache the plan, then again with 
VARCHAR `100.4`. `ExecuteCommand` reuses the context, `PointQueryExecutor` 
substitutes the raw string and serializes a `DECIMAL_LITERAL`, and BE's 
schema-scale decimal parser rounds it to key 100, returning a row that the 
uncached lossless predicate rejects. Validate replacement values losslessly 
before point-key serialization or invalidate/replan, and add this two-execution 
regression.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Cast.java:
##########
@@ -213,7 +226,7 @@ public static boolean castNullable(boolean srcNullable, 
DataType srcType, DataTy
     @Override
     public Cast withChildren(List<Expression> children) {
         Preconditions.checkArgument(children.size() == 1);
-        return new Cast(children, targetType, isExplicitType);
+        return new Cast(children, targetType, isExplicitType, 
losslessDecimalCast);

Review Comment:
   [P1] Preserve lossless mode in nested-column pruning rewrites
   
   This `withChildren` path now keeps the flag, but default nested-column 
pruning bypasses it. For `k DECIMAL(38,0) = s.a` with `s STRUCT<a:STRING,...>`, 
pruning rewrites the struct slot/`ElementAt`; `SlotTypeReplacer.rewriteCast` 
then rebuilds the marked scalar cast with `new Cast(newChild, newType)`, whose 
constructor resets `losslessDecimalCast` to false. A row with `k=100` and 
`s.a='100.4'` is consequently rounded and falsely matches. Preserve the 
original explicit/lossless attributes in that rewrite and add a pruning-enabled 
STRUCT/MAP/ARRAY field regression.



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