Skip to content

fix: Register CLP plan optimizer (fixes #35).#33

Merged
anlowee merged 1 commit intoy-scope:release-0.293-clp-connectorfrom
wraymo:add_clp_optimizer
Jul 11, 2025
Merged

fix: Register CLP plan optimizer (fixes #35).#33
anlowee merged 1 commit intoy-scope:release-0.293-clp-connectorfrom
wraymo:add_clp_optimizer

Conversation

@wraymo
Copy link

@wraymo wraymo commented Jul 10, 2025

Description

When doing the end-to-end testing, the pushdown was not generated, which turned out that the ClpPlanOptimizer was not added to connector's optimizers.

image

#16 adds the CLP plan optimizer, but didn't register it. This PR fixes the issue.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

Doing the end-to-end test again, and the pushdown can be generated.

Summary by CodeRabbit

  • New Features

    • Enhanced query planning capabilities by integrating function metadata, function resolution, and metadata filtering into the connector.
  • Chores

    • Cleaned up unused imports and configuration related to row expression services.

@coderabbitai
Copy link

coderabbitai bot commented Jul 10, 2025

Walkthrough

The ClpConnector class was updated to include new dependencies for function metadata, function resolution, and metadata filtering, and now provides a plan optimizer provider. The ClpConnectorFactory class had the RowExpressionService import and binding removed, with no changes to public interfaces or logic.

Changes

File(s) Change Summary
presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpConnector.java Added dependencies: FunctionMetadataManager, StandardFunctionResolution, ClpMetadataFilterProvider; new method for plan optimizer provider.
presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpConnectorFactory.java Removed import and Guice binding for RowExpressionService.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ClpConnector
    participant ClpPlanOptimizerProvider

    Client->>ClpConnector: getConnectorPlanOptimizerProvider()
    ClpConnector->>ClpPlanOptimizerProvider: new ClpPlanOptimizerProvider(functionManager, functionResolution, metadataFilterProvider)
    ClpConnector-->>Client: ClpPlanOptimizerProvider instance
Loading

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c86114 and 69f8504.

📒 Files selected for processing (2)
  • presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpConnector.java (2 hunks)
  • presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpConnectorFactory.java (0 hunks)
💤 Files with no reviewable changes (1)
  • presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpConnectorFactory.java
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: wraymo
PR: y-scope/presto#15
File: presto-clp/src/main/java/com/facebook/presto/plugin/clp/metadata/ClpMetadataProvider.java:22-33
Timestamp: 2025-06-13T12:56:06.325Z
Learning: `ClpMetadataProvider` is instantiated only once and used solely by the Presto coordinator, so concurrency/thread-safety guarantees are unnecessary.
presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpConnector.java (1)
Learnt from: wraymo
PR: y-scope/presto#15
File: presto-clp/src/main/java/com/facebook/presto/plugin/clp/metadata/ClpMetadataProvider.java:22-33
Timestamp: 2025-06-13T12:56:06.325Z
Learning: `ClpMetadataProvider` is instantiated only once and used solely by the Presto coordinator, so concurrency/thread-safety guarantees are unnecessary.
🔇 Additional comments (4)
presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpConnector.java (4)

20-20: LGTM! Clean imports for plan optimizer functionality.

The new imports are appropriate for the plan optimizer feature and properly organized.

Also applies to: 24-25


41-43: LGTM! Proper field declarations for dependency injection.

The new fields are correctly declared as final, ensuring immutability and following good Java practices.


46-62: LGTM! Constructor properly handles new dependencies.

The constructor correctly:

  • Accepts the new dependencies as parameters
  • Performs null checks using requireNonNull with descriptive messages
  • Assigns the validated dependencies to final fields

This follows the established pattern in the class and ensures proper dependency injection.


64-68: LGTM! Plan optimizer provider correctly implemented.

The getConnectorPlanOptimizerProvider() method successfully addresses the PR objective by registering the CLP plan optimizer. The implementation:

  • Properly overrides the interface method
  • Returns a new instance of ClpPlanOptimizerProvider with the required dependencies
  • Completes the integration that was missing from the previous implementation

This change ensures the plan optimizer is now properly registered and available for use.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kirkrodrigues kirkrodrigues changed the title fix: Register CLP plan optimizer fix: Register CLP plan optimizer (fixes #35). Jul 11, 2025
@anlowee anlowee merged commit 700e72e into y-scope:release-0.293-clp-connector Jul 11, 2025
31 of 33 checks passed
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