Reply
New Contributor
Posts: 2
Registered: ‎04-30-2017

Hive : Special Character Column in a table

Hi Team,

 

What i'm trying:

 

- To create a table that has a special character column in Hive.  iam getting an error due to hive doesn't support a special character column.

 

Ex: Create external table tbl1 (Sales$ float)

 

Why I need: iam trying to pull data from Sql server as it's the source where in the column has special char and i'm trying to replicate the source schema in Hive. iam using Sqoop tool to pull data from sql server and have it on the Hadoop.. since i create the external table in hive and  it's refering to that hdfs path for data.

 

Kindly help..

 

Thank you

 

Posts: 257
Topics: 11
Kudos: 39
Solutions: 24
Registered: ‎09-02-2016

Re: Hive : Special Character Column in a table

@bdgreek

 

Try this

 

Create external table tbl1 (`Sales$` float)

New Contributor
Posts: 2
Registered: ‎04-30-2017

Re: Hive : Special Character Column in a table

[ Edited ]

yes, i'm able to create it with the backticks.. if i try describe formatted tablename. i see that $ sign is replaced by underscore (_)..

column name : Sales_

i read the column names from hive tables and pass it to source table via sqoop.. in that case, Sales_ column is not present in the source, so im getting an error  saying Sales_ invalid column at the source side ,even though i create a column with back ticks in hive.

Posts: 257
Topics: 11
Kudos: 39
Solutions: 24
Registered: ‎09-02-2016

Re: Hive : Special Character Column in a table

@bdgreek

 

I tried the below queries and it shows the column as created (Sales$). Not sure it is due to your version

 

 

create table mydb.test1 (`Sales$` float) 
describe formatted mydb.test1
describe mydb.test1

 

 

Announcements
New Solutions