Hive
嘿哈哈哈哈哈哈
这个作者很懒,什么都没留下…
展开
-
hive-DML-查询-排序
全局排序(order by)只有一个Reducer,默认升序(ASC),降序为DESC每个 Reduce 内部排序(sort by)Sort by 为每个 reducer 产生一个排序文件。每个 Reducer 内部进行排序(Reducer随机分区,区内排序),对全局结果集来说不是排序。分区(distribute by)Distribute By: distribute by 子句可以控制某个特定行应该到哪个 reducer,distribute by 类似 MR 中 partition(自定义原创 2021-07-27 11:49:05 · 86 阅读 · 0 评论 -
hive-DML-查询-join语句
hive支持以下连接表的语句join_table: table_reference [INNER] JOIN table_factor [join_condition] | table_reference {LEFT|RIGHT|FULL} [OUTER] JOIN table_reference join_condition | table_reference LEFT SEMI JOIN table_reference join_condition | table_referenc原创 2021-07-27 09:48:49 · 86 阅读 · 0 评论 -
hive-DML-查询
查询语法:SELECT [ALL | DISTINCT] select_expr, select_expr, ... FROM table_reference [WHERE where_condition] [GROUP BY col_list] [ORDER BY col_list] [CLUSTER BY col_list | [DISTRIBUTE BY col_list] [SORT BY col_list] ] [LIMIT [offset,] rows]S原创 2021-07-22 10:51:55 · 111 阅读 · 0 评论 -
hive-DML-数据导出
1insert导出1.1将查询结果导出到本地insert overwrite local directory '/opt/hive/export/student' select * from student;1.2将查询结果格式化导出到本地insert overwrite local directory '/opt/hive/export/student1' row format delimited fields terminated by '\t' select * from student;原创 2021-07-21 17:00:28 · 71 阅读 · 0 评论 -
hive-DML-数据导入
将文件加载到表中(load)LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename [PARTITION (partcol1=val1, partcol2=val2 ...)]如果指定关键字 LOCAL,则load 命令将在本地文件系统中查找文件路径。否则,在hdfs上查找文件。如果使用 OVERWRITE 关键字,则目标表(或分区)的内容将被删除并替换为filepath引用的文件;否则filepath引用的文件将被添原创 2021-07-21 16:04:02 · 98 阅读 · 0 评论 -
hive-DDL-修改表、删除表
修改表重命名表ALTER TABLE table_name RENAME TO new_table_name;增加/修改/替换列信息更新列ALTER TABLE table_name [PARTITION partition_spec] CHANGE [COLUMN] col_old_name col_new_name column_type[COMMENT col_comment] [FIRST|AFTER column_name] [CASCADE|RESTRICT];colum原创 2021-07-21 10:57:08 · 199 阅读 · 0 评论 -
hive-DDL-创建表
创建表CREATE [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name [(col_name data_type [column_constraint_specification] [COMMENT col_comment], ... [constraint_specification])] [COMMENT table_comment] [PARTITIONED BY (col_name data_type [COMMENT col_原创 2021-07-21 10:13:30 · 203 阅读 · 0 评论 -
hive-DDL-创建、显示、更改、删除数据库
创建数据库CREATE DATABASE [IF NOT EXISTS] database_name [COMMENT database_comment] [LOCATION hdfs_path] [WITH DBPROPERTIES (property_name=property_value, ...)];LOCATION:指定数据库在hdfs上的存放的目录例如:在根目录下创建名为hive1的数据库hive1create database if not exists hive1 lo原创 2021-07-20 16:39:43 · 208 阅读 · 0 评论