Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

Highlighted

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

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?