diff --git a/ice-rest-catalog/src/test/resources/scenarios/basic-operations/run.sh.tmpl b/ice-rest-catalog/src/test/resources/scenarios/basic-operations/run.sh.tmpl index b71713b3..f6ba3d02 100644 --- a/ice-rest-catalog/src/test/resources/scenarios/basic-operations/run.sh.tmpl +++ b/ice-rest-catalog/src/test/resources/scenarios/basic-operations/run.sh.tmpl @@ -97,6 +97,24 @@ echo "OK Scan verified ${TABLE_SORTED}" {{ICE_CLI}} --config {{CLI_CONFIG}} describe echo "OK Described catalog" +INVALID_NS="invalid_ns" +{{ICE_CLI}} --config {{CLI_CONFIG}} describe $INVALID_NS > /tmp/basic_ops_describe_invalid_ns.txt 2>&1 +if ! grep -q "Namespace $INVALID_NS not found" /tmp/basic_ops_describe_invalid_ns.txt; then + echo "FAIL: describe missing error message for invalid namespace" + cat /tmp/basic_ops_describe_invalid_ns.txt + exit 1 +fi +echo "OK Describe reported invalid namespace" + +INVALID_TABLE="${NAMESPACE_NAME}.invalid_table" +{{ICE_CLI}} --config {{CLI_CONFIG}} describe $INVALID_TABLE > /tmp/basic_ops_describe_invalid_table.txt 2>&1 +if ! grep -q "Table $INVALID_TABLE not found" /tmp/basic_ops_describe_invalid_table.txt; then + echo "FAIL: describe missing error message for invalid table" + cat /tmp/basic_ops_describe_invalid_table.txt + exit 1 +fi +echo "OK Describe reported invalid table" + # Optional: --no-copy insert (like README: create-table + upload + insert --no-copy) # Upload to MinIO via AWS CLI if available so insert --no-copy can reference s3:// # This section is best-effort: if it fails we skip rather than failing the whole test. diff --git a/ice/src/main/java/com/altinity/ice/cli/internal/cmd/Describe.java b/ice/src/main/java/com/altinity/ice/cli/internal/cmd/Describe.java index 13f2230a..9e14b0f7 100644 --- a/ice/src/main/java/com/altinity/ice/cli/internal/cmd/Describe.java +++ b/ice/src/main/java/com/altinity/ice/cli/internal/cmd/Describe.java @@ -34,9 +34,13 @@ import org.apache.iceberg.rest.RESTCatalog; import org.apache.iceberg.types.Conversions; import org.apache.iceberg.types.Types; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public final class Describe { + private static final Logger logger = LoggerFactory.getLogger(Describe.class); + private Describe() {} public enum Option { @@ -66,10 +70,12 @@ public static void run(RESTCatalog catalog, String target, boolean json, Option. List tablesMetadata = new ArrayList<>(); List namespaces = catalog.listNamespaces(); + boolean foundNamespace = false; for (Namespace namespace : namespaces) { if (targetNamespace != null && !targetNamespace.equals(namespace.toString())) { continue; } + foundNamespace = true; List tables = catalog.listTables(namespace); for (TableIdentifier tableId : tables) { if (targetTable != null && !targetTable.equals(tableId.name())) { @@ -98,6 +104,12 @@ public static void run(RESTCatalog catalog, String target, boolean json, Option. mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); String output = mapper.writeValueAsString(tablesMetadata); System.out.println(output); + } else if (targetNamespace != null) { + if (targetTable != null) { + logger.warn("Table {}.{} not found", targetNamespace, targetTable); + } else if (!foundNamespace) { + logger.warn("Namespace {} not found", targetNamespace); + } } }