Skip to content

Conversation

@jangjangji
Copy link

  • 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

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

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Test Plan

  • Manual testing with production CSV log files
  • 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


Additional Context

N/A


CI Skip Instructions


- Add buffer.seek(0) after truncate to reset file pointer position
- Add isinstance and len check before accessing item[16] to prevent
  IndexError
- Improves robustness when processing malformed CSV log entries
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @jangjangji welcome!🎊 Thanks for taking the effort to make our project better! 🙌 Keep making such awesome contributions!

Copy link
Contributor

@leborchuk leborchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, ship it.

@jangjangji
Copy link
Author

Looks good, ship it.

Thanks for reviewing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants