turboFei commented on code in PR #7317:
URL: https://github.com/apache/kyuubi/pull/7317#discussion_r2800444367
##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java:
##########
@@ -565,13 +565,16 @@ static int getVersionPart(String fullVersion, int
position) {
}
public static String parsePropertyFromUrl(final String url, final String
key) {
- String[] tokens = url.split(";");
- for (String token : tokens) {
- if (token.trim().startsWith(key.trim() + "=")) {
- return token.trim().substring((key.trim() + "=").length());
- }
+ String clientPropertiesSection = url.split("[?#]")[0];
+ int semiColonIndex = clientPropertiesSection.indexOf(';');
+ if (semiColonIndex < 0) {
+ return null;
}
- return null;
+
+ String clientProperties = clientPropertiesSection.substring(semiColonIndex
+ 1);
+ Matcher matcher =
+ Pattern.compile("(?:^|;)" + Pattern.quote(key) +
"=([^;]*)").matcher(clientProperties);
+ return matcher.find() ? matcher.group(1) : null;
Review Comment:
1. per the code, I can see that, this method is only used to parse
clientPropertiesSection just likes this PR
<img width="900" height="401" alt="Image"
src="https://github.com/user-attachments/assets/ed05bd12-8de6-4b67-b10f-19d8e3ffe78f"
/>
we can add some comments to make this method clear
2. we can make this PR simple with one line change I think.
```
String[] tokens = url.split("[?#]")[0].split(";");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]