chovy-3012 commented on PR #13228:
URL: https://github.com/apache/seatunnel/pull/13228#issuecomment-7013132532

   Thanks @DanielLeens for the detailed review! All findings are addressed in 
b18488d942.
   
   **Issue 1 — predicate forms bypass the filter evaluator**
   
   `ifFunction` no longer gates on `BinaryExpression`: any boolean-typed 
condition is routed through `zetaSQLFilter.executeFilter`, with parentheses 
unwrapped and a single exception for a bare boolean column, which keeps the 
value path on purpose — `executeFilter`'s column branch casts the raw value 
with `(boolean)` and would NPE on null, while the value path preserves the 
documented null→false semantics.
   
   ```text
   condition → isConditionExpr(conditionExpr)?
     ├─ yes && innermost expr is not a bare Column
     │    → executeFilter (IS NULL / IN / LIKE / AND / OR / parentheses)
     └─ bare Boolean column
          → computeForValue (null condition → false branch)
   ```
   
   Covered by `testIfFunctionPredicateForms` (IS NULL in both outcome 
directions, IN, parenthesized comparison) plus 3 new E2E columns in 
`func_if.conf`.
   
   **Issue 2 — identity results corrupted or rejected by unconditional CAST**
   
   The selected value is returned unchanged when it is null or already of the 
resolved common type 
(`resultType.equals(zetaSQLType.getExpressionType(branchExpr))`); `castAs` now 
runs only when the two branch types actually differ. `IF(flag, binaryColumn, 
NULL)` returns the original payload — `testIfFunctionIdentityPreservedValues` 
asserts byte-for-byte equality for BYTES, same-reference for MAP and ARRAY, and 
exact scale for a DECIMAL branch value.
   
   **Issue 3 — decimal common type understates result precision**
   
   `getIfCommonType` now intercepts decimal combinations before `getMaxType` 
via a new IF-specific `mergeIfDecimalType`: the merged precision is max(integer 
digits) + max(scale), so DECIMAL(10,2) × DECIMAL(10,8) → DECIMAL(16,8) and 
DECIMAL(10,8) × INT → DECIMAL(18,8). An integer branch contributes its full 
digit width (TINYINT 3 / SMALLINT 5 / INT 10 / BIGINT 19) and a FLOAT/DOUBLE 
branch resolves to DOUBLE following CAST semantics. `getMaxType` itself is 
untouched, so MULTI_IF / CASE WHEN behavior is unchanged. Covered by 3 new 
`ZetaSQLTypeTest` cases plus a runtime value assertion in 
`testIfFunctionIdentityPreservedValues`.
   
   **Issue 4 — document the new semantic helpers**
   
   Kept the two helpers without javadoc to match the file's existing 
private-method style (`multiIfFunction`, `coalesceFunction` and the other 
private helpers carry none). If you consider the documentation required for 
merge, I'm happy to add it as a doc-only follow-up.
   
   **Non-blocking (per-row type inference):** acknowledged — deferring the 
planning-boundary caching as a follow-up, per your "after correctness is 
established, if practical" note.
   
   Two low-severity self-review observations were intentionally left as-is: a 
pathological literal condition degrades to the existing CASE WHEN error text, 
and the decimal×incompatible-type message lacks IF context (both match current 
dev behavior).
   
   Verification: `./mvnw test -pl seatunnel-transforms-v2` 1962/1962 (+6 new 
cases), spotless clean. Also verified on a real Zeta runtime with a jar A/B 
swap: the pre-fix jar reproduces all three defects (IS NULL/IN/parenthesized 
conditions throw `Unsupported SQL Expression`, the BYTES branch comes back as 
the identity-string bytes, the decimal merge declares DECIMAL(10,8)) and the 
fixed jar passes all 31 checks including the 11 job-level assertions. The fork 
Build for b18488d942 is running.
   


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

Reply via email to