xmarker commented on a change in pull request #15354:
URL: https://github.com/apache/flink/pull/15354#discussion_r602077909



##########
File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/codegen/CodeGenUtils.scala
##########
@@ -116,15 +116,28 @@ object CodeGenUtils {
 
   // 
----------------------------------------------------------------------------------------
 
-  private val nameCounter = new AtomicInteger
+  private val nameCounter = new AtomicLong
+
+  private def newNameSuffixNumber(): Long = {
+    val newNameCounter = nameCounter.getAndIncrement
+    if (newNameCounter < 0) {
+      // should we throw a Exception here in case duplicate suffix number ?
+      synchronized {
+        nameCounter.set(0)
+      }
+      nameCounter.getAndIncrement
+    } else {
+      newNameCounter
+    }
+  }
 
   def newName(name: String): String = {
-    s"$name$$${nameCounter.getAndIncrement}"
+    s"$name$$${newNameSuffixNumber()}"

Review comment:
       Sorry just saw the comment,i agree with you,but check less than zero may 
be very lightweith,
   and we should generate a unique class name in theoretically,but the generate 
classes exceed Long.MAX_VALUE may be also a problem




-- 
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:
[email protected]


Reply via email to