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
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions ice/src/main/java/com/altinity/ice/cli/internal/cmd/Describe.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -66,10 +70,12 @@ public static void run(RESTCatalog catalog, String target, boolean json, Option.

List<Table> tablesMetadata = new ArrayList<>();
List<Namespace> namespaces = catalog.listNamespaces();
boolean foundNamespace = false;
for (Namespace namespace : namespaces) {
if (targetNamespace != null && !targetNamespace.equals(namespace.toString())) {
continue;
}
foundNamespace = true;
List<TableIdentifier> tables = catalog.listTables(namespace);
for (TableIdentifier tableId : tables) {
if (targetTable != null && !targetTable.equals(tableId.name())) {
Expand Down Expand Up @@ -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);
}
}
}

Expand Down
Loading