Hive PARTITIONED BY, list index out of range error?

I am running Hive and Hue on Cloudera. I have the following text file uploaded to hdfs. And I'm trying to create an external table in hive partitioned by id. For whatever reason, it's not working.

/user/test2/test.csv

id,name,age
1,sam,10
2,john,5
1,rick,4

Hive:

CREATE EXTERNAL TABLE IF NOT EXISTS testDB (
    name STRING,
    age  INT
)
COMMENT 'This is the test database'
PARTITIONED BY (id INT)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
LOCATION '/user/test2/'
TBLPROPERTIES ("skip.header.line.count" = "1");

On Hue, hive editor, when I tried to look at sample data, it says list index out of range. Not sure what this is. The external table will work correctly if I remove the partitioned by.

Answers


Your data located on '/user/test2/test.csv' is structured on three columns, but your schema defined for the table 'testDB' contains two columns, it is normal that you have this error. You have to update your script, by adding the id column:

CREATE EXTERNAL TABLE IF NOT EXISTS testDB (
    id INT,
    name STRING,
    age  INT
)
...

Need Your Help

Rich Text Field not visible in aspx page sharepoint 2010

sharepoint sharepoint-2010

I have added a SharePoint:RichTextField in my aspx page main content as follows. But when I open the page the Rich text box is not visible.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.