大数据第五天(操作hive的方式)

文章目录

操作hive的方式

hive 存储位置

hive 操作语法

创建数据表的方式

-- 创建数据库

sql 复制代码
create database if not exists test

我们创建数据库表的时候,hive是将我们的数据自动添加到数据表中,但是需要我们注意,自动添加的方式我们需要按照特定格式添加到数据库中,\001添加到数据表中的方式

我们写一个案例的方式

我们这里可以看到SOH默认的制表是\001的方式,

我们这个soh是打不出来的,我们只能通过替换的方式

创建数据表

sql 复制代码
create table student(
    id int comment "id",
    name string comment "名字",
    age int comment "年龄"
) comment "学生表";

我们将数据库上传到hive中 ,查询数据库

上传hive中

shell 复制代码
 hadoop fs -put student.txt /user/hive/warehouse/test.db/student

查数据

sql 复制代码
select * from student;

本地加载数据

sql 复制代码
load data local inpath '/root/hivedata/student.txt' into table student;

2024-04-23 17:40:35\] org.apache.hadoop.hive.ql.parse.SemanticException:Line 1:23 Invalid path ''/root/hivedata/student.txt'': No files matching path file:/root/hivedata/student.txt ![在这里插入图片描述](https://file.jishuzhan.net/article/1785642731364683778/2047cf6862bdd298c7afc3802ff5ebb8.webp) 成功解决了 刚才问题有点尴尬是这样的一个问题 我们连接是hive的hadoop03的服务器但是我们操作hadoop01服务器哎

相关推荐
武子康7 小时前
大数据-184 Elasticsearch Doc Values 机制详解:列式存储如何支撑排序/聚合/脚本
大数据·后端·elasticsearch
expect7g7 小时前
Paimon源码解读 -- Compaction-8.专用压缩任务
大数据·后端·flink
良策金宝AI9 小时前
从CAD插件到原生平台:工程AI的演进路径与智能协同新范式
大数据·人工智能
康实训10 小时前
智慧老年实训室建设核心方案
大数据·实训室·养老实训室·实训室建设
min18112345610 小时前
分公司组织架构图在线设计 总部分支管理模板
大数据·人工智能·信息可视化·架构·流程图
周杰伦_Jay10 小时前
【Elasticsearch】核心概念,倒排索引,数据操纵
大数据·elasticsearch·搜索引擎
cai_cai010 小时前
springAlibaba + ollama + es 完成RAG知识库功能
大数据·elasticsearch·搜索引擎
Cx330❀10 小时前
Git 分支管理完全指南:从基础到团队协作
大数据·git·搜索引擎·全文检索
nhdh10 小时前
ELK(elasticsearch-7.6.2,kibana-7-6-2,Logstash-7.6.2)单节点部署
大数据·elk·elasticsearch
新元代码11 小时前
Git在Windows环境下的安装与使用教程
大数据·elasticsearch·搜索引擎