srowen commented on a change in pull request #31096:
URL: https://github.com/apache/spark/pull/31096#discussion_r555826624



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParserUtils.scala
##########
@@ -172,6 +172,20 @@ object ParserUtils {
           }
           sb.append(code.asInstanceOf[Char])
           i += 5
+        } else if ((i + 10 < strLength) && b.charAt(i + 1) == 'U' &&
+                   (2 until 10).forall(j => Character.digit(b.charAt(i + j), 
16) != -1)) {
+          // \U00000000 style 32-bit unicode character literals.
+
+          val codePoint = Integer.parseInt(b.substring(i + 2, i + 10), 16)

Review comment:
       Actually, a comment: Do you need to treat this as 'unsigned'? if it's 
more than 2^31 - 1, then it will become negative, and I'm not sure checks below 
work.

##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParserUtils.scala
##########
@@ -172,6 +172,20 @@ object ParserUtils {
           }
           sb.append(code.asInstanceOf[Char])
           i += 5
+        } else if ((i + 10 < strLength) && b.charAt(i + 1) == 'U' &&

Review comment:
       We could use a regex here too; might be faster. But if this isn't a hot 
path, probably won't matter.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to