user3419138
user3419138

Reputation: 23

How to create a Hive table with multiple hdfs files

So basically I would like to create a table containing csv files

I tried something like this where the filenames only differ from eachother by the two last digits :

CREATE EXTERNAL TABLE pageviews (page_date string,site string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n' STORED AS TEXTFILE LOCATION '/user/hue/201401/pageviews/supersite_1046_201401**.csv';

To me this syntax looks ok but when I execute it I get the following:

Error occurred executing hive query: Unknown exception.

Any help would be appreciated.

Upvotes: 2

Views: 4997

Answers (1)

René Nyffenegger
René Nyffenegger

Reputation: 40603

The LOCATION parameter of a hive's create table statement takes as argument a *hdfs_path* (See here). Such a path cannot be file path, but must be a directory path, hence the error you get.

In your case, you could put the required files under a specific directory und specify this very directory in the LOCATION clause of the create table statement.

Upvotes: 6

Related Questions