Skip to content

[KYUUBI-7316] Fix parsePropertyFromUrl to remove query string from parsed values#7317

Closed
wangyum wants to merge 4 commits intoapache:masterfrom
wangyum:KYUUBI-7316
Closed

[KYUUBI-7316] Fix parsePropertyFromUrl to remove query string from parsed values#7317
wangyum wants to merge 4 commits intoapache:masterfrom
wangyum:KYUUBI-7316

Conversation

@wangyum
Copy link
Copy Markdown
Member

@wangyum wangyum commented Jan 29, 2026

Why are the changes needed?

Fixed the parsePropertyFromUrl method in Utils.java to properly remove query string parts (everything after ?) from parsed JDBC URL property values, making it consistent with the extractURLComponents method.

When parsing JDBC URLs with query strings like: jdbc:hive2://host:10012/db;auth=JWT?kyuubi.session.cluster=clusterA.
The parsePropertyFromUrl method was incorrectly returning JWT?kyuubi.session.cluster=clusterA for the auth property, while extractURLComponents correctly returned only JWT. This inconsistency could cause authentication failures in JWT auth scenarios with additional query parameters.

How was this patch tested?

  1. URLs with query strings parse properties correctly without the query string
  2. URLs without query strings continue to work as expected
  3. Both parsing methods return consistent results

Was this patch authored or co-authored using generative AI tooling?

No.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (dfd9b49) to head (e89260c).

Files with missing lines Patch % Lines
...c/main/java/org/apache/kyuubi/jdbc/hive/Utils.java 0.00% 5 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master   #7317   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files         698     698           
  Lines       43654   43658    +4     
  Branches     5896    5897    +1     
======================================
- Misses      43654   43658    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@turboFei turboFei requested a review from Copilot January 29, 2026 17:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an inconsistency in JDBC URL property parsing where parsePropertyFromUrl was incorrectly including query string parameters in property values while extractURLComponents correctly excluded them. This could cause authentication failures when using JWT auth with additional query parameters.

Changes:

  • Modified parsePropertyFromUrl to strip query string portions (everything after ?) from parsed property values
  • Added comprehensive test coverage for both query string and non-query string scenarios
  • Ensured both parsing methods return consistent results

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java Updated parsePropertyFromUrl to remove query string parameters from property values
kyuubi-hive-jdbc/src/test/java/org/apache/kyuubi/jdbc/hive/UtilsTest.java Added tests verifying consistency between parsing methods and correct handling of query strings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java Outdated
Comment thread kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java Outdated
@turboFei turboFei requested a review from Copilot February 12, 2026 18:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java Outdated
String clientProperties = clientPropertiesSection.substring(semiColonIndex + 1);
Matcher matcher =
Pattern.compile("(?:^|;)" + Pattern.quote(key) + "=([^;]*)").matcher(clientProperties);
return matcher.find() ? matcher.group(1) : null;
Copy link
Copy Markdown
Member

@turboFei turboFei Feb 12, 2026

Choose a reason for hiding this comment

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

  1. per the code, I can see that, this method is only used to parse clientPropertiesSection just likes this PR
Image

we can add some comments to make this method clear

  1. we can make this PR simple (two lines change)
    String urlClientPropertiesSection = url.split("[?#]")[0];
    String[] tokens = urlClientPropertiesSection.split(";");

Copy link
Copy Markdown
Member

@turboFei turboFei left a comment

Choose a reason for hiding this comment

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

LGTM, cc @pan3793

@pan3793
Copy link
Copy Markdown
Member

pan3793 commented Feb 13, 2026

CI starts to fail with "Could not find a valid Docker environment", it should be irrelevant, not sure what happened in infra.

@turboFei turboFei added this to the v1.10.4 milestone Feb 13, 2026
@turboFei turboFei closed this in c5acf54 Feb 13, 2026
turboFei pushed a commit that referenced this pull request Feb 13, 2026
… string from parsed values

### Why are the changes needed?

Fixed the `parsePropertyFromUrl` method in `Utils.java` to properly remove query string parts (everything after ?) from parsed JDBC URL property values, making it consistent with the `extractURLComponents` method.

When parsing JDBC URLs with query strings like: `jdbc:hive2://host:10012/db;auth=JWT?kyuubi.session.cluster=clusterA`.
The `parsePropertyFromUrl` method was incorrectly returning `JWT?kyuubi.session.cluster=clusterA` for the `auth` property, while `extractURLComponents` correctly returned only `JWT`. This inconsistency could cause authentication failures in JWT auth scenarios with additional query parameters.

### How was this patch tested?

1. URLs with query strings parse properties correctly without the query string
2. URLs without query strings continue to work as expected
3. Both parsing methods return consistent results

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #7317 from wangyum/KYUUBI-7316.

Closes #7317

6b8d3b5 [Yuming Wang] f
88a3c5a [Yuming Wang] fix
e89260c [Yuming Wang] fix
206f28d [Yuming Wang] fix

Authored-by: Yuming Wang <yumwang@ebay.com>
Signed-off-by: Fei Wang <feiwang@apache.org>
(cherry picked from commit c5acf54)
Signed-off-by: Fei Wang <feiwang@apache.org>
turboFei pushed a commit that referenced this pull request Feb 13, 2026
… string from parsed values

### Why are the changes needed?

Fixed the `parsePropertyFromUrl` method in `Utils.java` to properly remove query string parts (everything after ?) from parsed JDBC URL property values, making it consistent with the `extractURLComponents` method.

When parsing JDBC URLs with query strings like: `jdbc:hive2://host:10012/db;auth=JWT?kyuubi.session.cluster=clusterA`.
The `parsePropertyFromUrl` method was incorrectly returning `JWT?kyuubi.session.cluster=clusterA` for the `auth` property, while `extractURLComponents` correctly returned only `JWT`. This inconsistency could cause authentication failures in JWT auth scenarios with additional query parameters.

### How was this patch tested?

1. URLs with query strings parse properties correctly without the query string
2. URLs without query strings continue to work as expected
3. Both parsing methods return consistent results

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #7317 from wangyum/KYUUBI-7316.

Closes #7317

6b8d3b5 [Yuming Wang] f
88a3c5a [Yuming Wang] fix
e89260c [Yuming Wang] fix
206f28d [Yuming Wang] fix

Authored-by: Yuming Wang <yumwang@ebay.com>
Signed-off-by: Fei Wang <feiwang@apache.org>
(cherry picked from commit c5acf54)
Signed-off-by: Fei Wang <feiwang@apache.org>
@turboFei
Copy link
Copy Markdown
Member

thanks, merged to 1.10.4

@wangyum wangyum deleted the KYUUBI-7316 branch February 13, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants