[bugfix](iceberg)Restrictions on creating a database (#39641) (#40051)

bp #39641

Co-authored-by: wuwenchi <wuwenchihdu@hotmail.com>
This commit is contained in:
Mingyu Chen
2024-08-28 21:45:03 +08:00
committed by GitHub
parent d1c3b857cf
commit a32a2d8bb4
6 changed files with 65 additions and 34 deletions

View File

@ -58,7 +58,7 @@ public class IcebergGlueExternalCatalog extends IcebergExternalCatalog {
catalogProperties.get(S3Properties.Env.ENDPOINT));
catalogProperties.putIfAbsent(S3FileIOProperties.ENDPOINT, endpoint);
glueCatalog.initialize(icebergCatalogType, catalogProperties);
glueCatalog.initialize(getName(), catalogProperties);
catalog = glueCatalog;
}

View File

@ -44,7 +44,7 @@ public class IcebergHMSExternalCatalog extends IcebergExternalCatalog {
Map<String, String> catalogProperties = catalogProperty.getProperties();
String metastoreUris = catalogProperty.getOrDefault(HMSProperties.HIVE_METASTORE_URIS, "");
catalogProperties.put(CatalogProperties.URI, metastoreUris);
hiveCatalog.initialize(icebergCatalogType, catalogProperties);
hiveCatalog.initialize(getName(), catalogProperties);
catalog = hiveCatalog;
}
}

View File

@ -61,7 +61,7 @@ public class IcebergHadoopExternalCatalog extends IcebergExternalCatalog {
String warehouse = catalogProperty.getHadoopProperties().get(CatalogProperties.WAREHOUSE_LOCATION);
hadoopCatalog.setConf(conf);
catalogProperties.put(CatalogProperties.WAREHOUSE_LOCATION, warehouse);
hadoopCatalog.initialize(icebergCatalogType, catalogProperties);
hadoopCatalog.initialize(getName(), catalogProperties);
catalog = hadoopCatalog;
}
}

View File

@ -106,6 +106,11 @@ public class IcebergMetadataOps implements ExternalMetadataOps {
ErrorReport.reportDdlException(ErrorCode.ERR_DB_CREATE_EXISTS, dbName);
}
}
String icebergCatalogType = dorisCatalog.getIcebergCatalogType();
if (!properties.isEmpty() && !IcebergExternalCatalog.ICEBERG_HMS.equals(icebergCatalogType)) {
throw new DdlException(
"Not supported: create database with properties for iceberg catalog type: " + icebergCatalogType);
}
nsCatalog.createNamespace(Namespace.of(dbName), properties);
dorisCatalog.onRefreshCache(true);
}

View File

@ -47,7 +47,7 @@ public class IcebergRestExternalCatalog extends IcebergExternalCatalog {
Configuration conf = replaceS3Properties(getConfiguration());
catalog = CatalogUtil.buildIcebergCatalog(icebergCatalogType,
catalog = CatalogUtil.buildIcebergCatalog(getName(),
convertToRestCatalogProperties(),
conf);
}