FAQ
I have recently installed CDH4 using Cloudera Manager.
I have Hive installed as well.

The issue I am having is referencing hdfs location on Hive Create external
table command.

Here are the steps I am using:

a. Use hadoop fs -put test.txt command (test.txt exists and is formatted
correctly)
b. In Hive I am going in and executing the following:

CREATE TABLE test
(
SERIES_ID STRING,
TEST_ID STRING
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\|' ESCAPED BY '\\'
STORED AS TEXTFILE
LOCATION '/test.txt';

I get no error.
but when i do count it is 0 records.

What am I doing wrong?

Thanks, Ram

Search Discussions

  • Ram Krishnamurthy at Nov 19, 2012 at 9:36 pm
    Correction: Create external table test.

    Ram
    On Monday, November 19, 2012 4:29:04 PM UTC-5, Ram Krishnamurthy wrote:

    I have recently installed CDH4 using Cloudera Manager.
    I have Hive installed as well.

    The issue I am having is referencing hdfs location on Hive Create external
    table command.

    Here are the steps I am using:

    a. Use hadoop fs -put test.txt command (test.txt exists and is formatted
    correctly)
    b. In Hive I am going in and executing the following:

    CREATE TABLE test
    (
    SERIES_ID STRING,
    TEST_ID STRING
    )
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY '\|' ESCAPED BY '\\'
    STORED AS TEXTFILE
    LOCATION '/test.txt';

    I get no error.
    but when i do count it is 0 records.

    What am I doing wrong?

    Thanks, Ram
  • Mark Grover at Nov 19, 2012 at 9:42 pm
    Hi Ram,
    When you create a hive table, please refer to the directory your data is
    present in (instead of the actual file that contains the data).

    Please update the LOCATION in your CREATE TABLE statement and give it a
    shot.


    Thanks,
    Mark
    On Mon, Nov 19, 2012 at 1:30 PM, Ram Krishnamurthy wrote:

    Correction: Create external table test.

    Ram

    On Monday, November 19, 2012 4:29:04 PM UTC-5, Ram Krishnamurthy wrote:

    I have recently installed CDH4 using Cloudera Manager.
    I have Hive installed as well.

    The issue I am having is referencing hdfs location on Hive Create
    external table command.

    Here are the steps I am using:

    a. Use hadoop fs -put test.txt command (test.txt exists and is formatted
    correctly)
    b. In Hive I am going in and executing the following:

    CREATE TABLE test
    (
    SERIES_ID STRING,
    TEST_ID STRING
    )
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY '\|' ESCAPED BY '\\'
    STORED AS TEXTFILE
    LOCATION '/test.txt';

    I get no error.
    but when i do count it is 0 records.

    What am I doing wrong?

    Thanks, Ram
  • Wojciech Langiewicz at Nov 20, 2012 at 3:43 pm
    Hi,
    Could you show what exectly command you used to load data into HDFS?

    The command: hadoop fs -put test.txt whould generally put this file into
    user's directory under /user/XYZ/test.txt where XYZ is your username,
    and you might need something like that:
    hadoop fs -put test.txt /text.txt

    On 19.11.2012 22:29, Ram Krishnamurthy wrote:
    I have recently installed CDH4 using Cloudera Manager.
    I have Hive installed as well.

    The issue I am having is referencing hdfs location on Hive Create external
    table command.

    Here are the steps I am using:

    a. Use hadoop fs -put test.txt command (test.txt exists and is formatted
    correctly)
    b. In Hive I am going in and executing the following:

    CREATE TABLE test
    (
    SERIES_ID STRING,
    TEST_ID STRING
    )
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY '\|' ESCAPED BY '\\'
    STORED AS TEXTFILE
    LOCATION '/test.txt';

    I get no error.
    but when i do count it is 0 records.

    What am I doing wrong?

    Thanks, Ram

    --
    Wojciech Langiewicz

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupscm-users @
categorieshadoop
postedNov 19, '12 at 9:29p
activeNov 20, '12 at 3:43p
posts4
users3
websitecloudera.com
irc#hadoop

People

Translate

site design / logo © 2022 Grokbase