-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support setting
hive_conf_list
, hive_var_list
and sess_var_list
…
… for jdbcURL when connecting to HiveServer2
- Loading branch information
1 parent
e9f1b4b
commit a41fa60
Showing
5 changed files
with
41 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,14 @@ | |
|
||
package org.apache.shardingsphere.infra.database.hive.connector; | ||
|
||
import org.apache.hive.jdbc.JdbcUriParseException; | ||
import org.apache.shardingsphere.infra.database.core.connector.ConnectionProperties; | ||
import org.apache.shardingsphere.infra.database.core.connector.ConnectionPropertiesParser; | ||
import org.apache.shardingsphere.infra.database.core.exception.UnrecognizedDatabaseURLException; | ||
import org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader; | ||
import org.apache.shardingsphere.infra.database.core.type.DatabaseType; | ||
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; | ||
import org.apache.shardingsphere.test.util.PropertiesBuilder; | ||
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
|
@@ -55,17 +56,26 @@ void assertNewConstructor(final String name, final String url, final String host | |
|
||
@Test | ||
void assertNewConstructorFailure() { | ||
assertThrows(UnrecognizedDatabaseURLException.class, () -> parser.parse("jdbc:hive2:xxxxxxxx", null, null)); | ||
assertThrows(JdbcUriParseException.class, () -> parser.parse("jdbc:hive2://localhost:10000;principal=test", null, null)); | ||
assertThrows(JdbcUriParseException.class, () -> parser.parse("jdbc:hive2://localhost:10000;principal=hive/[email protected]", null, null)); | ||
assertThrows(JdbcUriParseException.class, () -> parser.parse("jdbc:hive2://localhost:10000test", null, null)); | ||
assertThrows(RuntimeException.class, () -> parser.parse("jdbc:hive2://", null, null)); | ||
} | ||
|
||
private static class NewConstructorTestCaseArgumentsProvider implements ArgumentsProvider { | ||
|
||
@Override | ||
public Stream<? extends Arguments> provideArguments(final ExtensionContext extensionContext) { | ||
return Stream.of( | ||
Arguments.of("simple", "jdbc:hive2:///foo_ds", "localhost", 10000, "foo_ds", null, new Properties()), | ||
Arguments.of("complex", "jdbc:hive2://127.0.0.1:9999/foo_ds?transportMode=http", "127.0.0.1", 9999, "foo_ds", null, | ||
PropertiesBuilder.build(new PropertiesBuilder.Property("transportMode", "http")))); | ||
Arguments.of("simple_first", "jdbc:hive2://localhost:10001/default", "localhost", 10001, "default", null, new Properties()), | ||
Arguments.of("simple_second", "jdbc:hive2://localhost/notdefault", "localhost", 10000, "notdefault", null, new Properties()), | ||
Arguments.of("simple_third", "jdbc:hive2://foo:1243", "foo", 1243, "default", null, new Properties()), | ||
Arguments.of("complex", "jdbc:hive2://server:10002/db;user=foo;password=bar?transportMode=http;httpPath=hs2", | ||
"server", 10002, "db", null, PropertiesBuilder.build( | ||
new Property("user", "foo"), | ||
new Property("password", "bar"), | ||
new Property("transportMode", "http"), | ||
new Property("httpPath", "hs2")))); | ||
} | ||
} | ||
} |