[ 
https://issues.apache.org/jira/browse/HIVE-22929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17047054#comment-17047054
 ] 

Gopal Vijayaraghavan commented on HIVE-22929:
---------------------------------------------

{code}
 QuotedIdentifier 
     :
-    '`'  ( '``' | ~('`') )* '`' { setText(getText().substring(1, 
getText().length() -1 ).replaceAll("``", "`")); }
+    '`'  ( '``' | ~('`') )* '`' { 
setText(RegExUtils.replaceAll(getText().substring(1, getText().length() -1 ), 
QUOTED_REGEX, "`")); }
{code}

For the single literal case, what we needed to use was String.replace(), not a 
Regex.

> Performance: quoted identifier parsing uses throwaway Regex via 
> String.replaceAll()
> -----------------------------------------------------------------------------------
>
>                 Key: HIVE-22929
>                 URL: https://issues.apache.org/jira/browse/HIVE-22929
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Gopal Vijayaraghavan
>            Assignee: Krisztian Kasa
>            Priority: Major
>         Attachments: HIVE-22929.1.patch, String.replaceAll.png
>
>
>  !String.replaceAll.png! 
> https://github.com/apache/hive/blob/master/parser/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g#L530
> {code}
>     '`'  ( '``' | ~('`') )* '`' { setText(getText().substring(1, 
> getText().length() -1 ).replaceAll("``", "`")); }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to