morningman opened a new issue #7854:
URL: https://github.com/apache/incubator-doris/issues/7854


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### Version
   
   0.15
   
   ### What's Wrong?
   
   BE crash with assertion failure:
   `index size is larger than char size, index=10 , char=4` at 
`encode_ascending()` of `be/src/olap/key_coder.h`
   
   ### What You Expected?
   
   works well
   
   ### How to Reproduce?
   
   This happens when writing short key index. And the column is defined as 
`char(10)`, but the value is only 4 bytes long.
   So make the assertion failed.
   Still don't know why, a tmp solution is:
   
   ```
   -        CHECK(index_size <= slice->size)
   -                << "index size is larger than char size, index=" << 
index_size
   -                << ", char=" << slice->size;
   -        buf->append(slice->data, index_size);
   +        if (index_size > slice->size) {
   +            LOG(WARNING) << "index size is larger than char size, index=" 
<< index_size
   +                << ", char=" << slice->size << ", slice: #" << 
slice->to_string() << "#";
   +            char new_buf[index_size];
   +            memset(new_buf, 0, sizeof(new_buf));
   +            memcpy(new_buf, slice->data, slice->size);
   +            buf->append(new_buf, index_size);
   +        } else {
   +            buf->append(slice->data, index_size);
   +        }
        }
   ```
   
   Not sure if it has side affect.
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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