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.
