Skip to content

Conversation

agrawalreetika
Copy link
Member

Description

Enable case sensitivity support in the Pinot connector

Motivation and Context

Previously, the Pinot connector always converted schema, table, and column names to lowercase. This caused issues when working with identifiers that differ only by case.

This PR introduces a new catalog configuration, case-sensitive-name-matching, which enables exact case-sensitive matching of schema, table, and column names in the Pinot connector.

Impact

Enable case sensitivity support in the Pinot connector

Test Plan

Currently, there is no Pinot image/Server usage in the existing Pinot tests, so I have attached test results from my Pinot instance.

image image image

Opened an issue to enhance Pinot test and add integration tests - #26235

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.

Release Notes

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

== RELEASE NOTES ==

Pinot Connector Changes
* Add support for case-sensitive identifiers in Pinot. It can be enabled by setting ``case-sensitive-name-matching=true`` configuration in the catalog configuration

@agrawalreetika agrawalreetika self-assigned this Oct 6, 2025
@agrawalreetika agrawalreetika requested review from a team, elharo and steveburnett as code owners October 6, 2025 10:58
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Oct 6, 2025
@prestodb-ci prestodb-ci requested review from a team, Dilli-Babu-Godari and Joe-Abraham and removed request for a team October 6, 2025 10:58
Copy link
Contributor

sourcery-ai bot commented Oct 6, 2025

Reviewer's Guide

Introduce a new configuration flag to enable case-sensitive identifier matching in the Pinot connector, centralize name normalization through a normalizeIdentifier method, remove forced lowercase on column metadata names, and update tests and documentation accordingly.

Class diagram for PinotConfig and PinotMetadata changes

classDiagram
class PinotConfig {
  -String brokerAuthenticationPassword
  -String queryOptions
  -boolean caseSensitiveNameMatchingEnabled
  +boolean isCaseSensitiveNameMatchingEnabled()
  +PinotConfig setCaseSensitiveNameMatchingEnabled(boolean)
}
class PinotMetadata {
  -String connectorId
  -PinotConnection pinotPrestoConnection
  -PinotConfig pinotConfig
  +String normalizeIdentifier(ConnectorSession, String)
}
PinotMetadata --> PinotConfig: uses
Loading

Class diagram for PinotColumnMetadata changes

classDiagram
class PinotColumnMetadata {
  +String getName()
  +String getPinotName()
}
PinotColumnMetadata --|> ColumnMetadata
Loading

File-Level Changes

Change Details Files
Implement case-sensitive name matching configuration
  • Add caseSensitiveNameMatchingEnabled property with getter and @config setter in PinotConfig
  • Inject PinotConfig into PinotMetadata to access the new setting
  • Implement normalizeIdentifier in PinotMetadata to apply lowercase only when the setting is disabled
  • Replace direct toLowerCase(ENGLISH) calls with normalizeIdentifier and update locale import to ROOT
presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotConfig.java
presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotMetadata.java
Preserve original column names in metadata
  • Remove forced lowercase conversion in PinotColumnMetadata.getName
presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotColumnMetadata.java
Update unit tests for new config and metadata behavior
  • Add default and explicit mapping assertions for caseSensitiveNameMatchingEnabled in TestPinotConfig
  • Modify TestPinotMetadata to pass PinotConfig into the PinotMetadata constructor
presto-pinot-toolkit/src/test/java/com/facebook/presto/pinot/TestPinotConfig.java
presto-pinot-toolkit/src/test/java/com/facebook/presto/pinot/TestPinotMetadata.java
Document the new case-sensitive matching option
  • Add description of the case-sensitive-name-matching configuration flag to the Pinot connector documentation
presto-docs/src/main/sphinx/connector/pinot.rst

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

@agrawalreetika agrawalreetika changed the title Enable case sensitivity support in the Pinot connector feat(Pinot): Enable case sensitivity support in the Pinot connector Oct 6, 2025
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:

  • The new case-sensitive config property isn’t namespaced under "pinot.", which is inconsistent with other Pinot connector settings—consider renaming it to "pinot.case-sensitive-name-matching".
  • The documentation in pinot.rst needs to be updated to include the new case-sensitive-name-matching configuration and its default behavior.
  • Make sure normalizeIdentifier is applied consistently for schema, table, and column names (not just column handles) when case-sensitive matching is enabled.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new case-sensitive config property isn’t namespaced under "pinot.", which is inconsistent with other Pinot connector settings—consider renaming it to "pinot.case-sensitive-name-matching".
- The documentation in pinot.rst needs to be updated to include the new case-sensitive-name-matching configuration and its default behavior.
- Make sure normalizeIdentifier is applied consistently for schema, table, and column names (not just column handles) when case-sensitive matching is enabled.

## Individual Comments

### Comment 1
<location> `presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/PinotConfig.java:117` </location>
<code_context>
     private String brokerAuthenticationPassword;

     private String queryOptions;
+    private boolean caseSensitiveNameMatchingEnabled;

     @NotNull
</code_context>

<issue_to_address>
**nitpick:** Default value for caseSensitiveNameMatchingEnabled is not explicitly set.

Explicitly initialize the field or document its default value to prevent ambiguity and ensure consistent behavior.
</issue_to_address>

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.

private String brokerAuthenticationPassword;

private String queryOptions;
private boolean caseSensitiveNameMatchingEnabled;
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Default value for caseSensitiveNameMatchingEnabled is not explicitly set.

Explicitly initialize the field or document its default value to prevent ambiguity and ensure consistent behavior.

@agrawalreetika agrawalreetika changed the title feat(Pinot): Enable case sensitivity support in the Pinot connector feat(pinot): Enable case sensitivity support in the Pinot connector Oct 6, 2025
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull branch, local doc build, looks good. Thank you!

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.

4 participants