大数据Hadoop教程-学习笔记04【数据仓库基础与Apache Hive入门】

news2024/9/28 7:20:58
  • 视频教程:哔哩哔哩网站:黑马大数据Hadoop入门视频教程 总时长:14:22:04
  • 教程资源: https://pan.baidu.com/s/1WYgyI3KgbzKzFD639lA-_g 提取码: 6666
  1. 【P001-P017】大数据Hadoop教程-学习笔记01【大数据导论与Linux基础】【17p】
  2. 【P018-P037】大数据Hadoop教程-学习笔记02【Apache Hadoop、HDFS】【20p】
  3. 【P038-P050】大数据Hadoop教程-学习笔记03【Hadoop MapReduce与Hadoop YARN】【13p】
  4. 【P051-P068】大数据Hadoop教程-学习笔记04【数据仓库基础与Apache Hive入门】【18p】
  5. 【P069-P083】大数据Hadoop教程-学习笔记05【Apache Hive DML语句与函数使用】【15p】
  6. 【P084-P096】大数据Hadoop教程-学习笔记06【Hadoop生态综合案例:陌陌聊天数据分析】【13p】

目录

01【数据仓库基本概念】

P051【01-课程内容大纲学习目标】

P052【02-数据仓库概念与起源发展由来】

P053【03-数据仓库主要特征--面向主题、集成、非易失、时变】

P054【04-数仓主流开发语言--SQL介绍】

02【Apache Hive入门】

P055【05-Apache hive软件介绍与Hadoop关系】

P056【06-场景设计--Hive功能模拟实现底层猜想】

P057【07-Apache hive--架构图、各组件功能】

03【Apache Hive安装部署】

P058【08-Apache hive安装部署--metadata与metastore、远程模式介绍】

P059【09-Apache hive安装部署--与Hadoop整合、MySQL安装】

P060【10-Apache hive安装部署--配置文件修改编辑】

P061【11-Apache hive安装部署--metastore服务启动方式】

P062【12-Apache hive--新老客户端使用与hiveserver2服务】

P063【13-Apache hive--DataGrip连接Hiveserver2】

04【Hive SQL语言:DDL建库、建表】

P064【14-Apache hive--数据库与建库、切换库操作】

P065【15-Apache hive--表与建表sql语句--数据类型、分隔符指定语法】

P066【16-Apache hive--表与建表sql语句--默认分隔符使用】

05【Hive Show语法】

P067【17-Apache hive--常见的show语法】

P068【18-Apache hive--注释comment中文乱码解决】


01【数据仓库基本概念】

P051【01-课程内容大纲学习目标】

目录

  1. 数据仓库基本概念
  2. Apache Hive入门
  3. Apache Hive安装部署
  4. Hive SQL语言:DDL建库、建表

学习目标

  1. 掌握数据仓库是什么、解决什么
  2. 理解数据仓库有什么特点
  3. 理解SQL编程语言的概念、优点
  4. 掌握Apache Hive架构原理、组件
  5. 掌握Apache Hive客户端使用
  6. 掌握Apache Hive的建库、建表SQL语法

P052【02-数据仓库概念与起源发展由来】

数仓概念

数据仓库(英语:Data Warehouse,简称数仓、DW),是一个用于存储、分析、报告的数据系统。

数据仓库的目的是构建面向分析的集成化数据环境,分析结果为企业提供决策支持(Decision Support)。

联机事务处理系统(OLTP)正好可以满足上述业务需求开展,其主要任务是执行联机事务处理。其基本特征是前台接收的用户数据可以立即传送到后台进行处理,并在很短的时间内给出处理结果。

关系型数据库(RDBMS)是OLTP典型应用,比如:Oracle、MySQL、SQL Server等。

如数仓定义所说,数仓是一个用于存储、分析、报告的数据系统,目的是构建面向分析的集成化数据环境。我们把这种面向分析、支持分析的系统称之为OLAP(联机分析处理)系统。当然,数据仓库是OLAP系统的一种实现。

P053【03-数据仓库主要特征--面向主题、集成、非易失、时变】

数仓主要特征:面向主题、集成性、非易失性、时变性。

P054【04-数仓主流开发语言--SQL介绍】

SQL语言介绍

结构化查询语言(Structured Query Language)简称SQL,是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理数据。

02【Apache Hive入门】

P055【05-Apache hive软件介绍与Hadoop关系】

Hive介绍

  1. Apache Hive是一款建立在Hadoop之上的开源数据仓库系统,可以将存储在Hadoop文件中的结构化、半结构化数据文件映射为一张数据库表,基于表提供了一种类似SQL的查询模型,称为Hive查询语言(HQL),用于访问和 分析存储在Hadoop文件中的大型数据集。
  2. Hive核心是将HQL转换为MapReduce程序,然后将程序提交到Hadoop群集执行。
  3. Hive由Facebook实现并开源。

P056【06-场景设计--Hive功能模拟实现底层猜想】

对Hive的理解

Hive能将数据文件映射成为一张表,这个映射是指什么?文件和表之间的对应关系。
Hive软件本身到底承担了什么功能职责?SQL语法解析编译成为MapReduce。

Hive架构图

P057【07-Apache hive--架构图、各组件功能】

Apache Hive架构图

HIve组件:

  1. 用户接口
  2. 元数据存储
  3. Driver驱动程序,包括语法解析器、计划编译器、优化器、执行器
  4. 执行引擎

03【Apache Hive安装部署】

P058【08-Apache hive安装部署--metadata与metastore、远程模式介绍】

元数据(Metadata),又称中介数据、中继数据,为描述数据的数据(data about data),主要是描述数据属性(property)的信息,用来支持如指示存储位置、历史数据、资源查找、文件记录等功能。

Hive Metadata

  1. Hive Metadata即Hive的元数据。
  2. 包含用Hive创建的database、table、表的位置、类型、属性,字段顺序类型等元信息。
  3. 元数据存储在关系型数据库中。如hive内置的Derby、或者第三方如MySQL等。

metastore服务配置有3种模式:内嵌模式、本地模式、远程模式。

metastore远程模式

在生产环境中,建议用远程模式来配置Hive Metastore。在这种情况下,其他依赖hive的软件都可以通过Metastore访问hive。由于还可以完全屏蔽数据库层,因此这也带来了更好的可管理性/安全性。

Remote Metastore远程模式

P059【09-Apache hive安装部署--与Hadoop整合、MySQL安装】

步骤:

  1. Step1:MySQL安装
  2. Step2:上传解压Hive安装包(node1安装即可)
  3. Step3:修改hive-env.sh
  4. Step4:新增hive-site.xml
  5. Step5:添加驱动、初始化
连接成功
Last login: Wed Feb 22 19:31:24 2023 from 192.168.88.1
[root@node1 ~]# cat /export/server/hadoop-3.3.0/etc/hadoop/core-site.xml 
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
<!-- 设置默认使用的文件系统 Hadoop支持file、HDFS、GFS、ali|Amazon云等文件系统 -->
<property>
    <name>fs.defaultFS</name>
    <value>hdfs://node1:8020</value>
</property>

<!-- 设置Hadoop本地保存数据路径 -->
<property>
    <name>hadoop.tmp.dir</name>
    <value>/export/data/hadoop-3.3.0</value>
</property>

<!-- 设置HDFS web UI用户身份 -->
<property>
    <name>hadoop.http.staticuser.user</name>
    <value>root</value>
</property>

<!-- 整合hive 用户代理设置 -->
<property>
    <name>hadoop.proxyuser.root.hosts</name>
    <value>*</value>
</property>

<property>
    <name>hadoop.proxyuser.root.groups</name>
    <value>*</value>
</property>
<!-- 文件系统垃圾桶保存时间 单位:分 -->
<property>
    <name>fs.trash.interval</name>
    <value>1440</value>
</property>
</configuration>
[root@node1 ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.64-1.el7.x86_64
您在 /var/spool/mail/root 中有新邮件
[root@node1 ~]# rpm -e mariadb-libs-5.5.64-1.el7.x86_64 --nodeps
[root@node1 ~]# rpm -qa|grep mariadb
[root@node1 ~]# mkdir /export/software/mysql
[root@node1 ~]# cd /export/software/mysql
[root@node1 mysql]# ll
总用量 533040
-rw-r--r-- 1 root root 545832960 2月  23 11:20 mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
[root@node1 mysql]# tar xvf mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
mysql-community-embedded-devel-5.7.29-1.el7.x86_64.rpm
mysql-community-test-5.7.29-1.el7.x86_64.rpm
mysql-community-embedded-5.7.29-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.29-1.el7.x86_64.rpm
mysql-community-libs-5.7.29-1.el7.x86_64.rpm
mysql-community-client-5.7.29-1.el7.x86_64.rpm
mysql-community-server-5.7.29-1.el7.x86_64.rpm
mysql-community-devel-5.7.29-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.29-1.el7.x86_64.rpm
mysql-community-common-5.7.29-1.el7.x86_64.rpm
[root@node1 mysql]# yum -y install libaio
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
base                                                                                                                                                                                | 3.6 kB  00:00:00     
extras                                                                                                                                                                              | 2.9 kB  00:00:00     
updates                                                                                                                                                                             | 2.9 kB  00:00:00     
(1/3): extras/7/x86_64/primary_db                                                                                                                                                   | 249 kB  00:00:00     
(2/3): base/7/x86_64/primary_db                                                                                                                                                     | 6.1 MB  00:00:02     
(3/3): updates/7/x86_64/primary_db                                                                                                                                                  |  19 MB  00:00:12     
软件包 libaio-0.3.109-13.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@node1 mysql]# rpm -ivh mysql-community-common-5.7.29-1.el7.x86_64.rpm mysql-community-libs-5.7.29-1.el7.x86_64.rpm mysql-community-client-5.7.29-1.el7.x86_64.rpm mysql-community-server-5.7.29-1.el7.x86_64.rpm 
警告:mysql-community-common-5.7.29-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-common-5.7.29-1.e################################# [ 25%]
   2:mysql-community-libs-5.7.29-1.el7################################# [ 50%]
   3:mysql-community-client-5.7.29-1.e################################# [ 75%]
   4:mysql-community-server-5.7.29-1.e################################# [100%]
[root@node1 mysql]# mysqld --initialize
[root@node1 mysql]# chown mysql:mysql /var/lib/mysql -R
[root@node1 mysql]# systemctl start mysqld.service
[root@node1 mysql]# cat /var/log/mysqld.log
2023-02-23T03:43:16.580339Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-02-23T03:43:18.234540Z 0 [Warning] InnoDB: New log files created, LSN=45790
2023-02-23T03:43:18.421383Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2023-02-23T03:43:18.500035Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 360b5b52-b32c-11ed-888d-000c29340b53.
2023-02-23T03:43:18.501254Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2023-02-23T03:43:19.887964Z 0 [Warning] CA certificate ca.pem is self signed.
2023-02-23T03:43:20.162146Z 1 [Note] A temporary password is generated for root@localhost: z(39#&?&pF?O
2023-02-23T03:43:57.841346Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-02-23T03:43:57.872210Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.29) starting as process 37730 ...
2023-02-23T03:43:57.896542Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-02-23T03:43:57.896662Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-02-23T03:43:57.896669Z 0 [Note] InnoDB: Uses event mutexes
2023-02-23T03:43:57.896721Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-02-23T03:43:57.896731Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-02-23T03:43:57.896736Z 0 [Note] InnoDB: Using Linux native AIO
2023-02-23T03:43:57.917078Z 0 [Note] InnoDB: Number of pools: 1
2023-02-23T03:43:57.919925Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-02-23T03:43:57.955368Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-02-23T03:43:58.036981Z 0 [Note] InnoDB: Completed initialization of buffer pool
2023-02-23T03:43:58.079394Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-02-23T03:43:58.107082Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2023-02-23T03:43:58.137269Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-02-23T03:43:58.137408Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-02-23T03:43:58.269290Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-02-23T03:43:58.271662Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2023-02-23T03:43:58.271702Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2023-02-23T03:43:58.292372Z 0 [Note] InnoDB: 5.7.29 started; log sequence number 2630592
2023-02-23T03:43:58.309770Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-02-23T03:43:58.327667Z 0 [Note] Plugin 'FEDERATED' is disabled.
2023-02-23T03:43:58.354784Z 0 [Note] InnoDB: Buffer pool(s) load completed at 230223 11:43:58
2023-02-23T03:43:58.416170Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2023-02-23T03:43:58.416216Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2023-02-23T03:43:58.417327Z 0 [Warning] CA certificate ca.pem is self signed.
2023-02-23T03:43:58.417392Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2023-02-23T03:43:58.418168Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2023-02-23T03:43:58.418225Z 0 [Note] IPv6 is available.
2023-02-23T03:43:58.418237Z 0 [Note]   - '::' resolves to '::';
2023-02-23T03:43:58.418255Z 0 [Note] Server socket created on IP: '::'.
2023-02-23T03:43:58.430589Z 0 [Note] Event Scheduler: Loaded 0 events
2023-02-23T03:43:58.430915Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.29'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
[root@node1 mysql]# mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@node1 mysql]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.29

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> alter user user() identified by "hadoop";
Query OK, 0 rows affected (0.00 sec)

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'hadoop' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> ^DBye
[root@node1 mysql]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 四 2023-02-23 11:43:58 CST; 4min 1s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 37728 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 37708 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 37730 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─37730 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

2月 23 11:43:56 node1.itcast.cn systemd[1]: Starting MySQL Server...
2月 23 11:43:58 node1.itcast.cn systemd[1]: Started MySQL Server.
[root@node1 mysql]# systemctl enable  mysqld
[root@node1 mysql]# systemctl list-unit-files | grep mysqld
mysqld.service                                enabled 
mysqld@.service                               disabled
[root@node1 mysql]# 

P060【10-Apache hive安装部署--配置文件修改编辑】

在Windows中远程连接Linux中的MySQL数据库

192.168.88.151、node1.itcast.cn

 

连接成功
Last login: Thu Feb 23 12:10:56 2023
[root@node1 ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| engine_cost               |
| event                     |
| func                      |
| general_log               |
| gtid_executed             |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| innodb_index_stats        |
| innodb_table_stats        |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| server_cost               |
| servers                   |
| slave_master_info         |
| slave_relay_log_info      |
| slave_worker_info         |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
31 rows in set (0.00 sec)

mysql> select user,password,host from user;
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql> select host,user from user;
+-----------+---------------+
| host      | user          |
+-----------+---------------+
| %         | root          |
| localhost | mysql.session |
| localhost | mysql.sys     |
| localhost | root          |
+-----------+---------------+
4 rows in set (0.00 sec)

mysql> update user set host='%' where user = 'root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
mysql> systemctl stop firewalld.service
    -> ^DBye
[root@node1 ~]# systemctl stop firewalld.service
[root@node1 ~]# systemctl disable firewalld.service
[root@node1 ~]# //查看开放的端口号
-bash: //查看开放的端口号: 没有那个文件或目录
[root@node1 ~]# firewall-cmd --list-all
FirewallD is not running
[root@node1 ~]# 
[root@node1 ~]# //设置开放的端口号
-bash: //设置开放的端口号: 没有那个文件或目录
[root@node1 ~]# firewall-cmd --add-service=http --permanent
FirewallD is not running
[root@node1 ~]# firewall-cmd --add-port=3306/tcp --permanent
FirewallD is not running
[root@node1 ~]# 
[root@node1 ~]# //重启防火墙
-bash: //重启防火墙: 没有那个文件或目录
[root@node1 ~]# firewall-cmd --reload
FirewallD is not running
[root@node1 ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.29 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> 
mysql> select Host,User from user;
+-----------+---------------+
| Host      | User          |
+-----------+---------------+
| %         | root          |
| localhost | mysql.session |
| localhost | mysql.sys     |
| localhost | root          |
+-----------+---------------+
4 rows in set (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> ^DBye
[root@node1 ~]# 

P061【11-Apache hive安装部署--metastore服务启动方式】

[root@node1 ~]# start-all.sh
Starting namenodes on [node1]
上一次登录:四 2月 23 14:02:35 CST 2023从 192.168.88.1pts/1 上
Starting datanodes
上一次登录:四 2月 23 14:23:50 CST 2023pts/0 上
Starting secondary namenodes [node2]
上一次登录:四 2月 23 14:23:53 CST 2023pts/0 上
Starting resourcemanager
上一次登录:四 2月 23 14:24:00 CST 2023pts/0 上
Starting nodemanagers
上一次登录:四 2月 23 14:24:13 CST 2023pts/0 上
[root@node1 ~]# /export/server/apache-hive-3.1.2-bin/bin/hive --service metastore
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
2023-02-23 14:27:37: Starting Hive Metastore Server
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
^C[root@node1 ~]# nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service metastore &
[1] 35181
[root@node1 ~]# nohup: 忽略输入并把输出追加到"nohup.out"

[root@node1 ~]# jps
28691 ResourceManager
35683 Jps
28916 NodeManager
27689 NameNode
27885 DataNode
35181 RunJar
[root@node1 ~]# ll
总用量 20
-rw-r--r--  1 root root    2 2月  21 21:14 1.txt
-rw-r--r--  1 root root    4 2月  22 11:03 666.txt
-rw-------. 1 root root 1340 9月  11 2020 anaconda-ks.cfg
-rw-r--r--  1 root root   34 2月  21 21:36 hello.txt
-rw-------  1 root root 1072 2月  23 14:28 nohup.out
[root@node1 ~]# kill-9 35181
-bash: kill-9: 未找到命令
[root@node1 ~]# kill 35181
[root@node1 ~]# jps
28691 ResourceManager
28916 NodeManager
37508 Jps
27689 NameNode
27885 DataNode
[1]+  退出 143              nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service metastore
[root@node1 ~]# 

P062【12-Apache hive--新老客户端使用与hiveserver2服务】

第一代客户端

node3

 

第一代客户端

node1

/export/server/apache-hive-3.1.2-bin/bin/hive

连接成功
Last login: Thu Feb 23 11:14:41 2023 from 192.168.88.1
[root@node3 ~]# /export/server/apache-hive-3.1.2-bin/bin/hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/export/server/jdk1.8.0_241/bin:/export/server/hadoop-3.3.0/bin:/export/server/hadoop-3.3.0/sbin:/root/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Hive Session ID = bd951b9d-11c9-43d5-ae6d-3b82a7a96823

Logging initialized using configuration in jar:file:/export/server/apache-hive-3.1.2-bin/lib/hive-common-3.1.2.jar!/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
Hive Session ID = cd48f8fb-6073-4ddf-a5cb-2b619eba70cf
hive> show da
data           date           date(          date_add(      date_format(   date_sub(      datediff(      datetime       day(           dayofmonth(    dayofweek(     
hive> show databases;
OK
default
Time taken: 0.923 seconds, Fetched: 1 row(s)
hive> show tables;
OK
Time taken: 0.09 seconds
hive> 您在 /var/spool/mail/root 中有新邮件
[root@node3 ~]# 

第二代客户端

node3

/export/server/apache-hive-3.1.2-bin/bin/beeline

! connect jdbc:hive2://node1:10000

root

(然后直接回车)

[root@node3 ~]# /export/server/apache-hive-3.1.2-bin/bin/beeline
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Beeline version 3.1.2 by Apache Hive
beeline> ! connect jdbc:hive2://node1:10000
Connecting to jdbc:hive2://node1:10000
Enter username for jdbc:hive2://node1:10000: root
Enter password for jdbc:hive2://node1:10000: 
Connected to: Apache Hive (version 3.1.2)
Driver: Hive JDBC (version 3.1.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://node1:10000> show databases;
INFO  : Compiling command(queryId=root_20230223144903_ef22457c-2764-4ead-9755-f84aaa2505f2): show databases
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223144903_ef22457c-2764-4ead-9755-f84aaa2505f2); Time taken: 1.407 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223144903_ef22457c-2764-4ead-9755-f84aaa2505f2): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223144903_ef22457c-2764-4ead-9755-f84aaa2505f2); Time taken: 0.07 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+----------------+
| database_name  |
+----------------+
| default        |
+----------------+
1 row selected (2.172 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223144915_bf4a1a40-2124-46b6-acfd-b036b91149b9): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223144915_bf4a1a40-2124-46b6-acfd-b036b91149b9); Time taken: 0.039 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223144915_bf4a1a40-2124-46b6-acfd-b036b91149b9): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223144915_bf4a1a40-2124-46b6-acfd-b036b91149b9); Time taken: 0.025 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-----------+
| tab_name  |
+-----------+
+-----------+
No rows selected (0.119 seconds)
0: jdbc:hive2://node1:10000> Closing: 0: jdbc:hive2://node1:10000
您在 /var/spool/mail/root 中有新邮件
[root@node3 ~]# 

P063【13-Apache hive--DataGrip连接Hiveserver2】

DataGrip 2020.2.2 x64

04【Hive SQL语言:DDL建库、建表】

P064【14-Apache hive--数据库与建库、切换库操作】

Hive数据模型总览

选择正确的方向比盲目努力更重要。

 

P065【15-Apache hive--表与建表sql语句--数据类型、分隔符指定语法】

--创建数据库并切换使用
create database if not exists itheima;
use itheima;

--1、创建一张表,将射手结构化数据文件在Hive中映射成功
-- 表名
--  字段  名称  类型  顺序
--  字段之间的分隔符需要指定

--ddl create table
create table itheima.t_archer(
    id int comment "ID编号",
    name string comment "英雄名称",
    hp_max int comment "最大生命",
    mp_max int comment "最大法力",
    attack_max int comment "最高物攻",
    defense_max int comment "最大物防",
    attack_range string comment "攻击范围",
    role_main string comment "主要定位",
    role_assist string comment "次要定位"
) comment "王者荣耀射手信息"
row format delimited
fields terminated by "\t"; -- 字段之间的分隔符是tab键 制表符

select * from t_archer;

P066【16-Apache hive--表与建表sql语句--默认分隔符使用】

node1

start-all.sh

/export/server/apache-hive-3.1.2-bin/bin/hive --service metastore(前台启动metastore服务)

nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service metastore &(后台启动metastore服务)

jps

nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service hiveserver2 &

jps

node3

/export/server/apache-hive-3.1.2-bin/bin/beeline

! connect jdbc:hive2://node1:10000

root

(然后直接回车)

连接成功
Last login: Thu Feb 23 21:06:42 2023 from 192.168.88.1
[root@node1 ~]# jps
1813 Jps
[root@node1 ~]# start-all.sh
Starting namenodes on [node1]
上一次登录:四 2月 23 21:12:56 CST 2023从 192.168.88.1pts/1 上
Starting datanodes
上一次登录:四 2月 23 21:13:22 CST 2023pts/0 上
Starting secondary namenodes [node2]
上一次登录:四 2月 23 21:13:25 CST 2023pts/0 上
Starting resourcemanager
上一次登录:四 2月 23 21:13:31 CST 2023pts/0 上
Starting nodemanagers
上一次登录:四 2月 23 21:13:39 CST 2023pts/0 上
[root@node1 ~]# jps
2272 NameNode
3400 NodeManager
3162 ResourceManager
2477 DataNode
3903 Jps
[root@node1 ~]# nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service metastore &
[1] 4670
[root@node1 ~]# nohup: 忽略输入并把输出追加到"nohup.out"

[root@node1 ~]# jps
2272 NameNode
4880 Jps
3400 NodeManager
3162 ResourceManager
2477 DataNode
4670 RunJar
[root@node1 ~]# nohup /export/server/apache-hive-3.1.2-bin/bin/hive --service hiveserver2 &
[2] 5027
[root@node1 ~]# nohup: 忽略输入并把输出追加到"nohup.out"

[root@node1 ~]# jps
2272 NameNode
5171 Jps
3400 NodeManager
3162 ResourceManager
5051 VersionInfo
2477 DataNode
4670 RunJar
[root@node1 ~]# jps
2272 NameNode
5027 RunJar
7383 Jps
3400 NodeManager
3162 ResourceManager
2477 DataNode
4670 RunJar
[root@node1 ~]# 
连接成功
Last login: Thu Feb 23 21:01:31 2023 from 192.168.88.1
[root@node3 ~]# /export/server/apache-hive-3.1.2-bin/bin/beeline
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Beeline version 3.1.2 by Apache Hive
beeline> ! connect jdbc:hive2://node1:10000
Connecting to jdbc:hive2://node1:10000
Enter username for jdbc:hive2://node1:10000: root
Enter password for jdbc:hive2://node1:10000: 
23/02/23 21:15:26 [main]: WARN jdbc.HiveConnection: Failed to connect to node1:10000
Could not open connection to the HS2 server. Please check the server URI and if the URI is correct, then ask the administrator to check the server status.
Error: Could not open client transport with JDBC Uri: jdbc:hive2://node1:10000: java.net.ConnectException: 拒绝连接 (Connection refused) (state=08S01,code=0)
beeline> 您在 /var/spool/mail/root 中有新邮件
[root@node3 ~]# /export/server/apache-hive-3.1.2-bin/bin/beeline
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Beeline version 3.1.2 by Apache Hive
beeline> ! connect jdbc:hive2://node1:10000
Connecting to jdbc:hive2://node1:10000
Enter username for jdbc:hive2://node1:10000: root
Enter password for jdbc:hive2://node1:10000: 
Connected to: Apache Hive (version 3.1.2)
Driver: Hive JDBC (version 3.1.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://node1:10000> show databases;
INFO  : Compiling command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd): show databases
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd); Time taken: 1.802 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd); Time taken: 0.085 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+----------------+
| database_name  |
+----------------+
| default        |
| itheima        |
+----------------+
2 rows selected (2.589 seconds)
0: jdbc:hive2://node1:10000> use itheima;
INFO  : Compiling command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677): use itheima
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO  : Completed compiling command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677); Time taken: 0.045 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677): use itheima
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677); Time taken: 0.015 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
No rows affected (0.157 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b); Time taken: 0.036 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b); Time taken: 0.035 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-----------+
| tab_name  |
+-----------+
| t_archer  |
+-----------+
1 row selected (0.122 seconds)
0: jdbc:hive2://node1:10000> 

在hive库里面用sql建成一张数据表以后,在hdfs里面就是一个文件夹,把文本传输进去,如果都能够对应的上,在hive这边客户端就能查到刚才文本映射出来的表结构数据。

 

--创建数据库并切换使用
create database if not exists itheima;
use itheima;

--1、创建一张表,将射手结构化数据文件在Hive中映射成功
-- 表名
--  字段  名称  类型  顺序
--  字段之间的分隔符需要指定

--ddl create table
create table itheima.t_archer(
    id int comment "ID编号",
    name string comment "英雄名称",
    hp_max int comment "最大生命",
    mp_max int comment "最大法力",
    attack_max int comment "最高物攻",
    defense_max int comment "最大物防",
    attack_range string comment "攻击范围",
    role_main string comment "主要定位",
    role_assist string comment "次要定位"
) comment "王者荣耀射手信息"
row format delimited
fields terminated by "\t"; -- 字段之间的分隔符是tab键 制表符

select * from t_archer;



create table itheima.t_archer1(
    id int comment "ID编号",
    name string comment "英雄名称",
    hp_max int comment "最大生命",
    mp_max int comment "最大法力",
    attack_max int comment "最高物攻",
    defense_max int comment "最大物防",
    attack_range string comment "攻击范围",
    role_main string comment "主要定位",
    role_assist string comment "次要定位"
);

--使用默认分隔符建表  \001  非打印字符
create table t_team_ace_player(
    id int,
    team_name string,
    ace_player_name string
);
-- row format delimited
-- fields terminated by "\001";

select * from t_team_ace_player;



--使用默认分隔符建表  \001  非打印字符
create table t_team_ace_player2(
    id int,
    team_name string,
    ace_player_name string
)
row format delimited
fields terminated by "\t";

select * from t_team_ace_player2;

05【Hive Show语法】

P067【17-Apache hive--常见的show语法】

0: jdbc:hive2://node1:10000> show databases;
INFO  : Compiling command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd): show databases
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd); Time taken: 1.802 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211656_6489cb28-8689-4b0f-8ee6-6503535f4cbd); Time taken: 0.085 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+----------------+
| database_name  |
+----------------+
| default        |
| itheima        |
+----------------+
2 rows selected (2.589 seconds)
0: jdbc:hive2://node1:10000> use itheima;
INFO  : Compiling command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677): use itheima
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO  : Completed compiling command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677); Time taken: 0.045 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677): use itheima
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211710_5f6217f0-2d03-431b-8dee-23cb6965e677); Time taken: 0.015 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
No rows affected (0.157 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b); Time taken: 0.036 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223211726_dd7ca710-179b-47e7-9cf8-a8396d2edf1b); Time taken: 0.035 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-----------+
| tab_name  |
+-----------+
| t_archer  |
+-----------+
1 row selected (0.122 seconds)
0: jdbc:hive2://node1:10000> show databases;
INFO  : Compiling command(queryId=root_20230223214926_9c11c9cf-81d6-460e-8cc5-ada1f4ba3b2a): show databases
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223214926_9c11c9cf-81d6-460e-8cc5-ada1f4ba3b2a); Time taken: 0.015 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223214926_9c11c9cf-81d6-460e-8cc5-ada1f4ba3b2a): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223214926_9c11c9cf-81d6-460e-8cc5-ada1f4ba3b2a); Time taken: 0.006 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+----------------+
| database_name  |
+----------------+
| default        |
| itheima        |
+----------------+
2 rows selected (0.048 seconds)
0: jdbc:hive2://node1:10000> show schemas;
INFO  : Compiling command(queryId=root_20230223214947_ea4ee4e1-3e8d-41c8-9ab9-3612885a12bd): show schemas
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223214947_ea4ee4e1-3e8d-41c8-9ab9-3612885a12bd); Time taken: 0.02 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223214947_ea4ee4e1-3e8d-41c8-9ab9-3612885a12bd): show schemas
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223214947_ea4ee4e1-3e8d-41c8-9ab9-3612885a12bd); Time taken: 0.006 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+----------------+
| database_name  |
+----------------+
| default        |
| itheima        |
+----------------+
2 rows selected (0.047 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223215003_3e56b709-c5fc-47c5-9791-d6f34cb53e3d): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215003_3e56b709-c5fc-47c5-9791-d6f34cb53e3d); Time taken: 0.04 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215003_3e56b709-c5fc-47c5-9791-d6f34cb53e3d): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215003_3e56b709-c5fc-47c5-9791-d6f34cb53e3d); Time taken: 0.009 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+---------------------+
|      tab_name       |
+---------------------+
| t_archer            |
| t_archer1           |
| t_team_ace_player   |
| t_team_ace_player2  |
+---------------------+
4 rows selected (0.068 seconds)
0: jdbc:hive2://node1:10000> use def
default      deferrable   deferred     defined      
0: jdbc:hive2://node1:10000> use default;
INFO  : Compiling command(queryId=root_20230223215035_62f80942-23c8-413b-a4de-6ea52723e6f1): use default
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO  : Completed compiling command(queryId=root_20230223215035_62f80942-23c8-413b-a4de-6ea52723e6f1); Time taken: 0.024 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215035_62f80942-23c8-413b-a4de-6ea52723e6f1): use default
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215035_62f80942-23c8-413b-a4de-6ea52723e6f1); Time taken: 0.007 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
No rows affected (0.042 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223215037_65d2f780-be33-42f3-96ba-002eec6ff1e3): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215037_65d2f780-be33-42f3-96ba-002eec6ff1e3); Time taken: 0.024 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215037_65d2f780-be33-42f3-96ba-002eec6ff1e3): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215037_65d2f780-be33-42f3-96ba-002eec6ff1e3); Time taken: 0.008 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-----------+
| tab_name  |
+-----------+
+-----------+
No rows selected (0.045 seconds)
0: jdbc:hive2://node1:10000> show tables in itheima;
INFO  : Compiling command(queryId=root_20230223215118_6fab9cbb-be95-417e-9549-0474cad5742f): show tables in itheima
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215118_6fab9cbb-be95-417e-9549-0474cad5742f); Time taken: 0.032 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215118_6fab9cbb-be95-417e-9549-0474cad5742f): show tables in itheima
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215118_6fab9cbb-be95-417e-9549-0474cad5742f); Time taken: 0.009 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+---------------------+
|      tab_name       |
+---------------------+
| t_archer            |
| t_archer1           |
| t_team_ace_player   |
| t_team_ace_player2  |
+---------------------+
4 rows selected (0.06 seconds)
0: jdbc:hive2://node1:10000> desc formatted t_team_ace_player;
Error: Error while compiling statement: FAILED: SemanticException [Error 10001]: Table not found t_team_ace_player (state=42S02,code=10001)
0: jdbc:hive2://node1:10000> desc formatted t_team_ace_player;
Error: Error while compiling statement: FAILED: SemanticException [Error 10001]: Table not found t_team_ace_player (state=42S02,code=10001)
0: jdbc:hive2://node1:10000> desc formatted t_archer;
Error: Error while compiling statement: FAILED: SemanticException [Error 10001]: Table not found t_archer (state=42S02,code=10001)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223215309_27c866fa-f738-4072-96bb-8270f94f7540): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215309_27c866fa-f738-4072-96bb-8270f94f7540); Time taken: 0.028 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215309_27c866fa-f738-4072-96bb-8270f94f7540): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215309_27c866fa-f738-4072-96bb-8270f94f7540); Time taken: 0.008 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-----------+
| tab_name  |
+-----------+
+-----------+
No rows selected (0.053 seconds)
0: jdbc:hive2://node1:10000> show tables in itheima;
INFO  : Compiling command(queryId=root_20230223215315_84c2bd7d-00a5-47c5-b118-37af449380f8): show tables in itheima
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215315_84c2bd7d-00a5-47c5-b118-37af449380f8); Time taken: 0.03 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215315_84c2bd7d-00a5-47c5-b118-37af449380f8): show tables in itheima
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215315_84c2bd7d-00a5-47c5-b118-37af449380f8); Time taken: 0.01 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+---------------------+
|      tab_name       |
+---------------------+
| t_archer            |
| t_archer1           |
| t_team_ace_player   |
| t_team_ace_player2  |
+---------------------+
4 rows selected (0.068 seconds)
0: jdbc:hive2://node1:10000> desc formatted t_team_ace_player;
Error: Error while compiling statement: FAILED: SemanticException [Error 10001]: Table not found t_team_ace_player (state=42S02,code=10001)
0: jdbc:hive2://node1:10000> use itheima;
INFO  : Compiling command(queryId=root_20230223215329_836ff206-4117-4e17-971f-6a90beddc017): use itheima
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO  : Completed compiling command(queryId=root_20230223215329_836ff206-4117-4e17-971f-6a90beddc017); Time taken: 0.023 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215329_836ff206-4117-4e17-971f-6a90beddc017): use itheima
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215329_836ff206-4117-4e17-971f-6a90beddc017); Time taken: 0.011 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
No rows affected (0.046 seconds)
0: jdbc:hive2://node1:10000> show tables;
INFO  : Compiling command(queryId=root_20230223215335_72de1e84-a59d-4a58-9a2a-f224716b9796): show tables
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:tab_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215335_72de1e84-a59d-4a58-9a2a-f224716b9796); Time taken: 0.027 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215335_72de1e84-a59d-4a58-9a2a-f224716b9796): show tables
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215335_72de1e84-a59d-4a58-9a2a-f224716b9796); Time taken: 0.01 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+---------------------+
|      tab_name       |
+---------------------+
| t_archer            |
| t_archer1           |
| t_team_ace_player   |
| t_team_ace_player2  |
+---------------------+
4 rows selected (0.055 seconds)
0: jdbc:hive2://node1:10000> desc formatted t_team_ace_player;
INFO  : Compiling command(queryId=root_20230223215339_61a932de-0793-42ba-8d6d-e501707939ec): desc formatted t_team_ace_player
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:col_name, type:string, comment:from deserializer), FieldSchema(name:data_type, type:string, comment:from deserializer), FieldSchema(name:comment, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215339_61a932de-0793-42ba-8d6d-e501707939ec); Time taken: 0.044 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215339_61a932de-0793-42ba-8d6d-e501707939ec): desc formatted t_team_ace_player
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215339_61a932de-0793-42ba-8d6d-e501707939ec); Time taken: 0.133 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
|           col_name            |                     data_type                      |                      comment                       |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
| # col_name                    | data_type                                          | comment                                            |
| id                            | int                                                |                                                    |
| team_name                     | string                                             |                                                    |
| ace_player_name               | string                                             |                                                    |
|                               | NULL                                               | NULL                                               |
| # Detailed Table Information  | NULL                                               | NULL                                               |
| Database:                     | itheima                                            | NULL                                               |
| OwnerType:                    | USER                                               | NULL                                               |
| Owner:                        | root                                               | NULL                                               |
| CreateTime:                   | Thu Feb 23 21:31:11 CST 2023                       | NULL                                               |
| LastAccessTime:               | UNKNOWN                                            | NULL                                               |
| Retention:                    | 0                                                  | NULL                                               |
| Location:                     | hdfs://node1:8020/user/hive/warehouse/itheima.db/t_team_ace_player | NULL                                               |
| Table Type:                   | MANAGED_TABLE                                      | NULL                                               |
| Table Parameters:             | NULL                                               | NULL                                               |
|                               | COLUMN_STATS_ACCURATE                              | {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"ace_player_name\":\"true\",\"id\":\"true\",\"team_name\":\"true\"}} |
|                               | bucketing_version                                  | 2                                                  |
|                               | numFiles                                           | 0                                                  |
|                               | numRows                                            | 0                                                  |
|                               | rawDataSize                                        | 0                                                  |
|                               | totalSize                                          | 0                                                  |
|                               | transient_lastDdlTime                              | 1677159071                                         |
|                               | NULL                                               | NULL                                               |
| # Storage Information         | NULL                                               | NULL                                               |
| SerDe Library:                | org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe | NULL                                               |
| InputFormat:                  | org.apache.hadoop.mapred.TextInputFormat           | NULL                                               |
| OutputFormat:                 | org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat | NULL                                               |
| Compressed:                   | No                                                 | NULL                                               |
| Num Buckets:                  | -1                                                 | NULL                                               |
| Bucket Columns:               | []                                                 | NULL                                               |
| Sort Columns:                 | []                                                 | NULL                                               |
| Storage Desc Params:          | NULL                                               | NULL                                               |
|                               | serialization.format                               | 1                                                  |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
33 rows selected (0.21 seconds)
0: jdbc:hive2://node1:10000> desc formatted t_archer;
INFO  : Compiling command(queryId=root_20230223215354_49faf959-b5e0-46b8-bd99-8e65c5d62add): desc formatted t_archer
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Semantic Analysis Completed (retrial = false)
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:col_name, type:string, comment:from deserializer), FieldSchema(name:data_type, type:string, comment:from deserializer), FieldSchema(name:comment, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=root_20230223215354_49faf959-b5e0-46b8-bd99-8e65c5d62add); Time taken: 0.044 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=root_20230223215354_49faf959-b5e0-46b8-bd99-8e65c5d62add): desc formatted t_archer
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=root_20230223215354_49faf959-b5e0-46b8-bd99-8e65c5d62add); Time taken: 0.044 seconds
INFO  : OK
INFO  : Concurrency mode is disabled, not creating a lock manager
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
|           col_name            |                     data_type                      |                      comment                       |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
| # col_name                    | data_type                                          | comment                                            |
| id                            | int                                                | ID??                                               |
| name                          | string                                             | ????                                               |
| hp_max                        | int                                                | ????                                               |
| mp_max                        | int                                                | ????                                               |
| attack_max                    | int                                                | ????                                               |
| defense_max                   | int                                                | ????                                               |
| attack_range                  | string                                             | ????                                               |
| role_main                     | string                                             | ????                                               |
| role_assist                   | string                                             | ????                                               |
|                               | NULL                                               | NULL                                               |
| # Detailed Table Information  | NULL                                               | NULL                                               |
| Database:                     | itheima                                            | NULL                                               |
| OwnerType:                    | USER                                               | NULL                                               |
| Owner:                        | root                                               | NULL                                               |
| CreateTime:                   | Thu Feb 23 17:21:18 CST 2023                       | NULL                                               |
| LastAccessTime:               | UNKNOWN                                            | NULL                                               |
| Retention:                    | 0                                                  | NULL                                               |
| Location:                     | hdfs://node1:8020/user/hive/warehouse/itheima.db/t_archer | NULL                                               |
| Table Type:                   | MANAGED_TABLE                                      | NULL                                               |
| Table Parameters:             | NULL                                               | NULL                                               |
|                               | COLUMN_STATS_ACCURATE                              | {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"attack_max\":\"true\",\"attack_range\":\"true\",\"defense_max\":\"true\",\"hp_max\":\"true\",\"id\":\"true\",\"mp_max\":\"true\",\"name\":\"true\",\"role_assist\":\"true\",\"role_main\":\"true\"}} |
|                               | bucketing_version                                  | 2                                                  |
|                               | comment                                            | ????????                                           |
|                               | numFiles                                           | 0                                                  |
|                               | numRows                                            | 0                                                  |
|                               | rawDataSize                                        | 0                                                  |
|                               | totalSize                                          | 0                                                  |
|                               | transient_lastDdlTime                              | 1677144078                                         |
|                               | NULL                                               | NULL                                               |
| # Storage Information         | NULL                                               | NULL                                               |
| SerDe Library:                | org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe | NULL                                               |
| InputFormat:                  | org.apache.hadoop.mapred.TextInputFormat           | NULL                                               |
| OutputFormat:                 | org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat | NULL                                               |
| Compressed:                   | No                                                 | NULL                                               |
| Num Buckets:                  | -1                                                 | NULL                                               |
| Bucket Columns:               | []                                                 | NULL                                               |
| Sort Columns:                 | []                                                 | NULL                                               |
| Storage Desc Params:          | NULL                                               | NULL                                               |
|                               | field.delim                                        | \t                                                 |
|                               | serialization.format                               | \t                                                 |
+-------------------------------+----------------------------------------------------+----------------------------------------------------+
41 rows selected (0.114 seconds)
0: jdbc:hive2://node1:10000> 

P068【18-Apache hive--注释comment中文乱码解决】

hive将数据保存在mysql中,而mysql默认的编码不支持中文(默认编码 Latin1,兼容ascii)。

--注意:下面sql语句是需要在MySQL中执行,修改Hive存储的元数据信息(metadata)。
use hive3;
show tables;

alter table hive3.COLUMNS_V2 modify column COMMENT varchar(256) character set utf8;
alter table hive3.TABLE_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
alter table hive3.PARTITION_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8 ;
alter table hive3.PARTITION_KEYS modify column PKEY_COMMENT varchar(4000) character set utf8;
alter table hive3.INDEX_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
--创建数据库并切换使用
create database if not exists itheima;
use itheima;

--1、创建一张表,将射手结构化数据文件在Hive中映射成功
-- 表名
--  字段  名称  类型  顺序
--  字段之间的分隔符需要指定

--ddl create table
create table itheima.t_archer(
    id int comment "ID编号",
    name string comment "英雄名称",
    hp_max int comment "最大生命",
    mp_max int comment "最大法力",
    attack_max int comment "最高物攻",
    defense_max int comment "最大物防",
    attack_range string comment "攻击范围",
    role_main string comment "主要定位",
    role_assist string comment "次要定位"
) comment "王者荣耀射手信息"
row format delimited
fields terminated by "\t"; -- 字段之间的分隔符是tab键 制表符

select * from t_archer;

--查看表结构
desc formatted t_archer;

--删除表sql
drop table t_archer;

create table itheima.t_archer1(
    id int comment "ID编号",
    name string comment "英雄名称",
    hp_max int comment "最大生命",
    mp_max int comment "最大法力",
    attack_max int comment "最高物攻",
    defense_max int comment "最大物防",
    attack_range string comment "攻击范围",
    role_main string comment "主要定位",
    role_assist string comment "次要定位"
);

--使用默认分隔符建表  \001  非打印字符
create table t_team_ace_player(
    id int,
    team_name string,
    ace_player_name string
);
-- row format delimited
-- fields terminated by "\001";

select * from t_team_ace_player;



--使用默认分隔符建表  \001  非打印字符
create table t_team_ace_player2(
    id int,
    team_name string,
    ace_player_name string
)
row format delimited
fields terminated by "\t";

select * from t_team_ace_player2;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/366697.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Spring boot开启定时任务的三种方式(内含源代码+sql文件)

Spring boot开启定时任务的三种方式&#xff08;内含源代码sql文件&#xff09; 源代码sql文件下载链接地址&#xff1a;https://download.csdn.net/download/weixin_46411355/87486580 目录Spring boot开启定时任务的三种方式&#xff08;内含源代码sql文件&#xff09;源代码…

【无人机】回波状态网络(ESN)在固定翼无人机非线性控制中的应用(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…

前端常见手写面试题集锦

实现迭代器生成函数 我们说迭代器对象全凭迭代器生成函数帮我们生成。在ES6中&#xff0c;实现一个迭代器生成函数并不是什么难事儿&#xff0c;因为ES6早帮我们考虑好了全套的解决方案&#xff0c;内置了贴心的 生成器 &#xff08;Generator&#xff09;供我们使用&#xff…

java面试题-IO流

基础IO1.如何从数据传输方式理解IO流&#xff1f;IO流根据处理数据的类型可以分为字节流和字符流。字节流字节流以字节&#xff08;8位&#xff09;为单位读写数据。字节流主要用于读写二进制文件&#xff0c;如图片、音频、视频等。Java中的InputStream和OutputStream就是字节…

写论文不用构建语料库!只需要福昕PDF阅读器高级搜索

写论文不用构建语料库&#xff01;只需要福昕PDF阅读器高级搜索 文章目录写论文不用构建语料库&#xff01;只需要福昕PDF阅读器高级搜索前言&#xff1a;“福昕语料库”使用前的准备&#xff1a;调用“语料库”&#xff1a;前言&#xff1a; 最近论文阅读可以借助NewBing的总…

【算法与数据结构(C语言)】栈和队列

文章目录 目录 前言 一、栈 1.栈的概念及结构 2.栈的实现 入栈 出栈 获取栈顶元素 获取栈中有效元素个数 检测栈是否为空&#xff0c;如果为空返回非零结果&#xff0c;如果不为空返回0 销毁栈 二、队列 1.队列的概念及结构 2.队列的实现 初始化队列 队尾入队列 队头出队列 获…

报表开发难上手?这里有一份 Fastreport 最新中文用户指南,请查收

Fast Reports,Inc.成立于1998年&#xff0c;多年来一直致力于开发快速报表软件&#xff0c;包括应用程序、库和插件。FastReport的报表生成器&#xff08;VCL平台和.NET平台&#xff09;、跨平台的多语言脚本引擎FastScript、桌面OLAP FastCube&#xff0c;如今都受到世界各地开…

Typecho COS插件实现网站静态资源存储到COS,降低本地存储负载

Typecho 简介Typecho 是一个简单、强大的轻量级开源博客平台&#xff0c;用于建立个人独立博客。它具有高效的性能&#xff0c;支持多种文件格式&#xff0c;并具有对设备的响应式适配功能。Typecho 相对于其他 CMS 还有一些特殊优势&#xff1a;包括可扩展性、不同数据库之间的…

IDA 实战--(2)熟悉工具

布局介绍 软件启动后会 有几个选项&#xff0c;一般直接选择Go 即可 之后的工作台布局如下 开始分析 分析的第一个&#xff0c;将PE 文件拖入工作区 刚开始接触&#xff0c;我们先保持默认选项&#xff0c;其它选项后面会详细讲解&#xff0c;点击OK 后&#xff0c;等待分析…

软件项目管理知识回顾---软件项目质量和资源管理

软件项目质量和资源管理 5.0质量管理 5.1质量管理模型 1.模型 boehm模型&#xff1a;可移植性&#xff0c;可使用性&#xff0c;可维护性McCall模型ISO体系认证5.2质量成本 1.含义&#xff1a;由于产品第一次不正常运行而产生的附加费用 预防成本和缺陷成本5.3质量管理 1.过程 …

Python opencv进行矩形识别

Python opencv进行矩形识别 图像识别中,圆形和矩形识别是最常用的两种,上一篇讲解了圆形识别,本例讲解矩形识别,最后的结果是可以识别出圆心,4个顶点,如下图: 左边是原始图像,右边是识别结果,在我i5 10400的CPU上,执行时间不到8ms。 识别出结果后,计算任意3个顶点…

【自监督论文阅读笔记】Unsupervised Learning of Dense Visual Representations

Abstract 对比自监督学习已成为无监督视觉表示学习的一种有前途的方法。通常&#xff0c;这些方法学习全局&#xff08;图像级&#xff09;表示&#xff0c;这些表示对于同一图像的不同视图&#xff08;即数据增强的组合&#xff09;是不变的。然而&#xff0c;许多视觉理解任务…

PDF文件怎么转图片格式?转换有技巧

PDF文件有时为了更美观或者更直观的展现出效果&#xff0c;我们会把它转成图片格式&#xff0c;这样不论是归档总结还是存储起来都会更为高效。有没有合适的转换方法呢&#xff1f;这就来给你们罗列几种我个人用过体验还算不错的方式&#xff0c;大家可以拿来参考一下哈。1.用电…

vm 网络配置

点击NAT设置&#xff0c;配置本台虚拟机ip&#xff08;注意网关要在同一个网段&#xff09;&#xff0c;配置对应端口 然后添加映射端口&#xff1a; 然后选择网络适配器 选择vm8网卡 配置网卡静态ip #查看网卡 ip addr #修改网卡配置 cd /etc/sysconfig/network-scripts…

DevData Talks | 对谈谷歌云 DORA 布道师,像谷歌一样度量 DevOps 表现

本期 DevData Talks 我们请到来自 Google Cloud 谷歌云的 DORA 研究团队的嘉宾 Nathen Harvey与 Apache DevLake、CNCF DevStream 的海外社区负责人 Maxim 进行对谈。如果您关注 DevOps 的话&#xff0c;也许对这个团队有所耳闻。 DORA 的全称是 DevOps Research and Assessme…

mysql lesson1

常用命令 1:exit 退出mysql 2&#xff1a;uroot pENTER键&#xff0c;再输入密码&#xff0c;不被别人看见 3&#xff1a;完美卸载&#xff1a;双击安装包&#xff0c;手动删除program file中的mysql,手动删除Programedate里的mysql 4:use mysql 使用数据库 5&#xff1a;…

InstallAware Multi-Platform updated

InstallAware Multi-Platform updated 原生ARM&#xff1a;为您的内置设置、IDE和整个工具链添加了Apple macOS和Linux ARM构建。 本地化&#xff1a;引擎内多语言感知&#xff0c;可再分发工具&#xff0c;具有资产隔离功能&#xff0c;使您的IP保持安全。 模板&#xff1a;将…

通信算法复习题纲

通信算法复习题1、当信源发送信号满足以下哪一项条件时&#xff0c;接收端采用最小距离准则进行判决等价于采用最大后验概率准则进行判决&#xff1f;2、OFDM系统的正交性体现在哪个方面&#xff1f;3、模拟信号数字化过程中&#xff0c;哪一步会引入量化噪声&#xff1f;4、OF…

考研复试机试 | c++ | 王道复试班

目录n的阶乘 &#xff08;清华上机&#xff09;题目描述代码汉诺塔问题题目&#xff1a;代码&#xff1a;Fibonacci数列 &#xff08;上交复试&#xff09;题目代码&#xff1a;二叉树&#xff1a;题目&#xff1a;代码&#xff1a;n的阶乘 &#xff08;清华上机&#xff09; …

汽车电子社区交流宣传

http://t.csdn.cn/VSLO0http://t.csdn.cn/VSLO0 当今的汽车行业已经进入了数字化时代&#xff0c;汽车电子软件的开发变得越来越重要。在这个领域&#xff0c;开发者们需要应对各种挑战&#xff0c;包括复杂的硬件和软件交互、高效的嵌入式编程和安全性要求。为了帮助汽车电子…