Skip to content

Commit b364567

Browse files
anusudarsanebyhr
authored andcommitted
Upgrade singlestore jdbc to 1.2.8
1 parent 6abf6a9 commit b364567

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

plugin/trino-singlestore/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<dependency>
3030
<groupId>com.singlestore</groupId>
3131
<artifactId>singlestore-jdbc-client</artifactId>
32-
<version>1.2.3</version>
32+
<version>1.2.8</version>
3333
</dependency>
3434

3535
<dependency>

plugin/trino-singlestore/src/main/java/io/trino/plugin/singlestore/SingleStoreClient.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
import java.sql.Connection;
6161
import java.sql.DatabaseMetaData;
62+
import java.sql.PreparedStatement;
6263
import java.sql.ResultSet;
6364
import java.sql.SQLException;
6465
import java.sql.Types;
@@ -216,11 +217,13 @@ public boolean supportsAggregationPushdown(ConnectorSession session, JdbcTableHa
216217
@Override
217218
public Collection<String> listSchemas(Connection connection)
218219
{
219-
// for SingleStore, we need to list catalogs instead of schemas
220-
try (ResultSet resultSet = connection.getMetaData().getCatalogs()) {
220+
// Avoid using DatabaseMetaData.getCatalogs method because
221+
// https://github.com/memsql/S2-JDBC-Connector/pull/9 causes the driver to return only the databases in the current workspace
222+
try (PreparedStatement statement = connection.prepareStatement("SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA");
223+
ResultSet resultSet = statement.executeQuery()) {
221224
ImmutableSet.Builder<String> schemaNames = ImmutableSet.builder();
222225
while (resultSet.next()) {
223-
String schemaName = resultSet.getString("TABLE_CAT");
226+
String schemaName = resultSet.getString("SCHEMA_NAME");
224227
// skip internal schemas
225228
if (filterSchema(schemaName)) {
226229
schemaNames.add(schemaName);

0 commit comments

Comments
 (0)