Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comments not working in hive CLI

Tags:

comments

hive

I have seen other posts saying that double hyphen -- should be a hive comment. But at least within the hive CLI that is not working properly;

hive> -- some comment;
FAILED: Parse Error: line 0:-1 cannot recognize input near '<EOF>' '<EOF>' '<EOF>'

Even in Eduardo Capriolo's book he says the same:

As of Hive v0.8.0, you can embed lines of comments that start with the string --,
for example:
-- Copyright (c) 2012 Megacorp, LLC.
-- This is the best Hive script evar!

The version is apparently 0.8.1 (I am using latest Amazon EMR)

hadoop@ip-10-114-113-44:~$ hive
bin is /home/hadoop/.versions/hive-0.8.1/bin
like image 587
WestCoastProjects Avatar asked Mar 24 '13 04:03

WestCoastProjects


People also ask

How do you comment on a line in hive?

Just use -- two dashes to make a comment in hive.

Is line comments supported in hive script?

No, Multi-line comments are not supported in Hive.

How do you add a comment to a hive table?

CREATE TABLE orders ( order_id INT COMMENT 'Unique order id', order_date STRING COMMENT 'Date on which order is placed', order_customer_id INT COMMENT 'Customer id who placed the order', order_status STRING COMMENT 'Current status of the order' ) COMMENT 'Table to save order level details';


1 Answers

Case is simple Hive accepts comments but not as a single line. If you try:

--comment
show tables;

or

show tables
--comment;

everything will be fine. GL with Hive struggle!

like image 92
www Avatar answered Nov 08 '22 21:11

www