[Hive - Tutorial] Type System 数据类型
数据类型
Type System
Hive supports primitive and complex data types, as described below. See Hive Data Types for additional information.
Hive支持原生和复杂数据类型。
Primitive Types
原生数据类型
- Types are associated with the columns in the tables. The following Primitive types are supported:
- Integers
- TINYINT - 1 byte integer
- SMALLINT - 2 byte integer
- INT - 4 byte integer
- BIGINT - 8 byte integer
- Boolean type
- BOOLEAN - TRUE/FALSE
- Floating point numbers
- FLOAT - single precision
- DOUBLE - Double precision
- String type
- STRING - sequence of characters in a specified character set
The Types are organized in the following hierarchy (where the parent is a super type of all the children instances):
数据类型层次关系:
- Type
Primitive Type
Number
DOUBLE
FLOAT
BIGINT
INT
SMALLINT
TINYINT
STRING
BOOLEAN
This type hierarchy defines how the types are implicitly converted in the query language. Implicit conversion is allowed for types from child to an ancestor. So when a query expression expects type1 and the data is of type2, type2 is implicitly converted to type1 if type1 is an ancestor of type2 in the type hierarchy. Note that the type hierarchy allows the implicit conversion of STRING to DOUBLE.
在SQL中可进行类型转换,但是只能是子数据类型转换成祖先数据类型。另外,字符串类型也可以转为Double类型
Explicit type conversion can be done using the cast operator as shown in the #Built In Functions section below.
Complex Types
复杂数据类型
Complex Types can be built up from primitive types and other composite types using:
- Structs: the elements within the type can be accessed using the DOT (.) notation. For example, for a column c of type STRUCT {a INT; b INT} the a field is accessed by the expression c.a
- Maps (key-value tuples): The elements are accessed using ['element name'] notation. For example in a map M comprising of a mapping from 'group' -> gid the gid value can be accessed using M['group']
- Arrays (indexable lists): The elements in the array have to be in the same type. Elements can be accessed using the [n] notation where n is an index (zero-based) into the array. For example for an array A having the elements ['a', 'b', 'c'], A[1] retruns 'b'.
复杂数据类型支持:Structs,Maps,Arrays 三种。并且可以嵌套使用。
Using the primitive types and the constructs for creating complex types, types with arbitrary levels of nesting can be created. For example, a type User may comprise of the following fields:
- gender - which is a STRING.
- active - which is a BOOLEAN.
https://cwiki.apache.org/confluence/display/Hive/Tutorial
[Hive - Tutorial] Type System 数据类型的更多相关文章
- Hive Tutorial(上)(Hive 入门指导)
用户指导 Hive 指导 Hive指导 概念 Hive是什么 Hive不是什么 获得和开始 数据单元 类型系统 内置操作符和方法 语言性能 用法和例子(在<下>里面) 概念 Hive是什么 ...
- Hive Tutorial 阅读记录
Hive Tutorial 目录 Hive Tutorial 1.Concepts 1.1.What Is Hive 1.2.What Hive Is NOT 1.3.Getting Started ...
- [Hive - Tutorial] Built In Operators and Functions 内置操作符与内置函数
Built-in Operators Relational Operators The following operators compare the passed operands and gene ...
- JsonException: Max allowed object depth reached while trying to export from type System.Single
在进行类转json字符串时,报错JsonException: Max allowed object depth reached while trying to export from type Sys ...
- [Hive - Tutorial] Creating, Showing, Altering, and Dropping Tables
Creating, Showing, Altering, and Dropping Tables See Hive Data Definition Language for detailed info ...
- Beginning Scala study note(8) Scala Type System
1. Unified Type System Scala has a unified type system, enclosed by the type Any at the top of the h ...
- Could not load type 'System.Reflection.AssemblySignatureKeyAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c
错误: Could not load type 'System.Reflection.AssemblySignatureKeyAttribute' from assembly 'mscorlib, V ...
- foreach statement cannot operate on variables of type 'System.Web.UI.WebControls.Table' because 'System.Web.UI.WebControls.Table' does not contain a public definition for 'GetEnumerator'
错误:foreach statement cannot operate on variables of type 'System.Web.UI.WebControls.Table' because ' ...
- Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, ...
随机推荐
- javascript基础之数组对象
一.定义数组的方法: 定义了一个空数组: var myArray =new Array(); 指定有n个空元素的数组: var myArray=new Array(n); 定义数组并赋值: var m ...
- Centos7安装Xmind
1.首先,下载对应版本的deb包,32bit系统下载32bit软件包,64bit系统下载64bit软件包 2.解压deb包,得到data.tar.gz 和control.tar.gz 两个归档文件 3 ...
- [Linux 命令]df -h
查看目前磁盘空间和使用情况 以更易读的方式显示
- WCF 简单示例
WCF(Windows Communication Foundation,WCF)是基于Windows平台下开发和部署服务的软件开发包(Software Development Kit,SDK).WC ...
- [置顶] Android系统五大布局详解Layout
我们知道Android系统应用程序一般是由多个Activity组成,而这些Activity以视图的形式展现在我们面前,视图都是由一个一个的组件构成的.组件就是我们常见的Button.TextEdit等 ...
- sqlsevrer中output的用法
近日,看到代码中有output写法,不知其意,经过一番查找,终于找到了原因,它的作用是将修改影响的结果给输出出来. 比如update语句, 除了修改数据以外, 对于发生更新的列, update语句还可 ...
- android动画坐标定义
这段时间一直在忙Android的项目,总算抽出点时间休息一下,准备把一些项目用到的Android经验分享一下. 在Android开发过程中,经常会碰到Activity之间的切换效果的问题,下面介绍一下 ...
- poj 1703 Find them, Catch them(并查集)
题目:http://poj.org/problem?id=1703 题意:一个地方有两个帮派, 每个罪犯只属于其中一个帮派,D 后输入的是两个人属于不同的帮派, A后询问 两个人是否属于 同一个帮派. ...
- Nodejs express中创建ejs项目 error install Couldn't read dependencies
最近在看<Node.js开发指南>,看到使用nodejs进行web开发的时候,准备创建ejs项目遇到问题了 书上命令为: express -t ejs microblog 可是执行 ...
- bzoj1832: [AHOI2008]聚会
写过的题... #include<cstdio> #include<cstring> #include<iostream> #include<algorith ...