abstractdog commented on code in PR #5642:
URL: https://github.com/apache/hive/pull/5642#discussion_r1975633656
##########
ql/src/java/org/apache/hadoop/hive/ql/queryhistory/repository/IcebergRepository.java:
##########
@@ -53,17 +55,41 @@
import java.util.Map;
import java.util.Queue;
import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
public class IcebergRepository extends AbstractRepository implements
QueryHistoryRepository {
private static final Logger LOG =
LoggerFactory.getLogger(IcebergRepository.class);
private static final String ICEBERG_STORAGE_HANDLER =
"org.apache.iceberg.mr.hive.HiveIcebergStorageHandler";
+ private static final String ICEBERG_WORKER_THREAD_NAME_FORMAT =
"query-history-iceberg-worker-pool-%d";
private HiveOutputFormat<?, ?> outputFormat;
private Serializer serializer;
@VisibleForTesting
HiveStorageHandler storageHandler;
@VisibleForTesting
TableDesc tableDesc;
+ private ExecutorService icebergExecutor;
+
+ @Override
+ public void init(HiveConf conf, Schema schema) {
+ super.init(conf, schema);
+ icebergExecutor = Executors.newFixedThreadPool(getIcebergWorkerPoolSize(),
+ (new
ThreadFactoryBuilder()).setDaemon(true).setNameFormat(ICEBERG_WORKER_THREAD_NAME_FORMAT).build());
+ }
+
+ /**
+ * Calculates the pool size for the ExecutorService to be passed to the
committer.
+ * The thread pool adheres to the configuration settings for Iceberg worker
pools.
+ * @return pool size for iceberg worker pool
+ */
+ private int getIcebergWorkerPoolSize() {
+ String value = System.getProperty("iceberg.worker.num-threads");
Review Comment:
okay, using 2 threads will keep this simpler
--
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]