chia7712 commented on a change in pull request #10172:
URL: https://github.com/apache/kafka/pull/10172#discussion_r580767910



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.java
##########
@@ -132,6 +132,16 @@ public void setGroupInstanceId(Optional<String> 
groupInstanceId) {
         public Optional<String> groupInstanceId() {
             return groupInstanceId;
         }
+
+        @Override
+        public String toString() {
+            return "Subscription(" +
+                "topics=" + topics +
+                ", userData=" + userData +
+                ", ownedPartitions=" + ownedPartitions +
+                (groupInstanceId.isPresent() ? ", groupInstanceId=" + 
groupInstanceId.get() : "") +

Review comment:
       How about using lambda? `(groupInstanceId.map(s -> ", groupInstanceId=" 
+ s).orElse(""))`

##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.java
##########
@@ -132,6 +132,16 @@ public void setGroupInstanceId(Optional<String> 
groupInstanceId) {
         public Optional<String> groupInstanceId() {
             return groupInstanceId;
         }
+
+        @Override
+        public String toString() {
+            return "Subscription(" +
+                "topics=" + topics +
+                ", userData=" + userData +

Review comment:
       The type of `userData` is `ByteBuffer` so it makes no sense to print it 
by `toString`. Maybe we can print the size?

##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.java
##########
@@ -132,6 +132,16 @@ public void setGroupInstanceId(Optional<String> 
groupInstanceId) {
         public Optional<String> groupInstanceId() {
             return groupInstanceId;
         }
+
+        @Override
+        public String toString() {
+            return "Subscription(" +
+                "topics=" + topics +
+                ", userData=" + userData +
+                ", ownedPartitions=" + ownedPartitions +
+                (groupInstanceId.isPresent() ? ", groupInstanceId=" + 
groupInstanceId.get() : "") +

Review comment:
       For another, it seems to me "null" is more suitable than empty string.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to