Hadoop/Hive : Loading data from .csv on a local machine

后端 未结 6 1386
不知归路
不知归路 2020-12-24 05:20

As this is coming from a newbie...

I had Hadoop and Hive set up for me, so I can run Hive queries on my computer accessing data on AWS cluster. Can I run Hive querie

6条回答
  •  暖寄归人
    2020-12-24 06:09

    There is another way of enabling this,

    1. use hadoop hdfs -copyFromLocal to copy the .csv data file from your local computer to somewhere in HDFS, say '/path/filename'

    2. enter Hive console, run the following script to load from the file to make it as a Hive table. Note that '\054' is the ascii code of 'comma' in octal number, representing fields delimiter.


    CREATE EXTERNAL TABLE table name (foo INT, bar STRING)
     COMMENT 'from csv file'
     ROW FORMAT DELIMITED FIELDS TERMINATED BY '\054'
     STORED AS TEXTFILE
     LOCATION '/path/filename';
    

提交回复
热议问题