`
samuschen
  • 浏览: 398549 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

hive中关于partition的操作

    博客分类:
  • hive
阅读更多

hivecreate table mp (a string) partitioned by (b string, c string);
OK
Time taken: 0.044 seconds
hive> alter table mp add partition (b='1', c='1');
OK
Time taken: 0.079 seconds
hive> alter table mp add partition (b='1', c='2');
OK
Time taken: 0.052 seconds
hive> alter table mp add partition (b='2', c='2');
OK
Time taken: 0.056 seconds
hive> show partitions mp ;
OK
b=1/c=1
b=1/c=2
b=2/c=2
Time taken: 0.046 seconds
hive> explain extended alter table mp drop partition (b='1');
OK
ABSTRACT SYNTAX TREE:
  (TOK_ALTERTABLE_DROPPARTS mp (TOK_PARTSPEC (TOK_PARTVAL b '1')))

STAGE DEPENDENCIES:
  Stage-0 is a root stage

STAGE PLANS:
  Stage: Stage-0
      Drop Table Operator:
        Drop Table
          table: mp


Time taken: 0.048 seconds
hive> alter table mp drop partition (b='1');
FAILED: Error in metadata : table is partitioned but partition spec is not specified or tab: {b=1}
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
hive> show partitions mp ;
OK
b=1/c=1
b=1/c=2
b=2/c=2
Time taken: 0.044 seconds
hive> alter table mp add   partition ( b='1', c = '3') partition ( b='1' , c='4');
OK
Time taken: 0.168 seconds
hive> show partitions mp ;
OK
b=1/c=1
b=1/c=2
b=1/c=3
b=1/c=4
b=2/c=2
b=2/c=3
Time taken: 0.066 seconds
hive>insert overwrite table mp partition (b='1', c='1') select cnt from tmp_et3 ;

hive>alter table mp add columns (newcol string);

 

location指定目录结构
hive> alter table alter2 add partition (insertdate='2008-01-01') location '2008/01/01';

hive> alter table alter2 add partition (insertdate='2008-01-02') location '2008/01/02';

分享到:
评论

相关推荐

    hive原理1介绍

    hive是基于Hadoop的一个数据仓库工具,可以将结构化的数据...Hive中包含以下数据模型:Table内部表,External Table外部表,Partition分区,Bucket桶。Hive默认可以直接加载文本文件,还支持sequence file 、RCFile。

    修改hive表分区名称

    hive表修改分区数据

    分布式数据仓库Hive大全

    1.6 其它HIVE操作 11 2. HIVE 基本操作 12 2.1 create table 12 2.1.1 总述 12 2.1.2 语法 12 2.1.3 基本例子 14 2.1.4 创建分区 15 2.1.5 其它例子 16 2.2 Alter Table 17 2.2.1 Add Partitions 17 2.2.2 Drop ...

    Hive用户指南

    1.6 其它HIVE操作 11 2. HIVE 基本操作 12 2.1 create table 12 2.1.1 总述 12 2.1.2 语法 12 2.1.3 基本例子 14 2.1.4 创建分区 15 2.1.5 其它例子 16 2.2 Alter Table 17 2.2.1 Add Partitions 17 2.2.2 Drop ...

    Hive表分区

    Hive表分区,里面有比较详细的Hive表分区方法,希望能够有所帮助。

    Hive DML

    Hive不支持update的操作。数据一旦导入,则不可修改。要么drop掉整个表,要么建立新的表,导入新的数据。 load:加载数据到表 load data [local] inpath ‘filepath’ overwrite | into table 表名 [partition ...

    HIVE多行转多列 和 多列转多行

    1、HIVE多行转多列 源数据样式 把CAMERA_NO,RESULT_DATA两列转换为CAMERA_NO字段的数据为列名,RESULT_DATA字段对应CAMERA_NO的数据为值 方法一:利用str_to_map函数 alter table ods.iot.iot_5060_iotdaq.5060_...

    hivezzy:添加partition支持正则表达式

    hivezzy 添加partition支持正则表达式

    快速学习-DML数据操作

    第 5 章 DML数据操作 5.1 数据导入 5.1.1 向表中装载数据(Load) 语法 hive> load data [local] inpath '/opt/module/datas/student.txt' [overwrite] | into table student [partition (partcol1=val1,…)]; (1...

    hive-probabilistic-utils:hive 的概率数据结构和算法

    hive 中的概率数据结构和算法。 目前只实现了 hyperloglog。 概要 -- estimate the cardinality of SELECT * FROM src GROUP BY col1, col2; SELECT hll(col1, col2).cardinality from src; -- create hyperloglog...

    hive开发文档

    hive开发文档,新手入门比较好 内容包括:安装,建表,查询,partition,执行计划等

    数据库表分区详解

    数据库优化的一部分详解 select count(*) from dcsj_time subpartition...select count(*) from dcsj_time partition(dcsj_time_2012) select * from user_tab_partitions select * from user_tab_subpartitions

    Hive SQL大厂必考常用窗口函数及面试题.pdf

    窗⼝函数也称为OLAP函数,OLAP 是OnLine Analytical Processing 的简称,意思是对数据库数据进⾏实时分析处理。例如,市场分析、创建财务报表、创建计划...但是,PARTITION BY ⼦句并不具备 GROUP BY ⼦句的汇总功能。

    sqoop1: import to hive partitioned table

    NULL 博文链接:https://ylzhj02.iteye.com/blog/2051729

    Hive分区/分桶

    分区表: 创建分区表 ​ create table t_user_partition(id int, name string) ... load data local inpath '/root/hivedata/china.txt' into table t_user_partition partition(country ='china'); load dat

    【hive on spark Error】return code 30041 from org.apache.hadoop.hive.ql.exec.spark.SparkTask.

    ERROR : FAILED: Execution Error, return code 30041 from org.apache.hadoop.hive.ql.exec.spark.SparkTask. 前言报错信息异常分析配置改动后记 前言 在成功消除Cloudare管理界面上那些可恶的警告之后,我又对yarn...

    Hive分区表

    一:简介 分区表就是根据指定字段的值进行...静态分区: 必须手动显式的添加需要分区的字段值, 分类的值有多少个就要添加多少次 (alter table add partition)。静态分区适合分区字段的值比较少的情况。 动态分区:创建表

    LearnBasicBigDataTech:一些大数据分析项目,例如Spark,Hive,Presto和数据可视化(例如Superset)

    Big Data Learning on Hive, Spark, Presto, Superset(Data Visulaization)Learning Part 1Basic operations on HiveCreate table and load dataCreate a table without partition stored in textfilehive> create ...

    大数据学习笔记

    14.3 Zookeeper在KAFKA中扮演的角色 54 第15章 KAFKA安装 55 第16章 KAFKA基本操作 56 16.1 启动zookeeper服务 56 16.2 单个单节点中间件配置 56 16.3 Topics列表 56 16.4 启动生产者发送信息 57 16.5 启动消费者...

    大数据面试题.docx

    大数据面试题全文共2页,当前为第1页。大数据面试题全文共2页,... 15、kafka中为什么要有partition? 16、topic是什么? 17、spark的shuffle是什么概念? shuffle是随机分组的概念 18、zookeeper是做什么用的? 19、

Global site tag (gtag.js) - Google Analytics