Skip to content

Conversation

@czentgr
Copy link
Contributor

@czentgr czentgr commented Oct 23, 2025

The thrift generation was broken because a line
that was expected to be removed was not and caused a thrift parse error.

That line is "drift.recursive_reference = true,” which was not caught by the regex attempting to remove it.

This PR also adds the required thrift parser to the python installation of the dependency to use it in the CI.

Description

Motivation and Context

Impact

Test Plan

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== NO RELEASE NOTE ==

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Oct 23, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 23, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refine the Thrift-to-JSON preprocessing to correctly strip the “drift.recursive_reference = true” declaration via an improved regex and ensure the CI setup installs the required Python thrift parser dependency.

Class diagram for updated Thrift preprocessing function

classDiagram
    class preprocess {
        +preprocess(file_path, output_temp_path)
        -Improved regex to remove "drift.recursive_reference = true"
    }
Loading

File-Level Changes

Change Details Files
Enhanced regex to remove drift.recursive_reference flag
  • Extend pattern to match optional spaces around '='
  • Allow leading and trailing commas in matches
  • Retain subsequent empty‐parentheses cleanup
presto-native-execution/presto_cpp/main/thrift/thrift2json.py
Add missing Python thrift parser dependency to CI installs
  • Include ptsd-jbroll in the pip install command
presto-native-execution/scripts/setup-centos.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@czentgr czentgr force-pushed the cz_fix_thrift_generation branch from dfb1c2b to a2b663d Compare October 29, 2025 20:07
@czentgr czentgr marked this pull request as ready for review October 29, 2025 20:08
@czentgr czentgr requested review from a team as code owners October 29, 2025 20:08
@prestodb-ci prestodb-ci requested review from a team, NivinCS and jp-sivaprasad and removed request for a team October 29, 2025 20:08
@czentgr czentgr requested a review from vhsu14 October 29, 2025 20:08
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Precompile the regex patterns outside the loop in thrift2json.py to avoid recompiling them on each line and improve performance.
  • Tighten the regex for removing drift.recursive_reference (for example with word boundaries) to avoid accidentally stripping similar tokens.
  • Verify that the new pip package 'ptsd-jbroll' is the intended thrift parser and consider pinning its version to prevent future compatibility issues.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Precompile the regex patterns outside the loop in thrift2json.py to avoid recompiling them on each line and improve performance.
- Tighten the regex for removing drift.recursive_reference (for example with word boundaries) to avoid accidentally stripping similar tokens.
- Verify that the new pip package 'ptsd-jbroll' is the intended thrift parser and consider pinning its version to prevent future compatibility issues.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@czentgr czentgr requested a review from majetideepak October 29, 2025 20:09
majetideepak
majetideepak previously approved these changes Oct 29, 2025
The thrift generation was broken because a line
that was expected to be removed was not and caused
a thrift parse error.

That line is "drift.recursive_reference = true,” which
was not caught by the regex attempting to remove it.

This PR also adds the required thrift parser to the
python installation of the dependency to use it in the CI.
@czentgr czentgr force-pushed the cz_fix_thrift_generation branch from 73a9093 to c243388 Compare October 30, 2025 15:57
@vhsu14
Copy link
Contributor

vhsu14 commented Oct 30, 2025

thank you for fixing this!

@czentgr czentgr requested a review from majetideepak October 31, 2025 18:23
@czentgr
Copy link
Contributor Author

czentgr commented Oct 31, 2025

@tdcmeehan Please review when you get a chance.

Copy link
Contributor

@tdcmeehan tdcmeehan left a comment

Choose a reason for hiding this comment

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

ptsd-jbroll is not maintained. I think we need to come up with a policy on introducing unmaintained dependencies.

@czentgr czentgr merged commit cfb8cea into prestodb:master Nov 2, 2025
82 of 83 checks passed
@czentgr czentgr deleted the cz_fix_thrift_generation branch November 2, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants