Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1184,9 +1184,9 @@
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.48</version>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.3.0</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -1728,7 +1728,7 @@

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>testing-mysql-server-5</artifactId>
<artifactId>testing-mysql-server-8</artifactId>
<version>${dep.testing-mysql-server-5.version}</version>
</dependency>

Expand Down
14 changes: 13 additions & 1 deletion presto-benchmark-runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@
<groupId>com.facebook.presto</groupId>
<artifactId>presto-tests</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -175,8 +181,14 @@

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>testing-mysql-server-5</artifactId>
<artifactId>testing-mysql-server-8</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
18 changes: 15 additions & 3 deletions presto-function-namespace-managers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,15 @@
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -164,8 +170,14 @@

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>testing-mysql-server-5</artifactId>
<artifactId>testing-mysql-server-8</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
18 changes: 15 additions & 3 deletions presto-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -152,8 +158,14 @@

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>testing-mysql-server-5</artifactId>
<artifactId>testing-mysql-server-8</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import com.facebook.presto.spi.PrestoException;
import com.facebook.presto.spi.SchemaTableName;
import com.google.common.collect.ImmutableSet;
import com.mysql.cj.jdbc.JdbcStatement;
import com.mysql.jdbc.Driver;
import com.mysql.jdbc.Statement;

import javax.inject.Inject;

Expand All @@ -53,8 +53,8 @@
import static com.facebook.presto.spi.StandardErrorCode.ALREADY_EXISTS;
import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
import static com.mysql.jdbc.SQLError.SQL_STATE_ER_TABLE_EXISTS_ERROR;
import static com.mysql.jdbc.SQLError.SQL_STATE_SYNTAX_ERROR;
import static com.mysql.cj.exceptions.MysqlErrorNumbers.SQL_STATE_ER_TABLE_EXISTS_ERROR;
import static com.mysql.cj.exceptions.MysqlErrorNumbers.SQL_STATE_SYNTAX_ERROR;
import static java.lang.String.format;
import static java.util.Locale.ENGLISH;

Expand Down Expand Up @@ -127,8 +127,8 @@ public PreparedStatement getPreparedStatement(ConnectorSession session, Connecti
throws SQLException
{
PreparedStatement statement = connection.prepareStatement(sql);
if (statement.isWrapperFor(Statement.class)) {
statement.unwrap(Statement.class).enableStreamingResults();
if (statement.isWrapperFor(JdbcStatement.class)) {
statement.unwrap(JdbcStatement.class).enableStreamingResults();
}
return statement;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
import com.facebook.presto.plugin.jdbc.JdbcClient;
import com.google.inject.Binder;
import com.google.inject.Scopes;
import com.mysql.jdbc.Driver;

import java.sql.SQLException;
import java.util.Properties;
import com.mysql.cj.conf.ConnectionUrlParser;
import com.mysql.cj.exceptions.CJException;

import static com.facebook.airlift.configuration.ConfigBinder.configBinder;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Strings.isNullOrEmpty;
import static com.mysql.cj.conf.ConnectionUrlParser.parseConnectionString;

public class MySqlClientModule
extends AbstractConfigurationAwareModule
Expand All @@ -40,13 +39,11 @@ protected void setup(Binder binder)
private static void ensureCatalogIsEmpty(String connectionUrl)
{
try {
Driver driver = new Driver();
Properties urlProperties = driver.parseURL(connectionUrl, null);
checkArgument(urlProperties != null, "Invalid JDBC URL for MySQL connector");
checkArgument(driver.database(urlProperties) == null, "Database (catalog) must not be specified in JDBC URL for MySQL connector");
ConnectionUrlParser parser = parseConnectionString(connectionUrl);
boolean nullOrEmpty = isNullOrEmpty(parser.getPath());
}
catch (SQLException e) {
throw new RuntimeException(e);
catch (CJException ignore) {
boolean nullOrEmpty = false;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Declare nullOrEmpty variable as method variable on top once.
In which scenario CJException would come?

Copy link
Copy Markdown
Member

@agrawalreetika agrawalreetika Mar 21, 2024

Choose a reason for hiding this comment

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

}
}
}
10 changes: 8 additions & 2 deletions presto-product-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,15 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
Expand Down
10 changes: 8 additions & 2 deletions presto-resource-group-managers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,14 @@
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Presto SPI -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
package com.facebook.presto.resourceGroups.db;

import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import com.mysql.cj.jdbc.MysqlDataSource;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.sqlobject.SqlObjectPlugin;

Expand Down
18 changes: 15 additions & 3 deletions presto-verifier/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,15 @@
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -243,8 +249,14 @@

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>testing-mysql-server-5</artifactId>
<artifactId>testing-mysql-server-8</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down