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;