From 1f284a1b8df5d4b72ff5f624fbabab201650fcb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Kokosi=C5=84ski?= Date: Fri, 20 Jul 2018 08:17:59 +0200 Subject: [PATCH] Prefer SchemaTablePrefix#getSchema to create optional schema name --- .../java/io/prestosql/plugin/accumulo/AccumuloMetadata.java | 4 ++-- .../main/java/io/prestosql/plugin/tpcds/TpcdsMetadata.java | 2 +- .../src/main/java/io/prestosql/plugin/tpch/TpchMetadata.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/presto-accumulo/src/main/java/io/prestosql/plugin/accumulo/AccumuloMetadata.java b/presto-accumulo/src/main/java/io/prestosql/plugin/accumulo/AccumuloMetadata.java index b46f94672da..364d2307379 100644 --- a/presto-accumulo/src/main/java/io/prestosql/plugin/accumulo/AccumuloMetadata.java +++ b/presto-accumulo/src/main/java/io/prestosql/plugin/accumulo/AccumuloMetadata.java @@ -163,7 +163,7 @@ public void dropView(ConnectorSession session, SchemaTableName viewName) public Map getViews(ConnectorSession session, SchemaTablePrefix prefix) { ImmutableMap.Builder builder = ImmutableMap.builder(); - for (SchemaTableName stName : listViews(session, Optional.ofNullable(prefix.getSchemaName()))) { + for (SchemaTableName stName : listViews(session, prefix.getSchema())) { AccumuloView view = client.getView(stName); if (view != null) { builder.put(stName, new ConnectorViewDefinition(stName, Optional.empty(), view.getData())); @@ -407,7 +407,7 @@ private List listTables(ConnectorSession session, SchemaTablePr { // List all tables if schema or table is null if (prefix.getSchemaName() == null || prefix.getTableName() == null) { - return listTables(session, Optional.ofNullable(prefix.getSchemaName())); + return listTables(session, prefix.getSchema()); } // Make sure requested table exists, returning the single table of it does diff --git a/presto-tpcds/src/main/java/io/prestosql/plugin/tpcds/TpcdsMetadata.java b/presto-tpcds/src/main/java/io/prestosql/plugin/tpcds/TpcdsMetadata.java index fdf72019998..c5721d1cca9 100644 --- a/presto-tpcds/src/main/java/io/prestosql/plugin/tpcds/TpcdsMetadata.java +++ b/presto-tpcds/src/main/java/io/prestosql/plugin/tpcds/TpcdsMetadata.java @@ -186,7 +186,7 @@ public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTable public Map> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix) { ImmutableMap.Builder> tableColumns = ImmutableMap.builder(); - for (String schemaName : getSchemaNames(session, Optional.ofNullable(prefix.getSchemaName()))) { + for (String schemaName : getSchemaNames(session, prefix.getSchema())) { for (Table tpcdsTable : Table.getBaseTables()) { if (prefix.getTableName() == null || tpcdsTable.getName().equals(prefix.getTableName())) { ConnectorTableMetadata tableMetadata = getTableMetadata(schemaName, tpcdsTable); diff --git a/presto-tpch/src/main/java/io/prestosql/plugin/tpch/TpchMetadata.java b/presto-tpch/src/main/java/io/prestosql/plugin/tpch/TpchMetadata.java index ad72bdd39ce..aee32d9dfcd 100644 --- a/presto-tpch/src/main/java/io/prestosql/plugin/tpch/TpchMetadata.java +++ b/presto-tpch/src/main/java/io/prestosql/plugin/tpch/TpchMetadata.java @@ -298,7 +298,7 @@ public Map getColumnHandles(ConnectorSession session, Conn public Map> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix) { ImmutableMap.Builder> tableColumns = ImmutableMap.builder(); - for (String schemaName : getSchemaNames(session, Optional.ofNullable(prefix.getSchemaName()))) { + for (String schemaName : getSchemaNames(session, prefix.getSchema())) { for (TpchTable tpchTable : TpchTable.getTables()) { if (prefix.getTableName() == null || tpchTable.getTableName().equals(prefix.getTableName())) { ConnectorTableMetadata tableMetadata = getTableMetadata(schemaName, tpchTable, columnNaming);