Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Text Format Difference with Ambari and Microsoft Azure

Explorer

Hello Community,

My apologies for the confusing subject question.

I have created the following hadoop hql script and deployed the script in both hadoop on Microsoft Azure and Ambari.

DROP TABLE IF EXISTS HiveSampleIn; 
CREATE EXTERNAL TABLE HiveSampleIn 
(
 anonid int,
 eprofileclass int,
 fueltypes STRING,
 acorn_category int,
 acorn_group STRING,
 acorn_type int,
 nuts4 STRING,
 lacode STRING,
 nuts1 STRING,
 gspgroup STRING,
 ldz STRING,
 gas_elec STRING,
 gas_tout STRING
) 
partitioned by ( acorn_category int, acorn_categorycount int)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '10' STORED AS TEXTFILE LOCATION 'wasb://adfgetstarted@geogstoreacct.blob.core.windows.net/samplein/'; 
DROP TABLE IF EXISTS HiveSampleOut; 
CREATE EXTERNAL TABLE HiveSampleOut 
(
acorn_category int,
acorn_categorycount int )
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '10' STORED AS TEXTFILE LOCATION 'wasb://adfgetstarted@geogstoreacct.blob.core.windows.net/sampleout/';
INSERT OVERWRITE TABLE HiveSampleOut
Select 
   acorn_category,
   count(*) as acorn_categorycount 
FROM HiveSampleIn Group by acorn_category

The results in Ambari provides a .csv file looks as follows:

(notice the column headings in RED)

56579-umba.png

However, in Azure the results are provided as a textfile (which is fine) but it doesn't have the column headings as shown

Can someone please let me know how to include the column headings in the textfile?

56580-umbari2.png

1 REPLY 1

I believe when you say "on Azure", you actually mean you are using Hive shell(or beeline shell) from a node of Azure HDInsight cluster. In that case, add the following line in the beginning of your .hql script.

set hive.cli.print.header=true;
Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.