protected void createNamespacesIfNotExistOnTargetCatalog()

in iceberg-catalog-migrator/api/src/main/java/org/apache/polaris/iceberg/catalog/migrator/api/CatalogMigrator.java [182:199]


  protected void createNamespacesIfNotExistOnTargetCatalog(Namespace identifierNamespace) {
    if (!processedNamespaces.contains(identifierNamespace)) {
      String[] levels = identifierNamespace.levels();
      for (int index = 0; index < levels.length; index++) {
        Namespace namespace = Namespace.of(Arrays.copyOfRange(levels, 0, index + 1));
        if (processedNamespaces.add(namespace)) {
          try {
            ((SupportsNamespaces) targetCatalog()).createNamespace(namespace);
          } catch (AlreadyExistsException ex) {
            LOG.debug(
                "{}.Ignoring the error as forcefully creating the namespace even if it exists to avoid "
                    + "namespaceExists() check.",
                ex.getMessage());
          }
        }
      }
    }
  }