zoukankan      html  css  js  c++  java
  • hive分区表插入一条测试数据

    1.show create table tb_cdr;
    +-------------------------------------------------------+--+
    |                    createtab_stmt                     |
    +-------------------------------------------------------+--+
    | CREATE TABLE `tb_cdr`(                                |
    |   `begintime` bigint,                                 |
    |   `usernum` string,                                   |
    |   `homearea` string,                                  |
    |   `relatenum` string,                                 |
    |   `relatehomeac` string,                              |
    |   `imsi` string,                                      |
    |   `imei` string,                                      |
    |   `curarea` string,                                   |
    |   `neid` string,                                      |
    |   `lai` int,                                          |
    |   `ci` string,                                        |
    |   `longitude` float,                                  |
    |   `latitude` float,                                   |
    |   `billtype` string,                                  |
    |   `calltype` string,                                  |
    |   `dtmf` string,                                      |
    |   `callduration` int,                                 |
    |   `cause` string,                                     |
    |   `rlgtime` bigint,                                   |
    |   `alerttime` bigint,                                 |
    |   `connecttime` bigint,                               |
    |   `disconnecttime` bigint,                            |
    |   `sid` string,                                       |
    |   `idflag` int,                                       |
    |   `rawrelatenum` string,                              |
    |   `redirflag` int,                                    |
    |   `origcalledno` string,                              |
    |   `disconnecttype` int,                               |
    |   `newlai` int,                                       |
    |   `newci` string,                                     |
    |   `newlongitude` float,                               |
    |   `newlatitude` float,                                |
    |   `tmsi` string,                                      |
    |   `spcode` string,                                    |
    |   `voiceflag` string,                                 |
    |   `voicekeya` string,                                 |
    |   `voicekeyb` string,                                 |
    |   `peersid` string,                                   |
    |   `guti` string,                                      |
    |   `userip` string,                                    |
    |   `cgi` string,                                       |
    |   `newcgi` string,                                    |
    |   `mobileip` string,                                  |
    |   `imsip` string,                                     |
    |   `recflag` int,                                      |
    |   `holdflag` int,                                     |
    |   `hocnt` int,                                        |
    |   `mediatype` string,                                 |
    |   `speechver` string,                                 |
    |   `beartype` string,                                  |
    |   `relatelai` int,                                    |
    |   `relateci` int,                                     |
    |   `relatelongitude` float,                            |
    |   `relatelatitude` float,                             |
    |   `relatecgi` string,                                 |
    |   `client` string,                                    |
    |   `tags` string,                                      |
    |   `extra_longitude` float,                            |
    |   `extra_latitude` float,                             |
    |   `extra_newlongitude` float,                         |
    |   `extra_newlatitude` float,                          |
    |   `extra_relatelongitude` float,                      |
    |   `extra_relatelatitude` float,                       |
    |   `geohash` string,                                   |
    |   `newgeohash` string,                                |
    |   `relategeohash` string)                             |
    | PARTITIONED BY (                                      |
    |   `cp` bigint,                                        |
    |   `ld` bigint)                                        |
    | ROW FORMAT SERDE                                      |
    |   'org.apache.hadoop.hive.ql.io.orc.OrcSerde'         |
    | STORED AS INPUTFORMAT                                 |
    |   'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'   |
    | OUTPUTFORMAT                                          |
    |   'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'  |
    | LOCATION                                              |
    |   'hdfs://hacluster/user/hive/warehouse/tb_cdr'       |
    | TBLPROPERTIES (                                       |
    |   'last_modified_by'='omm',                           |
    |   'last_modified_time'='1504964008',                  |
    |   'orc.compress'='ZLIB',                              |
    |   'transient_lastDdlTime'='1504964008')               |
    +-------------------------------------------------------+
    2.向表中插入一条数据
    insert into table tb_cdr partition(cp=1,ld=2) values(
    0,
    'a',
    'a',
    'a',
    'a',
    'a',
    'a',
    'a',
    'a',
    0,
    'a',
    0.0,
    0.0,
    'a',
    'a',
    'a',
    0,
    'a',
    0,
    0,
    0,
    0,
    'a',
    0,
    'a',
    0,
    'a',
    0,
    0,
    'a',
    0.0,
    0.0,
    'a',
    'a',
    'a',
    'a',
    'a',
    'a',
    'a',
    'a',
    'a',
    'a',
    'a',
    'a',
    0,
    0,
    0,
    'a',
    'a',
    'a',
    0,
    0,
    0.0,
    0.0,
    'a',
    'a',
    'a',
    0.0,
    0.0,
    0.0,
    0.0,
    0.0,
    0.0,
    'a',
    'a',
    'a');
    3.查询
    select * from tb_cdr where cp=1 and ld=2 limit 1;
    +-------------------+-----------------+------------------+-------------------+----------------------+--------------+--------------+-----------------+--------------+-------------+------------+-------------------+------------------+------------------+------------------+--------------+----------------------+---------------+-----------------+-------------------+---------------------+------------------------+-------------+----------------+----------------------+-------------------+----------------------+------------------------+----------------+---------------+----------------------+---------------------+--------------+----------------+-------------------+-------------------+-------------------+-----------------+--------------+----------------+-------------+----------------+------------------+---------------+-----------------+------------------+---------------+-------------------+-------------------+------------------+-------------------+------------------+-------------------------+------------------------+-------------------+----------------+--------------+-------------------------+------------------------+----------------------------+---------------------------+-------------------------------+------------------------------+-----------------+--------------------+-----------------------+------------+------------+--+
    | tb_cdr.begintime  | tb_cdr.usernum  | tb_cdr.homearea  | tb_cdr.relatenum  | tb_cdr.relatehomeac  | tb_cdr.imsi  | tb_cdr.imei  | tb_cdr.curarea  | tb_cdr.neid  | tb_cdr.lai  | tb_cdr.ci  | tb_cdr.longitude  | tb_cdr.latitude  | tb_cdr.billtype  | tb_cdr.calltype  | tb_cdr.dtmf  | tb_cdr.callduration  | tb_cdr.cause  | tb_cdr.rlgtime  | tb_cdr.alerttime  | tb_cdr.connecttime  | tb_cdr.disconnecttime  | tb_cdr.sid  | tb_cdr.idflag  | tb_cdr.rawrelatenum  | tb_cdr.redirflag  | tb_cdr.origcalledno  | tb_cdr.disconnecttype  | tb_cdr.newlai  | tb_cdr.newci  | tb_cdr.newlongitude  | tb_cdr.newlatitude  | tb_cdr.tmsi  | tb_cdr.spcode  | tb_cdr.voiceflag  | tb_cdr.voicekeya  | tb_cdr.voicekeyb  | tb_cdr.peersid  | tb_cdr.guti  | tb_cdr.userip  | tb_cdr.cgi  | tb_cdr.newcgi  | tb_cdr.mobileip  | tb_cdr.imsip  | tb_cdr.recflag  | tb_cdr.holdflag  | tb_cdr.hocnt  | tb_cdr.mediatype  | tb_cdr.speechver  | tb_cdr.beartype  | tb_cdr.relatelai  | tb_cdr.relateci  | tb_cdr.relatelongitude  | tb_cdr.relatelatitude  | tb_cdr.relatecgi  | tb_cdr.client  | tb_cdr.tags  | tb_cdr.extra_longitude  | tb_cdr.extra_latitude  | tb_cdr.extra_newlongitude  | tb_cdr.extra_newlatitude  | tb_cdr.extra_relatelongitude  | tb_cdr.extra_relatelatitude  | tb_cdr.geohash  | tb_cdr.newgeohash  | tb_cdr.relategeohash  | tb_cdr.cp  | tb_cdr.ld  |
    +-------------------+-----------------+------------------+-------------------+----------------------+--------------+--------------+-----------------+--------------+-------------+------------+-------------------+------------------+------------------+------------------+--------------+----------------------+---------------+-----------------+-------------------+---------------------+------------------------+-------------+----------------+----------------------+-------------------+----------------------+------------------------+----------------+---------------+----------------------+---------------------+--------------+----------------+-------------------+-------------------+-------------------+-----------------+--------------+----------------+-------------+----------------+------------------+---------------+-----------------+------------------+---------------+-------------------+-------------------+------------------+-------------------+------------------+-------------------------+------------------------+-------------------+----------------+--------------+-------------------------+------------------------+----------------------------+---------------------------+-------------------------------+------------------------------+-----------------+--------------------+-----------------------+------------+------------+--+
    | 0                 | a               | a                | a                 | a                    | a            | a            | a               | a            | 0           | a          | 0.0               | 0.0              | a                | a                | a            | 0                    | a             | 0               | 0                 | 0                   | 0                      | a           | 0              | a                    | 0                 | a                    | 0                      | 0              | a             | 0.0                  | 0.0                 | a            | a              | a                 | a                 | a                 | a               | a            | a              | a           | a              | a                | a             | 0               | 0                | 0             | a                 | a                 | a                | 0                 | 0                | 0.0                     | 0.0                    | a                 | a              | a            | 0.0                     | 0.0                    | 0.0                        | 0.0                       | 0.0                           | 0.0                          | a               | a                  | a                     | 1          | 2          |
    +-------------------+-----------------+------------------+-------------------+----------------------+--------------+--------------+-----------------+--------------+-------------+------------+-------------------+------------------+------------------+------------------+--------------+----------------------+---------------+-----------------+-------------------+---------------------+------------------------+-------------+----------------+----------------------+-------------------+----------------------+------------------------+----------------+---------------+----------------------+---------------------+--------------+----------------+-------------------+-------------------+-------------------+-----------------+--------------+----------------+-------------+----------------+------------------+---------------+-----------------+------------------+---------------+-------------------+-------------------+------------------+-------------------+------------------+-------------------------+------------------------+-------------------+----------------+--------------+-------------------------+------------------------+----------------------------+---------------------------+-------------------------------+------------------------------+-----------------+--------------------+-----------------------+------------+------------+--+
  • 相关阅读:
    第0次作业(第二学期)
    C语言程序设计(基础)最后一次作业-- 总结报告
    第14、15教学周作业
    第七周作业
    第六周作业
    第四周作业
    第四次作业
    2018第三次作业
    2018第二次作业
    2018第三,四作业合集
  • 原文地址:https://www.cnblogs.com/lingluo2017/p/10725488.html
Copyright © 2011-2022 走看看