Skip to content
Merged
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
2 changes: 1 addition & 1 deletion plugin/trino-singlestore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<dependency>
<groupId>com.singlestore</groupId>
<artifactId>singlestore-jdbc-client</artifactId>
<version>1.2.3</version>
<version>1.2.8</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

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