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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/types/AggStateType.java:
##########
@@ -128,6 +142,11 @@ public boolean equals(Object o) {
         }
 
         AggStateType rhs = (AggStateType) o;
+        // A sink must not treat version 20 state bytes as version 19 bytes.
+        // Keep the cast so that the STATE producer can use the target codec.
+        if (beExecVersion != rhs.beExecVersion) {

Review Comment:
   [P2] Preserve stored-state copies across execution versions
   
   Create a table with `AGG_STATE<SUM(BIGINT NULL)>` at v19, then an equivalent 
table at v20. `INSERT INTO new_table SELECT k,s FROM old_table` now produces:
   
   ```text
   Sink[new_table.s@20]
     Project(Cast(s@19 AS state@20))
       Scan[old_table.s@19]
   ```
   
   `ConvertAggStateCast` only retargets a direct `StateCombinator`, so this 
stored-slot cast remains and `CheckCast.validate` rejects it (AGG_STATE has no 
source whitelist entry). Nullable SUM uses the same published flag-plus-Int64 
bytes at both versions, so previously valid copy jobs fail after upgrade. Keep 
version-aware identity, but add a supported compatibility/conversion path for 
stored states and cover this INSERT SELECT. This is separate from the earlier 
direct-STATE sink issue, whose producer rewrite is fixed here.



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