Skip to content

Commit 70f07dd

Browse files
committed
some fixes
1 parent 657c9ad commit 70f07dd

File tree

2 files changed

+12
-9
lines changed
  • presto-clp/src/main/java/com/facebook/presto/plugin/clp
  • presto-docs/src/main/sphinx/connector

2 files changed

+12
-9
lines changed

presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpMetadata.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636

3737
import java.util.List;
3838
import java.util.Map;
39-
import java.util.Objects;
4039
import java.util.Optional;
4140
import java.util.Set;
41+
import java.util.function.Function;
4242

4343
import static java.util.Objects.requireNonNull;
4444
import static java.util.concurrent.TimeUnit.SECONDS;
@@ -163,16 +163,19 @@ public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSess
163163
schemaTableNames = listTables(session, Optional.ofNullable(prefix.getSchemaName()));
164164
}
165165
else {
166-
schemaTableNames = ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
166+
SchemaTableName table = new SchemaTableName(schemaName, prefix.getTableName());
167+
if (listTables(session, Optional.ofNullable(schemaName)).contains(table)) {
168+
schemaTableNames = ImmutableList.of(table);
169+
}
170+
else {
171+
schemaTableNames = ImmutableList.of();
172+
}
167173
}
168174

169175
return schemaTableNames.stream()
170-
.map(tableName -> {
171-
ConnectorTableHandle handle = getTableHandle(session, tableName);
172-
return handle != null ? Map.entry(tableName, getTableMetadata(session, handle).getColumns()) : null;
173-
})
174-
.filter(Objects::nonNull)
175-
.collect(ImmutableMap.toImmutableMap(Map.Entry::getKey, Map.Entry::getValue));
176+
.collect(ImmutableMap.toImmutableMap(
177+
Function.identity(),
178+
tableName -> getTableMetadata(session, getTableHandle(session, tableName)).getColumns()));
176179
}
177180

178181
@Override

presto-docs/src/main/sphinx/connector/clp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Property Name Description
6868
``clp.metadata-db-name`` The name of the metadata database. This option is required if
6969
``clp.metadata-provider-type`` is set to ``mysql`` and the database name
7070
is not specified in the URL.
71-
``clp.metadata-db-user`` The database user with access to the metadata database.This option is
71+
``clp.metadata-db-user`` The database user with access to the metadata database. This option is
7272
required if ``clp.metadata-provider-type`` is set to ``mysql`` and the
7373
database name is not specified in the URL.
7474
``clp.metadata-db-password`` The password for the metadata database user. This option is required if

0 commit comments

Comments
 (0)