JoshRosen commented on code in PR #46894:
URL: https://github.com/apache/spark/pull/46894#discussion_r1630719303


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/ExternalCatalogUtils.scala:
##########
@@ -63,22 +63,26 @@ object ExternalCatalogUtils {
     bitSet
   }
 
-  def needsEscaping(c: Char): Boolean = {
+  @inline private final def needsEscaping(c: Char): Boolean = {

Review Comment:
   I think we could improve my original solution a bit by doing something like
   
   ```
   } else if (builder ne null) {
     // Character does not need escaping but some earlier character did:
     builder.append(c)
   }
   ```
   
   but in further optimization I also found that the hex string conversion was 
expensive. After a bit more tinkering I ended up agreeing with your original 
approach of `indexWhere` since it avoids branching in the "escaping needed" 
loop.



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

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