Skip to content

Commit

Permalink
Abolish taking over Presto JDBC driver
Browse files Browse the repository at this point in the history
  • Loading branch information
takezoe committed May 25, 2021
1 parent ab3ebbc commit 86136ce
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 60 deletions.

This file was deleted.

This file was deleted.

Expand Up @@ -99,7 +99,6 @@ public final class TrinoDriverUri
{
private static final String JDBC_URL_PREFIX = "jdbc:";
private static final String JDBC_URL_START = JDBC_URL_PREFIX + "trino:";
private static final String LEGACY_JDBC_URL_START = JDBC_URL_PREFIX + "presto:";

private static final Splitter QUERY_SPLITTER = Splitter.on('&').omitEmptyStrings();
private static final Splitter ARG_SPLITTER = Splitter.on('=').limit(2);
Expand Down Expand Up @@ -144,7 +143,7 @@ public static TrinoDriverUri create(String url, Properties properties)

public static boolean acceptsURL(String url)
{
return url.startsWith(JDBC_URL_START) || url.startsWith(LEGACY_JDBC_URL_START);
return url.startsWith(JDBC_URL_START);
}

public URI getJdbcUri()
Expand Down Expand Up @@ -358,11 +357,11 @@ private static Map<String, String> parseParameters(String query)
private static URI parseDriverUrl(String url)
throws SQLException
{
if (!url.startsWith(JDBC_URL_START) && !url.startsWith(LEGACY_JDBC_URL_START)) {
if (!url.startsWith(JDBC_URL_START)) {
throw new SQLException("Invalid JDBC URL: " + url);
}

if (url.equals(JDBC_URL_START) || url.equals(LEGACY_JDBC_URL_START)) {
if (url.equals(JDBC_URL_START)) {
throw new SQLException("Empty JDBC URL: " + url);
}

Expand Down
Expand Up @@ -239,7 +239,7 @@ public void testAuthenticationAfterInitialTokenHasBeenInvalidated()
private Connection createConnection()
throws SQLException
{
String url = format("jdbc:presto://localhost:%s", server.getHttpsAddress().getPort());
String url = format("jdbc:trino://localhost:%s", server.getHttpsAddress().getPort());
Properties properties = new Properties();
properties.setProperty("user", "test");
properties.setProperty("SSL", "true");
Expand Down
Expand Up @@ -167,6 +167,9 @@ public void testInvalidUrls()

// empty extra credentials
assertInvalid("jdbc:trino://localhost:8080?extraCredentials=", "Connection property 'extraCredentials' value is empty");

// legacy url
assertInvalid("jdbc:presto://localhost:8080", "Invalid JDBC URL: jdbc:presto://localhost:8080");
}

@Test(expectedExceptions = SQLException.class, expectedExceptionsMessageRegExp = "Connection property 'user' is required")
Expand Down Expand Up @@ -371,14 +374,6 @@ public void testOptionalSchema()
assertThat(parameters.getSchema()).isEmpty();
}

@Test
public void testLegacyUrl()
throws SQLException
{
TrinoDriverUri parameters = createDriverUri("jdbc:presto://localhost:8080");
assertUriPortScheme(parameters, 8080, "http");
}

private static void assertUriPortScheme(TrinoDriverUri parameters, int port, String scheme)
{
URI uri = parameters.getHttpUri();
Expand Down
Expand Up @@ -30,7 +30,7 @@ databases:
host: localhost
port: 8080
server_address: http://${databases.presto.host}:${databases.presto.port}
jdbc_driver_class: io.prestosql.jdbc.PrestoDriver
jdbc_driver_class: io.trino.jdbc.TrinoDriver
jdbc_url: jdbc:trino://${databases.presto.host}:${databases.presto.port}/hive/${databases.hive.schema}
jdbc_user: hive
jdbc_password: "***empty***"
Expand Down

0 comments on commit 86136ce

Please sign in to comment.