hive sql插入一行数据_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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值