fix: colDataKeepFirstNRows reset varmeta.length when all kept rows ar…#35061
fix: colDataKeepFirstNRows reset varmeta.length when all kept rows ar…#35061guanshengliang merged 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a variable-length column trimming edge case in blockDataKeepFirstNRows/colDataKeepFirstNRows where keeping only NULL rows could leave varmeta.length stale, and adds a regression test to cover LIMIT/OFFSET scenarios that exercise that path.
Changes:
- Reset
SColumnInfoData::varmeta.lengthto0when the kept range contains no non-NULL var-length values. - Add a Python system test covering LIMIT and LIMIT+OFFSET on tables where the first N var-length values are all NULL.
- Clarify/adjust
numeric_limits<intx::uint<N>>::digits10computation documentation and constant precision.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
source/common/src/tdatablock.c |
Resets varmeta.length to 0 when all kept var-length rows are NULL to avoid stale length usage after LIMIT trimming. |
test/cases/01-DataTypes/test_null_column.py |
Adds regression coverage for LIMIT/LIMIT+OFFSET on var-length columns with leading NULLs. |
source/libs/decimal/src/detail/intx/int128.hpp |
Documents digits10 derivation and uses a more precise log10(2) constant in the constexpr calculation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request addresses an issue where variable-length columns could retain stale length values when all rows in a data block are NULL following a LIMIT operation. It ensures varmeta.length is reset to 0 in such cases and replaces a fatal error with a debug log. Additionally, the precision of the digits10 constant in the decimal library was improved, and a new regression test was added. Review feedback suggests refining the condition check for NULL offsets and verifying format specifiers in logging to prevent potential sign-mismatch issues.
…e NULL
Description
Issue(s)
Checklist
Please check the items in the checklist if applicable.