okumin commented on code in PR #6137:
URL: https://github.com/apache/hive/pull/6137#discussion_r2438369100
##########
jdbc/src/java/org/apache/hive/jdbc/Utils.java:
##########
@@ -890,4 +885,18 @@ public static String getPassword(Map<String, String>
confMap, String key) {
}
return password;
}
+
+ /**
+ * Method to get the default port based on the transport mode
+ * @param connectionParams JDBC connection parameters
+ * @return defaultPort
+ */
+ public static String getDefaultPort(JdbcConnectionParams connectionParams) {
+ String port = "10000";
+ String transportMode =
connectionParams.getSessionVars().get(JdbcConnectionParams.TRANSPORT_MODE);
+ if (transportMode != null && transportMode.equalsIgnoreCase("http")) {
+ port = "10001";
Review Comment:
I verified 10001 is the correct default port number.
https://github.com/apache/hive/blob/f12406752b2514aec10a0bfb77359d0ced4ad42c/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java#L4151-L4152
##########
jdbc/src/java/org/apache/hive/jdbc/Utils.java:
##########
@@ -890,4 +885,18 @@ public static String getPassword(Map<String, String>
confMap, String key) {
}
return password;
}
+
+ /**
+ * Method to get the default port based on the transport mode
+ * @param connectionParams JDBC connection parameters
+ * @return defaultPort
+ */
+ public static String getDefaultPort(JdbcConnectionParams connectionParams) {
Review Comment:
Please address the two checkstyle issues.
https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6137&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true
##########
jdbc/src/test/org/apache/hive/jdbc/TestHiveConnection.java:
##########
@@ -75,7 +75,7 @@ public void testHiveConnectionParameters() throws
SQLException, ZooKeeperHiveCli
Assert.assertEquals("true",
params.getSessionVars().get(JdbcConnectionParams.JDBC_PARAM_REQUEST_TRACK));
JdbcConnectionParams nonPortParams =
Utils.parseURL("jdbc:hive2://hello.host/default");
- Assert.assertEquals(Integer.parseInt(Utils.DEFAULT_PORT),
nonPortParams.getPort());
+ Assert.assertEquals(Integer.parseInt(Utils.getDefaultPort(nonPortParams)),
nonPortParams.getPort());
Review Comment:
Can we hardcode 10000 or use
`HiveConf.ConfVars.HIVE_SERVER2_THRIFT_PORT.default` to ensure the
`getDefaultPort` picks up the correct port?
Also, can we add a test case like
`jdbc:hive2://hello.host/default;transportMode=http` to ensure that 10001 is
definitely chosen?
--
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]