大数据第五天(操作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

成功解决了

刚才问题有点尴尬是这样的一个问题

我们连接是hive的hadoop03的服务器但是我们操作hadoop01服务器哎

相关推荐
starzy199012 小时前
SparkSQL 数据源与底层架构深度剖析
大数据·分布式·架构·spark
Elastic 中国社区官方博客13 小时前
你的 AI agent 不需要你的 API 密钥:使用 OAuth 2.1 对 Elasticsearch MCP 服务器进行身份验证
大数据·运维·人工智能·elasticsearch·搜索引擎·全文检索
Json____17 小时前
五金制品行业-企业官网源码
java·大数据·数据库·企业站·wwwoop.com
黄焖鸡能干四碗17 小时前
信息安全保障方案(Word文件)
大数据·网络·人工智能·架构·区块链
大东(AIP内容运营专员)18 小时前
我用 OPC 模式运营一年多的AI产品
大数据·人工智能
互联网中的一颗神经元19 小时前
ZZ — Git 速查表
大数据·git·elasticsearch
roman_日积跬步-终至千里19 小时前
【Spark与SQL网关(1)】Spark 提交模式与 Spark Thrift Server:到底在“提交”什么
大数据·sql·spark
汽车仪器仪表相关领域20 小时前
SIRIUS R1DB/R2DB便携式一体化数据采集系统
大数据·人工智能·功能测试·深度学习·压力测试
C++、Java和Python的菜鸟1 天前
第2章 项目前置课-代码版本控制Git
大数据·elasticsearch·搜索引擎