You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/11/30 23:54:13 UTC
[GitHub] [kafka] hachikuji commented on a diff in pull request #12929: MINOR; Use Option to check for null values
hachikuji commented on code in PR #12929:
URL: https://github.com/apache/kafka/pull/12929#discussion_r1036561426
##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -2749,13 +2749,12 @@ class KafkaApis(val requestChannel: RequestChannel,
)
}
- val partitionsOpt = listPartitionReassignmentsRequest.data.topics match {
- case topics: Any =>
- Some(topics.iterator().asScala.flatMap { topic =>
- topic.partitionIndexes.iterator().asScala
- .map { tp => new TopicPartition(topic.name(), tp) }
- }.toSet)
- case _ => None
+ val partitionsOpt = Option(listPartitionReassignmentsRequest.data.topics).map { topics =>
+ topics.iterator().asScala.flatMap { topic =>
+ topic.partitionIndexes.iterator().asScala.map { tp =>
Review Comment:
nit: usually `tp` is reserved for `TopicPartition` instances, which makes this code look a bit funny. Perhaps we could rename the variable to `partitionIndex`?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org