zoukankan      html  css  js  c++  java
  • [Hive

    数据类型
    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

    谨言慎行,专注思考 , 工作与生活同乐
  • 相关阅读:
    Qt之加载QSS文件
    Qt之QSS(黑色炫酷)
    Sublime Text 2 快捷键
    QTablewidget 简单例子
    QTableview 只显示横向线
    Qt删除文件夹
    Ubuntu(Debian)apt-get
    C++中char*与wchar_t*之间的转换
    Qtl和JS、HTML通信/交互
    浅谈Socket编程
  • 原文地址:https://www.cnblogs.com/tmeily/p/4243767.html
Copyright © 2011-2022 走看看