in cmd/iceberg/main.go [287:327]
func describe(ctx context.Context, output Output, cat catalog.Catalog, id string, entityType string) {
ident := catalog.ToIdentifier(id)
isNS, isTbl := false, false
if (entityType == "any" || entityType == "ns") && len(ident) > 0 {
nsprops, err := cat.LoadNamespaceProperties(ctx, ident)
if err != nil {
if errors.Is(err, catalog.ErrNoSuchNamespace) {
if entityType != "any" || len(ident) == 1 {
output.Error(err)
os.Exit(1)
}
} else {
output.Error(err)
os.Exit(1)
}
} else {
isNS = true
output.DescribeProperties(nsprops)
}
}
if (entityType == "any" || entityType == "tbl") && len(ident) > 1 {
tbl, err := cat.LoadTable(ctx, ident, nil)
if err != nil {
if !errors.Is(err, catalog.ErrNoSuchTable) || entityType != "any" {
output.Error(err)
os.Exit(1)
}
} else {
isTbl = true
output.DescribeTable(tbl)
}
}
if !isNS && !isTbl {
output.Error(fmt.Errorf("%w: table or namespace does not exist: %s",
catalog.ErrNoSuchNamespace, ident))
os.Exit(1)
}
}