|
34 | 34 | import org.apache.iceberg.rest.RESTCatalog; |
35 | 35 | import org.apache.iceberg.types.Conversions; |
36 | 36 | import org.apache.iceberg.types.Types; |
| 37 | +import org.slf4j.Logger; |
| 38 | +import org.slf4j.LoggerFactory; |
37 | 39 |
|
38 | 40 | public final class Describe { |
39 | 41 |
|
| 42 | + private static final Logger logger = LoggerFactory.getLogger(Describe.class); |
| 43 | + |
40 | 44 | private Describe() {} |
41 | 45 |
|
42 | 46 | public enum Option { |
@@ -66,10 +70,12 @@ public static void run(RESTCatalog catalog, String target, boolean json, Option. |
66 | 70 |
|
67 | 71 | List<Table> tablesMetadata = new ArrayList<>(); |
68 | 72 | List<Namespace> namespaces = catalog.listNamespaces(); |
| 73 | + boolean foundNamespace = false; |
69 | 74 | for (Namespace namespace : namespaces) { |
70 | 75 | if (targetNamespace != null && !targetNamespace.equals(namespace.toString())) { |
71 | 76 | continue; |
72 | 77 | } |
| 78 | + foundNamespace = true; |
73 | 79 | List<TableIdentifier> tables = catalog.listTables(namespace); |
74 | 80 | for (TableIdentifier tableId : tables) { |
75 | 81 | if (targetTable != null && !targetTable.equals(tableId.name())) { |
@@ -98,6 +104,12 @@ public static void run(RESTCatalog catalog, String target, boolean json, Option. |
98 | 104 | mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); |
99 | 105 | String output = mapper.writeValueAsString(tablesMetadata); |
100 | 106 | System.out.println(output); |
| 107 | + } else if (targetNamespace != null) { |
| 108 | + if (targetTable != null) { |
| 109 | + logger.warn("Table {}.{} not found", targetNamespace, targetTable); |
| 110 | + } else if (!foundNamespace) { |
| 111 | + logger.warn("Namespace {} not found", targetNamespace); |
| 112 | + } |
101 | 113 | } |
102 | 114 | } |
103 | 115 |
|
|
0 commit comments