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

David Mollitor edited comment on HIVE-19064 at 4/30/20, 1:20 PM:
-----------------------------------------------------------------

{code:none}
+fragment
+QuotedIdentifier
+    :
+    ('"'  ( '""' | ~('"') )* '"') { 
setText(StringUtils.replace(getText().substring(1, getText().length() -1 ), 
"\"\"", "\"")); }
+    | ('`'  ( '``' | ~('`') )* '`') { 
setText(StringUtils.replace(getText().substring(1, getText().length() -1 ), 
"``", "`")); }
+    ;
{code}

Right now, the subsisting is happening in the parser, perhaps it's better to do 
this processing in the Java code instead.

Right now, any time you want to generate a table name for output, or error 
message, or logging, you have to pass the context around everywhere with the 
"mode" in order to reconstruct the table names with the proper quotes around it 
and to re-insert any escape characters.  If you preserve the raw token, it's 
probably going to be much easier to send that around to the various places that 
need it then to have to re-generate it on the fly every time.

It's easy to detect what the quote character used was, just have to examine the 
first character, you don't even need to pass the context around.


was (Author: belugabehr):
{code:none}
+fragment
+QuotedIdentifier
+    :
+    ('"'  ( '""' | ~('"') )* '"') { 
setText(StringUtils.replace(getText().substring(1, getText().length() -1 ), 
"\"\"", "\"")); }
+    | ('`'  ( '``' | ~('`') )* '`') { 
setText(StringUtils.replace(getText().substring(1, getText().length() -1 ), 
"``", "`")); }
+    ;
{code}

Right now, the subsisting is happening in the parser, perhaps it's better to do 
this processing in the Java code instead.

Right now, any time you want to generate a table name for output, or error 
message, or logging, you have to pass the context around everywhere with the 
"mode" in order to reconstruct the table names with the proper quotes around it 
and to re-insert any escape characters.  If you preserve the raw token, it's 
probably going to be much easier to send that around to the various places that 
need it then to have to re-generate it on the fly every time.

> Add mode to support delimited identifiers enclosed within double quotation
> --------------------------------------------------------------------------
>
>                 Key: HIVE-19064
>                 URL: https://issues.apache.org/jira/browse/HIVE-19064
>             Project: Hive
>          Issue Type: Improvement
>          Components: Parser, SQL
>    Affects Versions: 3.0.0
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Krisztian Kasa
>            Priority: Major
>         Attachments: HIVE-19064.01.patch, HIVE-19064.02.patch, 
> HIVE-19064.03.patch, HIVE-19064.10.patch, HIVE-19064.4.patch, 
> HIVE-19064.5.patch, HIVE-19064.6.patch, HIVE-19064.7.patch, 
> HIVE-19064.7.patch, HIVE-19064.8.patch, HIVE-19064.9.patch
>
>
> As per SQL standard. Hive currently uses `` (backticks). Default will 
> continue being backticks, but we will support identifiers within double 
> quotation via configuration parameter.
> This issue will also extends support for arbitrary char sequences, e.g., 
> containing {{~ ! @ # $ % ^ & * () , < >}}, in database and table names. 
> Currently, special characters are only supported for column names.



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

Reply via email to