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

Ramesh Kumar Thangarajan edited comment on HIVE-22889 at 2/18/20 11:33 PM:
---------------------------------------------------------------------------

[~ngangam]  Yes sure, when we hit the webhcat url with parameters for a query 
like below:
{code:java}
curl -i -k -v --negotiate -u : -X PUT -H Content-type:application/json -d 
'{"ifNotExists":"true","columns":[{"name":"archreqtsn","type":"decimal(23,0)","comment":"{DATATYPE:DEC}"}],"format":{"storedAs":"ORC"},"external":"true","location":"/tmp/table1","partitionedBy":[{"name":"`archpartid`","type":"string","comment":""}]}'
{code}
we used to trim the leading and trailing quotes for all the argument values and 
for the entire query in hcatalog(commons-cli) 1.2. In commons-cli 1.4, there 
was a change which restricts the trimming of leading and trailing quotes 
https://issues.apache.org/jira/browse/CLI-185. hcat-cli was dependent on this 
function from removing the quotes. But unfortunately with the upgrade from 1.2 
to 1.4 for commons-cli, it will no longer trim if there are any quotes in 
between the strip(apart from the leading and trailing quotes). Because there 
are malformed queries(with extra quotes at the front and back) passed to hive 
from hcat cli if the query contains quotes. In this change I am trying redo the 
function at 
[https://github.com/apache/commons-cli/blob/master/src/main/java/org/apache/commons/cli/Util.java#L63]
 in hcat cli, with restricted condition check. My My concern if we do this 
change on the 
[https://github.com/apache/commons-cli/blob/master/src/main/java/org/apache/commons/cli/Util.java#L63],
 then we might end up causing regressions on whoever using the commons-cli. So 
I anded up with this patch.


was (Author: rameshkumar):
Yes sure, when we hit the webhcat url with parameters for a query like below:
{code:java}
curl -i -k -v --negotiate -u : -X PUT -H Content-type:application/json -d 
'{"ifNotExists":"true","columns":[{"name":"archreqtsn","type":"decimal(23,0)","comment":"{DATATYPE:DEC}"}],"format":{"storedAs":"ORC"},"external":"true","location":"/tmp/table1","partitionedBy":[{"name":"`archpartid`","type":"string","comment":""}]}'
{code}
we used to trim the leading and trailing quotes for all the argument values and 
for the entire query in hcatalog(commons-cli) 1.2. In commons-cli 1.4, there 
was a change which restricts the trimming of leading and trailing quotes 
https://issues.apache.org/jira/browse/CLI-185. hcat-cli was dependent on this 
function from removing the quotes. But unfortunately with the upgrade from 1.2 
to 1.4 for commons-cli, it will no longer trim if there are any quotes in 
between the strip(apart from the leading and trailing quotes). Because there 
are malformed queries(with extra quotes at the front and back) passed to hive 
from hcat cli if the query contains quotes. In this change I am trying redo the 
function at 
[https://github.com/apache/commons-cli/blob/master/src/main/java/org/apache/commons/cli/Util.java#L63]
 in hcat cli, with restricted condition check. My My concern if we do this 
change on the 
[https://github.com/apache/commons-cli/blob/master/src/main/java/org/apache/commons/cli/Util.java#L63],
 then we might end up causing regressions on whoever using the commons-cli. So 
I anded up with this patch.

> Trim trailing and leading quotes for HCatCli query processing
> -------------------------------------------------------------
>
>                 Key: HIVE-22889
>                 URL: https://issues.apache.org/jira/browse/HIVE-22889
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Ramesh Kumar Thangarajan
>            Assignee: Ramesh Kumar Thangarajan
>            Priority: Major
>         Attachments: HIVE-22889.1.patch
>
>
> Trim trailing and leading quotes for HCatCli query processing



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

Reply via email to