deniskuzZ commented on code in PR #6327:
URL: https://github.com/apache/hive/pull/6327#discussion_r2833693636


##########
standalone-metastore/metastore-rest-catalog/src/main/java/org/apache/iceberg/rest/standalone/StandaloneRESTCatalogServer.java:
##########
@@ -46,85 +47,107 @@
  * 
  * <p>Multiple instances can run behind a Kubernetes Service for load 
balancing.
  */
+@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)

Review Comment:
   can we refactor an extract configuration like
   ````
   @SpringConfiguration
   public class IcebergCatalogConfiguration {
       private static final Logger LOG = 
LoggerFactory.getLogger(IcebergCatalogConfiguration.class);
   
       private final Configuration conf;
   
       public IcebergCatalogConfiguration(Configuration conf) {
           this.conf = conf;
       }
   
       @Bean
       public Configuration hadoopConfiguration() {
           return conf;
       }
   
       @Bean
       public ServletRegistrationBean<HttpServlet> restCatalogServlet() {
           // Determine servlet path and port
           String servletPath = MetastoreConf.getVar(conf, 
ConfVars.ICEBERG_CATALOG_SERVLET_PATH);
           if (servletPath == null || servletPath.isEmpty()) {
               servletPath = "iceberg";
               MetastoreConf.setVar(conf, 
ConfVars.ICEBERG_CATALOG_SERVLET_PATH, servletPath);
           }
   
           int port = MetastoreConf.getIntVar(conf, 
ConfVars.CATALOG_SERVLET_PORT);
           if (port == 0) {
               port = 8080;
               MetastoreConf.setLongVar(conf, ConfVars.CATALOG_SERVLET_PORT, 
port);
           }
   
           LOG.info("Creating REST Catalog servlet at /{}", servletPath);
   
           // Create servlet from Iceberg factory
           var descriptor = HMSCatalogFactory.createServlet(conf);
           if (descriptor == null || descriptor.getServlet() == null) {
               throw new IllegalStateException("Failed to create Iceberg REST 
Catalog servlet");
           }
   
           return new ServletRegistrationBean<>(descriptor.getServlet(), "/" + 
servletPath + "/*");
       }
   }
   ````
   and then
   ````
   @SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
   public class StandaloneRESTCatalogServer {
   
       private static final Logger LOG = 
LoggerFactory.getLogger(StandaloneRESTCatalogServer.class);
   
       @Bean
       public Configuration hadoopConfiguration() {
           Configuration conf = MetastoreConf.newMetastoreConf();
           // Load system properties
           for (String prop : System.getProperties().stringPropertyNames()) {
               conf.set(prop, System.getProperty(prop));
           }
   
           // Validate mandatory config
           String thriftUris = MetastoreConf.getVar(conf, ConfVars.THRIFT_URIS);
           if (thriftUris == null || thriftUris.isEmpty()) {
               throw new IllegalArgumentException("metastore.thrift.uris must 
be configured to connect to HMS");
           }
   
           LOG.info("Hadoop Configuration initialized, HMS Thrift URIs: {}", 
thriftUris);
           return conf;
       }
   
       public static void main(String[] args) {
           SpringApplication.run(StandaloneRESTCatalogServer.class, args);
           LOG.info("Standalone REST Catalog Server started successfully");
       }
   }
   ````



-- 
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]

Reply via email to