发布网友 发布时间:2022-04-25 12:47
共3个回答
懂视网 时间:2022-04-08 06:57
hive (default)> show create table test;
OK
createtab_stmt
CREATE TABLE test
(
id
int)
ROW FORMAT SERDE
‘org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe’
STORED AS INPUTFORMAT
‘org.apache.hadoop.mapred.TextInputFormat’
OUTPUTFORMAT
‘org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat’
LOCATION
‘hdfs://nameservice1/user/hive/warehouse/test’
TBLPROPERTIES (
‘transient_lastDdlTime’=’1436799093’)
Time taken: 0.135 seconds, Fetched: 12 row(s)
其他获得表的信息
hive (default)> create external table testexttable(
> name string comment ‘name value‘,
> addr string comment ‘addr value‘
> );
OK
Time taken: 10.172 seconds
create table if not exists testtable(
name string comment ‘name value‘,
addr string comment ‘addr value‘
)
row format delimited fields terminated by ‘ ‘ lines terminated by ‘
‘ stored as textfile
;
hive (default)> load data local inpath ‘/liguodong/hivedata/datatest’ overwrite into table testtable;
hive (default)> load data local inpath ‘/liguodong/hivedata/datatest’ into table testtable;
如果没有使用overwrite,则会再拷贝一份数据,不会覆盖原来的数据。
hive (default)> create external table if not exists employees(
> name string,
> salary string,
> subordinates array<string>,
> deductions map<string,float>,
> address struct<street:string,city:string,state:string,zip:int>
> )
> row format delimited fields terminated by ‘ ‘
> collection items terminated by ‘,‘
> map keys terminated by ‘:‘
> lines terminated by ‘
‘
> stored as textfile
> location ‘/liguodong/data/‘
> ;
hive> select * from employees;
OK
tony 1338 ["a1","a2","a3"] {"k1":1.0,"k2":2.0,"k3":3.0} {"street":"s1","city":"s2","state":"s3","zip":4}
mark 5453 ["a4","a5","a6"] {"k4":4.0,"k5":5.0,"k6":6.0} {"street":"s4","city":"s5","state":"s6","zip":6}
ivy 323 ["a7","a8","a9"] {"k7":7.0,"k8":8.0,"k9":9.0} {"street":"s7","city":"s8","state":"s9","zip":9}
Time taken: 10.204 seconds, Fetched: 3 row(s)
查树组
hive> select subordinates[1] from employees;
Total MapReduce CPU Time Spent: 2 seconds 740 msec
OK
a2
a5
a8
查map
hive> select deductions["k2"] from employees;
OK
2.0
NULL
NULL
Time taken: 75.812 seconds, Fetched: 3 row(s)
查结构体
hive> select address.city from employees;
Total MapReduce CPU Time Spent: 2 seconds 200 msec
OK
s2
s5
s8
Time taken: 75.311 seconds, Fetched: 3 row(s)
注意:select *
不执行mapreduce,只进行一个本地的查询。
而select 某个字段
生成一个job,执行mapreduce。
select * from employees;
select * from employees limit 10;
内部表删除,会连同hdfs存储的数据一同删除,而外部表删除,只会删除外部表的元数据信息。
hive (default)> drop table testtable;
OK
Time taken: 10.283 seconds
hive (default)> drop table testexttable;
OK
Time taken: 0.258 seconds
版权声明:本文为博主原创文章,未经博主允许不得转载。
Hive命令行常用操作(数据库操作,表操作)
标签:hive 数据库操作 命令行 表操作
热心网友 时间:2022-04-08 04:05
查看表结构信息如下
1、desc formatted table_name;
2、desc table_name。
一、电脑常见问题
主板不启动,开机无显示,有显卡报警声。
故障原因:一般是显卡松动或显卡损坏。
处理办法:打开机箱,把显卡重新插好即可。要检查AGP插槽内是否有小异物,否则会使显卡不能插接到位;对于使用语音报警的主板,应仔细辨别语音提示的内容,再根据内容解决相应故障。
如果以上办法处理后还报警,就可能是显卡的芯片坏了,更换或修理显卡。如果开机后听到"嘀"的一声自检通过,显示器正常但就是没有图像,把该显卡插在其他主板上,使用正常,那就是显卡与主板不兼容,应该更换显卡。
热心网友 时间:2022-04-08 05:23
1