建表:node
CREATE TABLE my_first_table ( id BIGINT, name STRING ) TBLPROPERTIES( 'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler', 'kudu.table_name' = 'my_first_table', 'kudu.master_addresses' = 'node1:7051', 'kudu.key_columns' = 'id' );
Fetched 0 row(s) in 1.26s
[node2:21000] > show tables;
Query: show tables
+----------------+
| name |
+----------------+
| my_first_table |
+----------------+
Fetched 1 row(s) in 0.06s
[node2:21000] > desc my_first_table
> ;
Query: describe my_first_table
+------+--------+---------+
| name | type | comment |
+------+--------+---------+
| id | bigint | |
| name | string | |
+------+--------+---------+
Fetched 2 row(s) in 5.09sspa
插入數據:code
insert into my_first_table(id, name) values(1001,'shaocheng'); insert into my_first_table(id, name) values(1002,'jianzhong'); insert into my_first_table(id, name) values(1003,'chenbiao'); insert into my_first_table(id, name) values(1004,'xingjiang');
[node2:21000] > insert into my_first_table(id, name) values(1001,'shaocheng');
Query: insert into my_first_table(id, name) values(1001,'shaocheng')
Inserted 1 row(s) in 0.27s
[node2:21000] > insert into my_first_table(id, name) values(1002,'jianzhong');
Query: insert into my_first_table(id, name) values(1002,'jianzhong')
Inserted 1 row(s) in 0.12s
[node2:21000] > insert into my_first_table(id, name) values(1003,'chenbiao');
Query: insert into my_first_table(id, name) values(1003,'chenbiao')
Inserted 1 row(s) in 0.12s
[node2:21000] > insert into my_first_table(id, name) values(1004,'xingjiang');
Query: insert into my_first_table(id, name) values(1004,'xingjiang')
Inserted 1 row(s) in 0.12sblog
查詢:string
[node2:21000] > select * from my_first_table;
Query: select * from my_first_table
+------+-----------+
| id | name |
+------+-----------+
| 1001 | shaocheng |
| 1002 | jianzhong |
| 1003 | chenbiao |
| 1004 | xingjiang |
+------+-----------+table
刪除:ast
[node2:21000] > delete my_first_table where id=1003;
Query: delete my_first_table where id=1003class
Fetched 0 row(s) in 0.17s
[node2:21000] > select * from my_first_table;
Query: select * from my_first_table
+------+-----------+
| id | name |
+------+-----------+
| 1001 | shaocheng |
| 1002 | jianzhong |
| 1004 | xingjiang |
+------+-----------+
Fetched 3 row(s) in 0.15sselect
創建第二張表:數據
CREATE TABLE my_second_table TBLPROPERTIES( 'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler', 'kudu.table_name' = 'my_second_table', 'kudu.master_addresses' = 'node1:7051', 'kudu.key_columns' = 'id' ) AS SELECT * FROM my_first_table ;
CREATE TABLE my_second_table TBLPROPERTIES( 'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler', 'kudu.table_name' = 'my_second_table', 'kudu.master_addresses' = 'node1:7051', 'kudu.key_columns' = 'id') AS SELECT * FROM my_first_table ;