deniskuzZ commented on code in PR #10661: URL: https://github.com/apache/iceberg/pull/10661#discussion_r1674554724
########## mr/src/test/java/org/apache/iceberg/mr/TestIcebergInputFormats.java: ########## @@ -381,6 +386,46 @@ public void testCustomCatalog() throws IOException { testInputFormat.create(builder.conf()).validate(expectedRecords); } + @TestTemplate + public void testWorkerPool() throws Exception { + // 1.The ugi in the same thread will not change + final ExecutorService workerPool1 = ThreadPools.newWorkerPool("iceberg-plan-worker-pool", 1); + UserGroupInformation user1 = + UserGroupInformation.createUserForTesting("user1", new String[] {}); + UserGroupInformation user2 = + UserGroupInformation.createUserForTesting("user2", new String[] {}); + assertThat(setAndGetUgi(user1, workerPool1)).isEqualTo("user1"); + assertThat(setAndGetUgi(user2, workerPool1)).isEqualTo("user1"); + workerPool1.shutdown(); + + // 2.The ugi in different threads will be different + final ExecutorService workerPool2 = ThreadPools.newWorkerPool("iceberg-plan-worker-pool", 1); + assertThat(setAndGetUgi(user2, workerPool2)).isEqualTo("user2"); + workerPool2.shutdown(); + } + + private String setAndGetUgi(UserGroupInformation ugi, ExecutorService workpool) Review Comment: @lurnagao-dahua, the test looks good to me, thanks for adding it! Unfortunately, I don't have committer rights in the iceberg project, but I'll add my +1 -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org