Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive >> mail # user >> Query


+
Venugopal Krishnan 2012-10-23, 05:56
+
Savant, Keshav 2012-10-23, 06:13
+
Venugopal Krishnan 2012-10-23, 06:24
+
Savant, Keshav 2012-10-23, 06:46
Hi Venugopal

If you like to have your column names along with result set you need to set 'hive.cli.print.header' to true.

SET hive.cli.print.header=true;

It works well over CLI, I have not tried it over jdbc.

Regards
Bejoy KS

Sent from handheld, please excuse typos.

-----Original Message-----
From: "Savant, Keshav" <[EMAIL PROTECTED]>
Date: Tue, 23 Oct 2012 06:46:08
To: Venugopal Krishnan<[EMAIL PROTECTED]>; [EMAIL PROTECTED]<[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: RE: Query

Hi Krishnan,

Generally hive clients do not support this option (check your one once), if not then for your hive client you can try overriding default behavior and implement the below suggestion (if it is open source). We did it for some of our projects, we externalized a property that specifies that whether we need to print column header or not, and code that handles that property, that worked pretty well at our end.
Kind regards,
Keshav C Savant

From: Venugopal Krishnan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 23, 2012 11:55 AM
To: Savant, Keshav; [EMAIL PROTECTED]
Subject: RE: Query

Hi Savant,

Thanks for your reply . we are trying this option also but we are using the below query from the hive client which generates a text file on the cluster. Is it not possible to generate the column headers in the text file ?  with the default query without using metadata of resultset.

insert overwrite directory '/user/hdev/temp'  select * from customer .

Regards,
Venu

From: Savant, Keshav [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 23, 2012 11:43 AM
To: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>; Venugopal Krishnan
Subject: RE: Query

Hi Krishnan,

To do this dynamically for any query....

Check if hive JDBC driver supports/provides the metadata for the result set, if yes then u can get the metadata of resultset, get its column count, and then you can get column names, types etc.

http://javasourcecode.org/html/open-source/hive/hive-0.7.1/org/apache/hadoop/hive/jdbc/HiveResultSetMetaData.html

Kind regards,
Keshav
rom: Venugopal Krishnan [mailto:[EMAIL PROTECTED]]<mailto:[mailto:[EMAIL PROTECTED]]>
Sent: Tuesday, October 23, 2012 11:27 AM
To: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>
Subject: Query

Hi,

We have a requirement where we need to print the column headers in the generated file on executing a query. We are using Jdbc hive client to execute the query.

Regards,
Venugopal
________________________________

http://www.mindtree.com/email/disclaimer.html
_____________
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.

_____________
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.

+
MiaoMiao 2012-10-23, 05:59
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB