LuciferYang opened a new issue, #11399:
URL: https://github.com/apache/paimon/issues/11399

   **Search before asking**
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   **Paimon version**
   master @ 6a9e258775
   
   **Compute Engine**
   Spark 4.2.1 and 4.3.0. Spark 4.1 is not affected.
   
   **Minimal reproduce step**
   On an append table without a primary key (V2 write is the default):
   
   ```sql
   CREATE TABLE t (id INT, v VARCHAR(4), b INT);
   INSERT INTO t VALUES (1, 'a', 10);
   UPDATE t SET b = 0 WHERE id = 1;
   ```
   
   The UPDATE fails with `Max iterations (100) reached for batch Resolution, 
please set 'spark.sql.analyzer.maxIterations' to a larger value.` The VARCHAR 
column does not need to be assigned. MERGE INTO with an UPDATE or INSERT action 
fails the same way, including an insert-only MERGE; a MERGE with only DELETE 
actions works. An unaware-bucket (`'bucket' = '-1'`) deletion-vector append 
table fails the same way.
   
   **What doesn't meet your expectations?**
   These statements should run, as they do on Spark 4.1 and on tables without a 
VARCHAR column.
   
   **Anything else?**
   `Spark42RowLevelCommandRewrite` aligns the assignments itself and hands the 
command to Spark's `RewriteUpdateTable` or `RewriteMergeIntoTable`, which 
rewrite only aligned commands. `AssignmentUtils.aligned` compares each value's 
type with the VARCHAR type kept in the target attribute's metadata, so the 
command never counts as aligned. The rule then matches the command again in the 
next iteration and wraps one more length check around each VARCHAR value, so 
the plan keeps changing until the batch gives up. Spark's own 
`ResolveRowLevelCommandAssignments` drops that metadata from the target after 
aligning, but it skips Paimon tables because they accept any schema.
   
   The shared `MergeIntoTableTestBase` has a "merge into with varchar" case 
that catches this, but the Spark 4.2 module, which the 4.3 module builds from, 
has no MERGE or UPDATE suite, so the spark42 and spark43 lanes never run it.
   
   **Are you willing to submit a PR?**
   - [x] I'm willing to submit a PR!
   


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