L-Gryps opened a new issue, #8803:
URL: https://github.com/apache/paimon/issues/8803

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   
   ### Paimon version
   
   1.4.2
   
   ### Compute Engine
   
   Flink
   
   ### Minimal reproduce step
   
   Reproduction SQL verified with sql-client:
   1. Create table with option 'table-read.sequence-number.enabled' = 'true'
   CREATE TABLE user_role (
       id INT,
       user_id INT,
       role_id INT
   ) WITH (
       'table-read.sequence-number.enabled' = 'true'
   );
   
   2. Insert test data
   INSERT INTO user_role VALUES (1,1,2),(3,3,5),(5,2,4);
   
   3. Query audit log system table
   SELECT * FROM user_role$audit_log;
   +---------+------------------+----+---------+---------+
     | rowkind | _SEQUENCE_NUMBER | id | user_id | role_id |
     +---------+------------------+----+---------+---------+
     |      +I |                8 |  1 |       1 |       2 |
     |      +I |               10 |  3 |       3 |       5 |
     |      +I |                7 |  5 |       2 |       4 |
     +---------+------------------+----+---------+---------+
   
   4. Query base table again
   SELECT * FROM user_role;
   +----+---------+---------+
     | id | user_id | role_id |
     +----+---------+---------+
     |  8 |       1 |       1 |
     | 10 |       3 |       3 |
     |  7 |       5 |       2 |
     +----+---------+---------+
   
   You can also create a table with STRING column to trigger ClassCastException.
   
   ### What doesn't meet your expectations?
   
   ### Observed Behavior
   1. Numeric column table: base table query columns are misaligned. The value 
of `_SEQUENCE_NUMBER` leaks into the first column, all data columns shift right.
   2. Table contains STRING column: Throw ClassCastException
   `HeapLongVector cannot be cast to BytesColumnVector`
   
   ### Expected Behavior
   After querying $audit_log, querying the base table should return normal data 
without extra `_SEQUENCE_NUMBER` column, column order consistent with table 
schema.
   
   ### Root Cause
   AuditLogTable constructor directly mutates wrapped FileStoreTable's shared 
options map in-place:
   ```java
   this.wrapped.options().put(KEY_VALUE_SEQUENCE_NUMBER_ENABLED.key(), "true");
   
   ### Anything else?
   
   _No response_
   
   ### 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