jangjangji opened a new pull request, #1426: URL: https://github.com/apache/cloudberry/pull/1426
- Add buffer.seek(0) after truncate to reset file pointer position - Add isinstance and len check before accessing item[16] to prevent IndexError - Improve robustness when processing malformed CSV log entries <!-- Thank you for your contribution to Apache Cloudberry (Incubating)! --> Fixes #ISSUE_Number ### What does this PR do? This PR fixes two issues in the `CsvFlatten` class in `gplogfilter`: 1. **Buffer pointer reset:** Added `buffer.seek(0)` after `truncate(0)` to properly reset the StringIO file pointer position. 2. **Index bounds checking:** Added validation before accessing `item[16]` to prevent `IndexError` on malformed CSV rows. --- ### Type of Change - [x] Bug fix (non-breaking change) - [ ] New feature (non-breaking change) - [ ] Breaking change (fix or feature with breaking changes) - [ ] Documentation update --- ### Test Plan - [x] Manual testing with production CSV log files - [x] Verified `gplogfilter` correctly filters CSV logs with time range and pattern matching - [ ] Unit tests added/updated - [ ] Integration tests added/updated - [ ] Passed `make installcheck` - [ ] Passed `make -C src/test installcheck-cbdb-parallel` --- ### Impact **Performance:** No measurable impact expected. **User-facing changes:** None (internal logic improvement only). **Dependencies:** No changes. --- ### Checklist - [x] Followed [contribution guide](https://cloudberry.apache.org/contribute/code) - [ ] Added/updated documentation - [x] Reviewed code for security implications - [ ] Requested review from [cloudberry committers](https://github.com/orgs/apache/teams/cloudberry-committers) --- ### Additional Context N/A --- ### CI Skip Instructions <!-- To skip CI builds, add the appropriate CI skip identifier to your PR title. The identifier must: - Be in square brackets [] - Include the word "ci" and either "skip" or "no" - Only use for documentation-only changes or when absolutely necessary. --> --- <!-- Join our community: - Mailing list: [[email protected]](https://lists.apache.org/[email protected]) - Discussions: https://github.com/apache/cloudberry/discussions --> -- 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]
