Support Questions

Find answers, ask questions, and share your expertise

HIve not loading escape character (\)

avatar
Contributor

We have some data that has a backslash (\) and noticed that when loading into Hive, it treats it as an escape character. Is there a way to get around it treating this as an escape character?

I have tried replacing a single backslash with 2 backslashes and it still give me the same result.

The only other thing i could think of doing is just replacing the backslash with the encoded version of that value.

1 ACCEPTED SOLUTION

avatar

@Jesse Passwaters @Takahiko Saito Please take a look at

https://documentation.altiscale.com/using-csv-serde-with-hive It has example of how to use a different escape character.

View solution in original post

9 REPLIES 9

avatar
@Jesse Passwaters

How are you loading your data to Hive ? If you are using Sqoop, then you need to take a look at

https://sqoop.apache.org/docs/1.4.0-incubating/SqoopUserGuide.html#id1765770

avatar
Contributor

@Shishir Saxena

We are loading the data from an external table via the CSVSerde. In the temp table we can view the backslashes, but once we load it into the ORC format via the CSVSerde the backslashes, no matter how many there are, they disappear.

avatar
Contributor

Let me clarify - the external table is using the CSVSerde to read the data and then we are loading an ORC table which uses the OrcSerde

avatar
Expert Contributor

Can you use ESCAPED BY '\' when you create an ORC table and load from the external table?

avatar
Contributor

@Takahiko Saito

I've seen where you can do that with the CSVSerde, but haven't found anything that states that you could use that with the OrcSerde. Do you have any examples?

avatar

@Jesse Passwaters @Takahiko Saito Please take a look at

https://documentation.altiscale.com/using-csv-serde-with-hive It has example of how to use a different escape character.

avatar
Contributor

@Shishir Saxena - That worked! I previously saw that but just didn't think that would solve it.

avatar
New Contributor

I was not able to open the link :https://documentation.altiscale.com/using-csv-serde-with-hive

Could you p[lease provide the correct link or provide me the solution which would be helpful.

avatar
New Contributor

@Shishir Saxena: This link is not working

https://documentation.altiscale.com/using-csv-serde-with-hive It has example of how to use a different escape character.

Can you post the contents of the above link here? or give a different link that works?