zoukankan      html  css  js  c++  java
  • hive元数据研究

    hive的元数据存放在关系型数据库中,元数据中存储了hive中所有表格的信息,包括表格的名字,表格的字段,字段的类型,注释。这些信息分散的存放在各个表中,给定一个hive中的表格名字,查询这个表中含有的所有字段,使用如下的SQL语句:

    mysql> select COLUMNS_V2.* from COLUMNS_V2,SDS, TBLS where COLUMNS_V2.CD_ID = SDS.CD_ID and SDS.SD_ID = TBLS.SD_ID and TBLS.TBL_NAME='dwd_medical_hospital_dd';
    +-------+--------------------------------------+-------------+-----------+-------------+
    | CD_ID | COMMENT                              | COLUMN_NAME | TYPE_NAME | INTEGER_IDX |
    +-------+--------------------------------------+-------------+-----------+-------------+
    |   603 | 地址                                 | address     | string    |           2 |
    |   603 | 医院类型                             | clean_type  | string    |          14 |
    |   603 | 采集时间                             | create_time | string    |          10 |
    |   603 | 所在大区                             | extend_area | string    |          13 |
    |   603 | 所在城市                             | extend_city | string    |          11 |
    |   603 | 所在省份                             | extend_prov | string    |          12 |
    |   603 | 路线                                 | howtogo     | string    |           3 |
    |   603 | 主键ID/在其它表中表示为外键:hosp_id | id          | string    |           0 |
    |   603 | 医院等级                             | level       | string    |           4 |
    |   603 | 医院名字                             | name        | string    |           1 |
    |   603 | 简介                                 | profiles    | string    |           7 |
    |   603 | 区域ID/城市ID                        | prov_id     | string    |           5 |
    |   603 | 资源配置量                           | resouce     | string    |           8 |
    |   603 | 电话                                 | telephone   | string    |           6 |
    |   603 | 采集URL                              | url         | string    |           9 |
    |   583 | 地址                                 | address     | string    |           2 |
    |   583 | 医院类型                             | clean_type  | string    |          14 |
    |   583 | 采集时间                             | create_time | string    |          10 |
    |   583 | 所在大区                             | extend_area | string    |          13 |
    |   583 | 所在城市                             | extend_city | string    |          11 |
    |   583 | 所在省份                             | extend_prov | string    |          12 |
    |   583 | 路线                                 | howtogo     | string    |           3 |
    |   583 | 主键ID/在其它表中表示为外键:hosp_id | id          | string    |           0 |
    |   583 | 医院等级                             | level       | string    |           4 |
    |   583 | 医院名字                             | name        | string    |           1 |
    |   583 | 简介                                 | profiles    | string    |           7 |
    |   583 | 区域ID/城市ID                        | prov_id     | string    |           5 |
    |   583 | 资源配置量                           | resouce     | string    |           8 |
    |   583 | 电话                                 | telephone   | string    |           6 |
    |   583 | 采集URL                              | url         | string    |           9 |
    +-------+--------------------------------------+-------------+-----------+-------------+
    30 rows in set
    mysql> select COLUMNS_V2.* from COLUMNS_V2,SDS, TBLS where COLUMNS_V2.CD_ID = SDS.CD_ID and SDS.SD_ID = TBLS.SD_ID and TBLS.TBL_NAME='dws_info_doctor_dd';
    +-------+----------+----------------+-----------+-------------+
    | CD_ID | COMMENT  | COLUMN_NAME    | TYPE_NAME | INTEGER_IDX |
    +-------+----------+----------------+-----------+-------------+
    |   673 | 年龄     | age            | string    |           3 |
    |   673 | 科室ID   | department_id  | string    |          10 |
    |   673 | 从诊年限 | diagnosis_time | string    |           6 |
    |   673 | 履历     | experience     | string    |           8 |
    |   673 | 擅长疾病 | good           | string    |           5 |
    |   673 | NULL     | hosp_id        | string    |          11 |
    |   673 | 主键ID   | id             | string    |           0 |
    |   673 | 医生名称 | name           | string    |           1 |
    |   673 | 门诊量   | outpatient_num | string    |           7 |
    |   673 | 医生职称 | position       | string    |           2 |
    |   673 | 评分     | score          | string    |           9 |
    |   673 | 性别     | sex            | string    |           4 |
    |   758 | 年龄     | age            | string    |           3 |
    |   758 | 科室ID   | department_id  | string    |          10 |
    |   758 | 从诊年限 | diagnosis_time | string    |           6 |
    |   758 | 履历     | experience     | string    |           8 |
    |   758 | 擅长疾病 | good           | string    |           5 |
    |   758 | NULL     | hosp_id        | string    |          11 |
    |   758 | 主键ID   | id             | string    |           0 |
    |   758 | 医生名称 | name           | string    |           1 |
    |   758 | 门诊量   | outpatient_num | string    |           7 |
    |   758 | 医生职称 | position       | string    |           2 |
    |   758 | 评分     | score          | string    |           9 |
    |   758 | 性别     | sex            | string    |           4 |
    |   732 | 年龄     | age            | string    |           3 |
    |   732 | 科室ID   | department_id  | string    |          10 |
    |   732 | 从诊年限 | diagnosis_time | string    |           6 |
    |   732 | 履历     | experience     | string    |           8 |
    |   732 | 擅长疾病 | good           | string    |           5 |
    |   732 | 主键ID   | id             | string    |           0 |
    |   732 | 医生名称 | name           | string    |           1 |
    |   732 | 门诊量   | outpatient_num | string    |           7 |
    |   732 | 医生职称 | position       | string    |           2 |
    |   732 | 评分     | score          | string    |           9 |
    |   732 | 性别     | sex            | string    |           4 |
    +-------+----------+----------------+-----------+-------------+
    35 rows in set

    hive元数据中相关的表格关系如下:

    image

  • 相关阅读:
    【Webpack】432- 关于webpack4的14个知识点
    【Nuxtjs】431- 简述Nuxt.js
    【JS】430- 前端异常处理方案汇总
    【Web技术】429- TCP为啥要3次握手和4次挥手?
    【Nodejs】428- 消息队列助你成为高薪 Node.js 工程师
    【Web技术】427- 图解浏览器的基本工作原理
    【Vuejs】426- vue动态定义图片路径
    linux命令英文缩写的含义(方便记忆)
    VM虚拟机安装centos详细图文教程
    Android 你应该知道的学习资源 进阶之路贵在坚持
  • 原文地址:https://www.cnblogs.com/justinzhang/p/4793817.html
Copyright © 2011-2022 走看看