美文网首页Hive
Hive基本操作

Hive基本操作

作者: 明明德撩码 | 来源:发表于2018-03-02 18:22 被阅读31次

在所有操作前先启动hdfs、yarn、historyserver

hive操作

  • 启动hive
    bin/hive

  • 创建数据库
    create database db_hive


    db_hive
  • 使用数据库
    use db_hive

  • 创建表
    create table student(id int, name string) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';


  • 查看表
    show tables;

  • 查看表结构
    1、desc students
    2、desc formatted student; 推荐使用


    上图Location 说明:/user/hive/warehouse 是hdfs创建的系统目录,
  • 加载文件数据到student表中
    load data local inpath '/opt/datas/student.txt'into table student ;


  • 查看可以使用的函数

show functions


  • 查看某个函数
    desc function extended 函数名 ;
    例子:desc function extended upper;

    upper
  • 配置打印表头
    <property>
    <name>hive.cli.print.header</name>
    <value>false</value>
    <description>Whether to print the names of the columns in query output.</description>
    </property>

  • 配置打印所属库
    <property>
    <name>hive.cli.print.current.db</name>
    <value>true</value>
    <description>Whether to include the current database in the Hive prompt.</description>
    </property>

  • 退出hive eixt 重新进入。

相关文章

  • HIVE

    基本操作 hive进入hive模式 exit; 退出hive模式 展示正则匹配表名hive> use ad_s...

  • Hive之同比环比的计算

    Hive系列文章 Hive表的基本操作[http://www.ikeguang.com/?p=1657] Hive...

  • Hive sql常见操作

    基本sql操作 hive表操作 分区操作 Hive内置函数 (1)数学函数 常用的数学函数都有:round、flo...

  • Hive 基本操作

    准备工作 1.检查各项服务是否已正常启动 [x] hdfs启动【start-dfs.sh】 [x] yarn启动【...

  • Hive 基本操作

    数据库基本操作 ( 和MySQL脚本相似 ): 创建删除库操作 创建删除表操作 hive 特点 Hive不支持修改...

  • Hive基本操作

    在所有操作前先启动hdfs、yarn、historyserver。 hive操作 启动hivebin/hive 创...

  • Hive基本操作

    参考:hive 表的常用操作Hive基本操作 1 Thrift Server Thrift 支持多种语言之间的RP...

  • Hive基本操作

    1.使用SQL文件创建一张表: hive -f create_table 2.将外部数据加载到一张表里面: LOA...

  • hive 基本操作

    hive添加表 hive的命令就是mysql的命令. 创建数据库 创建表 把数据文件put到表在hdfs中的目录下...

  • Hive基本操作

    一、DDL 1.1 创建内部表 mytable 1.2 创建外部表 pageview 1.3 创建分区表 invi...

网友评论

    本文标题:Hive基本操作

    本文链接:https://www.haomeiwen.com/subject/atgaxftx.html