|
首先,我们新打开一个终端,进入hadoop用户中:
然后我们在这个目录下新建一个word.txt文档,作为我们的数据文件:
往其中随意输入:
- hello world and shiyanlou
- hello shiyanlou
- hello hadoop
- hello student
- hello teacher
复制代码
保存退出之后,我们重新回到hive命令行中,我们创建一个text表:
- create table text(line string);
复制代码
将数据加载到该表中:
- load data local inpath '/home/hadoop/word.txt' into table text;
复制代码
注意:使用load函数时,如果从本地加载到hive表中,需要使用关键字local,它会将文件同时上传到hdfs系统中。
查看text表:
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|