hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas Rapp <dougma...@gmail.com>
Subject Re: Escaped Quotes
Date Wed, 30 Mar 2016 21:08:09 GMT
That's what I meant - I apologize for the poor wording. I am using JDBC to
programmatically interact with Hive, and then also using beeline on the
command line for quick testing, and seeing the behavior in both cases.

I could have sworn that earlier testing that I had done using double-quotes
around string values resulted in an error, but testing your example above
just showed your same results. It seems when I wrap a string with
single-quotes, any escaped single-quotes within the string aren't truly
"escaped" - hence my original issue.

However, similar problem now - what about escaped double-quotes? Example:

INSERT INTO testme VALUES ("Doug said, \"Hello!\"")

Results in storing the string "Doug said, \"Hello!\"", rather than "Doug
said, "Hello"".

Thanks,
Doug


On Wed, Mar 30, 2016 at 1:44 PM, Mich Talebzadeh <mich.talebzadeh@gmail.com>
wrote:

> Curious to know why use JDBC and beeline to insert into Hive table rather
> than using Hive sql through beeline
>
> create table testme(col1 varchar(30));
> INSERT INTO testme VALUES ("Dougs' Diner");
> 0: jdbc:hive2://rhes564:10010/default> select * from testme;
> +---------------+--+
> |  testme.col1  |
> +---------------+--+
> | Dougs' Diner  |
> +---------------+--+
>
>
> Dr Mich Talebzadeh
>
>
>
> LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
> <https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>*
>
>
>
> http://talebzadehmich.wordpress.com
>
>
>
> On 30 March 2016 at 19:15, Douglas Rapp <dougman82@gmail.com> wrote:
>
>> Hi,
>>
>> I use JDBC and the beeline client to interact with a Hive 1.2.1 store.
>>
>> I have some string data that contains single quotes (as well as other
>> special characters) that requires being escaped in order to be inserted
>> into my tables. For example, the string "Doug's Diner":
>>
>> INSERT INTO my_table (some_col) VALUES ('Doug\'s Diner')
>>
>> What I am finding is that the single quote inside the string data is not
>> merely escaped to get through the interface, but the escape character
>> itself (the backslash) is also getting stored as part of the string. In
>> other words, when I select the data out of my_table, I get "Doug\'s Diner"
>> rather than "Doug's Diner".
>>
>> Is this expected behavior with Hive?
>>
>> Thanks,
>> Doug
>>
>
>

Mime
View raw message