kudu常用命令

https://www.cnblogs.com/starzy/p/10573508.html

1.建表语句
create TABLE kudu.default.my_first_table(
id BIGINT WITH (primary_key = true),
name varchar)
WITH (
number_of_replicas = 3,
partition_by_hash_buckets = 2,
partition_by_hash_columns = ARRAY[‘id’],
partition_by_range_columns = ARRAY[‘id’],
range_partitions = ‘[{“lower”:null,“upper”:null}]’
);

CREATE TABLE kudu.default.app_travel_math (
uuid varchar WITH ( primary_key = true ),
userid varchar WITH ( nullable = true ),
taskid varchar WITH ( nullable = true ),
validstarttime bigint WITH ( nullable = true ),
validendtime bigint WITH ( nullable = true )
)
WITH (
number_of_replicas = 3,
partition_by_hash_buckets = 4,
partition_by_hash_columns = ARRAY[‘uuid’],
partition_by_range_columns = ARRAY[‘uuid’],
range_partitions = ‘[{“lower”:null,“upper”:null}]’
) ;

2.删表语句
drop table if exists my_first_table;

3.新增
INSERT INTO my_first_table VALUES (50, ‘zhangsan’);
USERT INTO my_first_table VALUES (50, ‘zhangsan2’);
使用单个语句插入三行
INSERT INTO my_first_table VALUES (1, ‘john’), (2, ‘jane’), (3, ‘jim’);
批量插入
INSERT INTO my_first_table SELECT * FROM temp1;

4.修改
UPDATE my_first_table SET name=‘xiaowang’ where id =1 ;

5.类型
demo示例
val nongroupticket = StructType(
Array(
StructField(“Id”, StringType),
StructField(“ParkId”, IntegerType),
StructField(“ParkSaleTicketClassId”, IntegerType),
StructField(“TradeInfoId”, StringType),
StructField(“TerminalId”, IntegerType),
StructField(“Qty”, IntegerType),
StructField(“Price”, DoubleType),
StructField(“SalePrice”, DoubleType),
StructField(“Amount”, DoubleType),
StructField(“ValidStartDate”, StringType),
StructField(“ValidDays”, IntegerType),
StructField(“InparkCounts”, IntegerType),
StructField(“InvoiceId”, LongType),
StructField(“CustomerId”, LongType),
StructField(“LastModificationTime”, StringType),
StructField(“LastModifierUserId”, LongType),
StructField(“CreationTime”, StringType),
StructField(“CreatorUserId”, LongType),
StructField(“TicketSaleStatus”, IntegerType),
StructField(“SyncTicketType”, IntegerType),
StructField(“FirstInparkTime”, StringType),
StructField(“PrintTicketTime”, StringType)
))

6.presto-kudu
查看表结构 desc  center_basic_park;
查看建表语句 show create table center_basic_park;

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值