Support Questions

Find answers, ask questions, and share your expertise

Can parquet file columns and columns of Hive external table created on the files have different name

avatar
New Contributor

I have a parquet file with the following three columns

Emp_ID

Emp_Name

Emp_Location


Now I was to create a Hive External Table on top of that file using the below query

CREATE EXTERNAL TABLE if not exists {db_name}.{table_name}

(

`c_Emp_ID` STRING,

`c_Emp_Name` STRING,

`c_Emp_Location` STRING

)

STORED AS PARQUET LOCATION '{File Location in HDFS}'

TBLPROPERTIES ('PARQUET.COMPRESS'='SNAPPY').


The table is being created and I am able to query the table, but all the data are coming as NULL.


Where as if I am using the below create table statement by keeping the column name of the table and parquet file as same, then can see the data properly by querying the table


CREATE EXTERNAL TABLE if not exists {db_name}.{table_name}

(

`Emp_ID` STRING,

`Emp_Name` STRING,

`Emp_Location` STRING

) STORED AS PARQUET LOCATION '{File Location in HDFS}'

TBLPROPERTIES ('PARQUET.COMPRESS'='SNAPPY').


Am I missing some setting? or this is how it is superposed to be?


1 REPLY 1

avatar
New Contributor

Hi, I am facing the same issue. Different case columns work for me, but different column names doesn't work.