Gabriel39 commented on code in PR #66890:
URL: https://github.com/apache/doris/pull/66890#discussion_r3805522966
##########
fe/fe-connector/fe-connector-paimon/src/main/java/org/apache/doris/connector/paimon/PaimonConnector.java:
##########
@@ -489,14 +512,78 @@ private Catalog createCatalogFromContext(CatalogContext
catalogContext, String f
ClassLoader previous = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- return context.executeAuthenticated(() ->
CatalogFactory.createCatalog(catalogContext));
+ return context.executeAuthenticated(() -> {
+ Catalog catalog = PaimonCatalogProperties.HMS.equals(flavor)
+ ? createHmsCatalog(catalogContext, hmsAuth,
catalogProps.getRaw(),
+ storageHadoopConfig)
+ : CatalogFactory.createCatalog(catalogContext);
+ return catalog;
+ });
} catch (Exception e) {
throw new RuntimeException(failureMessage + " (flavor=" + flavor +
"): " + e.getMessage(), e);
} finally {
Thread.currentThread().setContextClassLoader(previous);
}
}
+ static Catalog createHmsCatalog(CatalogContext catalogContext,
HadoopAuthenticator hmsAuth,
+ Map<String, String> properties, Map<String, String>
storageHadoopConfig) {
+ HiveConf hiveConf = HiveCatalog.createHiveConf(catalogContext);
+ Options options = catalogContext.options();
+ String warehouse = options.get(CatalogOptions.WAREHOUSE);
+ if (warehouse == null) {
+ warehouse =
hiveConf.get(HiveConf.ConfVars.METASTOREWAREHOUSE.varname,
+ HiveConf.ConfVars.METASTOREWAREHOUSE.defaultStrVal);
+ }
+ Path warehousePath = new Path(warehouse);
+ Path fileIoPath = warehousePath.toUri().getScheme() == null
+ ? new Path(FileSystem.getDefaultUri(hiveConf)) : warehousePath;
+ try {
+ FileIO fileIO = FileIO.get(fileIoPath, catalogContext);
+ // Paimon checks or creates the warehouse eagerly; it must retain
the outer storage identity.
+ fileIO.checkOrMkdirs(warehousePath);
+ String clientClass =
options.get(HiveCatalogOptions.METASTORE_CLIENT_CLASS);
+ Catalog catalog = hmsAuth == null
+ ? new HiveCatalog(fileIO, hiveConf, clientClass, options,
warehousePath.toUri().toString())
+ : hmsAuth.doAs(() -> new HiveCatalog(
+ fileIO, hiveConf, clientClass, options,
warehousePath.toUri().toString()));
+ catalog = PaimonHmsClientPool.install(catalog, hmsAuth);
Review Comment:
Fixed. Paimon now normalizes Table.owner inside the HMS UGI immediately
before the createTable RPC, while format-table schema, location, and FileIO
preparation remain under the outer storage identity. Added a real
mixed-identity HiveCatalog format-table regression covering both identities and
the persisted owner.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]