[jira] [Commented] (HADOOP-17115) Replace Guava initialization of Sets.newHashSet
[ https://issues.apache.org/jira/browse/HADOOP-17115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17339830#comment-17339830 ] Ahmed Hussein commented on HADOOP-17115: Thanks [~vjasani]! Sure feel free to work on it. > Replace Guava initialization of Sets.newHashSet > --- > > Key: HADOOP-17115 > URL: https://issues.apache.org/jira/browse/HADOOP-17115 > Project: Hadoop Common > Issue Type: Sub-task >Reporter: Ahmed Hussein >Assignee: Viraj Jasani >Priority: Major > > Unjustified usage of Guava API to initialize a {{HashSet}}. This should be > replaced by Java APIs. > {code:java} > Targets > Occurrences of 'Sets.newHashSet' in project > Found Occurrences (223 usages found) > org.apache.hadoop.crypto.key (2 usages found) > TestValueQueue.java (2 usages found) > testWarmUp() (2 usages found) > 106 Assert.assertEquals(Sets.newHashSet("k1", "k2", "k3"), > 107 Sets.newHashSet(fillInfos[0].key, > org.apache.hadoop.crypto.key.kms (6 usages found) > TestLoadBalancingKMSClientProvider.java (6 usages found) > testCreation() (6 usages found) > 86 > assertEquals(Sets.newHashSet("http://host1:9600/kms/foo/v1/;), > 87 Sets.newHashSet(providers[0].getKMSUrl())); > 95 > assertEquals(Sets.newHashSet("http://host1:9600/kms/foo/v1/;, > 98 Sets.newHashSet(providers[0].getKMSUrl(), > 108 > assertEquals(Sets.newHashSet("http://host1:9600/kms/foo/v1/;, > 111 Sets.newHashSet(providers[0].getKMSUrl(), > org.apache.hadoop.crypto.key.kms.server (1 usage found) > KMSAudit.java (1 usage found) > 59 static final Set AGGREGATE_OPS_WHITELIST = > Sets.newHashSet( > org.apache.hadoop.fs.s3a (1 usage found) > TestS3AAWSCredentialsProvider.java (1 usage found) > testFallbackToDefaults() (1 usage found) > 183 Sets.newHashSet()); > org.apache.hadoop.fs.s3a.auth (1 usage found) > AssumedRoleCredentialProvider.java (1 usage found) > AssumedRoleCredentialProvider(URI, Configuration) (1 usage found) > 113 Sets.newHashSet(this.getClass())); > org.apache.hadoop.fs.s3a.commit.integration (1 usage found) > ITestS3ACommitterMRJob.java (1 usage found) > test_200_execute() (1 usage found) > 232 Set expectedKeys = Sets.newHashSet(); > org.apache.hadoop.fs.s3a.commit.staging (5 usages found) > TestStagingCommitter.java (3 usages found) > testSingleTaskMultiFileCommit() (1 usage found) > 341 Set keys = Sets.newHashSet(); > runTasks(JobContext, int, int) (1 usage found) > 603 Set uploads = Sets.newHashSet(); > commitTask(StagingCommitter, TaskAttemptContext, int) (1 usage > found) > 640 Set files = Sets.newHashSet(); > TestStagingPartitionedTaskCommit.java (2 usages found) > verifyFilesCreated(PartitionedStagingCommitter) (1 usage found) > 148 Set files = Sets.newHashSet(); > buildExpectedList(StagingCommitter) (1 usage found) > 188 Set expected = Sets.newHashSet(); > org.apache.hadoop.hdfs (5 usages found) > DFSUtil.java (2 usages found) > getNNServiceRpcAddressesForCluster(Configuration) (1 usage found) > 615 Set availableNameServices = Sets.newHashSet(conf > getNNLifelineRpcAddressesForCluster(Configuration) (1 usage > found) > 660 Set availableNameServices = Sets.newHashSet(conf > MiniDFSCluster.java (1 usage found) > 597 private Set fileSystems = Sets.newHashSet(); > TestDFSUtil.java (2 usages found) > testGetNNServiceRpcAddressesForNsIds() (2 usages found) > 1046 assertEquals(Sets.newHashSet("nn1"), internal); > 1049 assertEquals(Sets.newHashSet("nn1", "nn2"), all); > org.apache.hadoop.hdfs.net (5 usages found) > TestDFSNetworkTopology.java (5 usages found) > testChooseRandomWithStorageType() (4 usages found) > 277 Sets.newHashSet("host2", "host4", "host5", "host6"); > 278 Set archiveUnderL1 = Sets.newHashSet("host1", > "host3"); > 279 Set ramdiskUnderL1 = Sets.newHashSet("host7"); > 280 Set ssdUnderL1 = Sets.newHashSet("host8"); > testChooseRandomWithStorageTypeWithExcluded() (1 usage found) > 363 Set expectedSet = Sets.newHashSet("host4", > "host5"); > org.apache.hadoop.hdfs.qjournal.server (2 usages found) > JournalNodeSyncer.java (2 usages found) >
[jira] [Commented] (HADOOP-17115) Replace Guava initialization of Sets.newHashSet
[ https://issues.apache.org/jira/browse/HADOOP-17115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17339820#comment-17339820 ] Viraj Jasani commented on HADOOP-17115: --- [~ahussein] I think this makes sense. If you are fine, can I take this up? Other than Sets.newHashSet, we also have lots of Maps.newHashMap. Since no of occurrences are quite high, I believe we should have another subtask of parent Jira, I can create and assign to myself if you don't mind. Thanks > Replace Guava initialization of Sets.newHashSet > --- > > Key: HADOOP-17115 > URL: https://issues.apache.org/jira/browse/HADOOP-17115 > Project: Hadoop Common > Issue Type: Sub-task >Reporter: Ahmed Hussein >Priority: Major > > Unjustified usage of Guava API to initialize a {{HashSet}}. This should be > replaced by Java APIs. > {code:java} > Targets > Occurrences of 'Sets.newHashSet' in project > Found Occurrences (223 usages found) > org.apache.hadoop.crypto.key (2 usages found) > TestValueQueue.java (2 usages found) > testWarmUp() (2 usages found) > 106 Assert.assertEquals(Sets.newHashSet("k1", "k2", "k3"), > 107 Sets.newHashSet(fillInfos[0].key, > org.apache.hadoop.crypto.key.kms (6 usages found) > TestLoadBalancingKMSClientProvider.java (6 usages found) > testCreation() (6 usages found) > 86 > assertEquals(Sets.newHashSet("http://host1:9600/kms/foo/v1/;), > 87 Sets.newHashSet(providers[0].getKMSUrl())); > 95 > assertEquals(Sets.newHashSet("http://host1:9600/kms/foo/v1/;, > 98 Sets.newHashSet(providers[0].getKMSUrl(), > 108 > assertEquals(Sets.newHashSet("http://host1:9600/kms/foo/v1/;, > 111 Sets.newHashSet(providers[0].getKMSUrl(), > org.apache.hadoop.crypto.key.kms.server (1 usage found) > KMSAudit.java (1 usage found) > 59 static final Set AGGREGATE_OPS_WHITELIST = > Sets.newHashSet( > org.apache.hadoop.fs.s3a (1 usage found) > TestS3AAWSCredentialsProvider.java (1 usage found) > testFallbackToDefaults() (1 usage found) > 183 Sets.newHashSet()); > org.apache.hadoop.fs.s3a.auth (1 usage found) > AssumedRoleCredentialProvider.java (1 usage found) > AssumedRoleCredentialProvider(URI, Configuration) (1 usage found) > 113 Sets.newHashSet(this.getClass())); > org.apache.hadoop.fs.s3a.commit.integration (1 usage found) > ITestS3ACommitterMRJob.java (1 usage found) > test_200_execute() (1 usage found) > 232 Set expectedKeys = Sets.newHashSet(); > org.apache.hadoop.fs.s3a.commit.staging (5 usages found) > TestStagingCommitter.java (3 usages found) > testSingleTaskMultiFileCommit() (1 usage found) > 341 Set keys = Sets.newHashSet(); > runTasks(JobContext, int, int) (1 usage found) > 603 Set uploads = Sets.newHashSet(); > commitTask(StagingCommitter, TaskAttemptContext, int) (1 usage > found) > 640 Set files = Sets.newHashSet(); > TestStagingPartitionedTaskCommit.java (2 usages found) > verifyFilesCreated(PartitionedStagingCommitter) (1 usage found) > 148 Set files = Sets.newHashSet(); > buildExpectedList(StagingCommitter) (1 usage found) > 188 Set expected = Sets.newHashSet(); > org.apache.hadoop.hdfs (5 usages found) > DFSUtil.java (2 usages found) > getNNServiceRpcAddressesForCluster(Configuration) (1 usage found) > 615 Set availableNameServices = Sets.newHashSet(conf > getNNLifelineRpcAddressesForCluster(Configuration) (1 usage > found) > 660 Set availableNameServices = Sets.newHashSet(conf > MiniDFSCluster.java (1 usage found) > 597 private Set fileSystems = Sets.newHashSet(); > TestDFSUtil.java (2 usages found) > testGetNNServiceRpcAddressesForNsIds() (2 usages found) > 1046 assertEquals(Sets.newHashSet("nn1"), internal); > 1049 assertEquals(Sets.newHashSet("nn1", "nn2"), all); > org.apache.hadoop.hdfs.net (5 usages found) > TestDFSNetworkTopology.java (5 usages found) > testChooseRandomWithStorageType() (4 usages found) > 277 Sets.newHashSet("host2", "host4", "host5", "host6"); > 278 Set archiveUnderL1 = Sets.newHashSet("host1", > "host3"); > 279 Set ramdiskUnderL1 = Sets.newHashSet("host7"); > 280 Set ssdUnderL1 = Sets.newHashSet("host8"); > testChooseRandomWithStorageTypeWithExcluded() (1