qzsee opened a new pull request, #56143:
URL: https://github.com/apache/doris/pull/56143

   
   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Related PR: #xxx
   
   Problem Summary:
   
   Doris version 3.0.6
   
   ```sql
   CREATE TABLE IF NOT EXISTS users( 
       user_id VARCHAR(32) NOT NULL,
       event_time DATETIME NOT NULL,
       type1 DECIMAL NOT NULL,
       type2 DECIMAL NOT NULL,
       val1 STRING NOT NULL,
       val2 STRING NOT NULL, 
       val3 BIGINT NOT NULL
   ) ENGINE=OLAP
   UNIQUE KEY(user_id, event_time, type1, type2)
   AUTO PARTITION BY RANGE(DATE_TRUNC(event_time, 'hour')) ()
   DISTRIBUTED BY HASH(user_id) BUCKETS 1
   ROLLUP ( rlp_spacetime_collision(event_time, user_id, type1, type2) )
   PROPERTIES (
      "replication_allocation" = "tag.location.default: 1",
      "function_column.sequence_col" = "event_time"
   );
   
   insert into users values(1,'2025-09-16 10:00:00',1,1,1,1,1);
   
   select * from users;
   
   [E-207]slot(id: 5, name: val2)'s nullable does not match column(tablet id: 
-1, index: 9, name: __DORIS_SEQUENCE_COL__)
   
   ```
   
   Doris versions 3.0.7 and later will not result in an error, this problem 
still exists.
   
   The reasons are as follows.
   
   all `MaterializedIndexMeta` shared one `sequenceCol`
   
   ```java
   
   public void setSequenceInfo(Type type, Column refColumn) {
           this.hasSequenceCol = true;
           this.sequenceType = type;
   
           Column sequenceCol;
           if (getEnableUniqueKeyMergeOnWrite()) {
               // sequence column is value column with NONE aggregate type for
               // unique key table with merge on write
               sequenceCol = ColumnDef.newSequenceColumnDef(type, 
AggregateType.NONE).toColumn();
           } else {
               // sequence column is value column with REPLACE aggregate type 
for
               // unique key table
               sequenceCol = ColumnDef.newSequenceColumnDef(type, 
AggregateType.REPLACE).toColumn();
           }
           if (refColumn != null) {
               sequenceCol.setDefaultValueInfo(refColumn);
           }
           // add sequence column at last
           fullSchema.add(sequenceCol);
           nameToColumn.put(Column.SEQUENCE_COL, sequenceCol);
           for (MaterializedIndexMeta indexMeta : indexIdToMeta.values()) {
               List<Column> schema = indexMeta.getSchema();
               schema.add(sequenceCol);
           }
       }
   
   ```
   
   when init column `uniqueId`, base index sequence column unique id override 
roullup index sequence column `uniqueId `
   ```java
       public void initSchemaColumnUniqueId() {
           maxColUniqueId = Column.COLUMN_UNIQUE_ID_INIT_VALUE;
           this.schema.forEach(column -> {
               column.setUniqueId(incAndGetMaxColUniqueId());
               if (LOG.isDebugEnabled()) {
                   LOG.debug("indexId: {},  column:{}, uniqueId:{}",
                           indexId, column, column.getUniqueId());
               }
           });
       }
   
   ```
   
   then BE  will make an incorrect judgment.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [ ] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [ ] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


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