岚天逸见

Hudi的ro和rt表

建表后并不会产生 ro 和 rt 两个表:

spark-sql> create table hudi_mor_tbl (
         >   id int,
         >   name string,
         >   price double,
         >   ts bigint
         > ) using hudi
         > tblproperties (
         >   type = 'mor',
         >   primaryKey = 'id',
         >   preCombineField = 'ts'
         > );
Time taken: 0.556 seconds
spark-sql> show tables;
hudi_mor_tbl
Time taken: 0.055 seconds, Fetched 1 row(s)

有数据写入表后,才会产生 ro 和 rt 表:

spark-sql> insert into hudi_mor_tbl select 1, 'a1_1', 20, 1001;
Time taken: 12.141 seconds
spark-sql> show tables;
hudi_mor_tbl
hudi_mor_tbl_ro
hudi_mor_tbl_rt
Time taken: 0.033 seconds, Fetched 3 row(s)

而对于 cow 表不存在 ro 和 rt 表之分:

spark-sql> create table hudi_cow_pt_tbl (
         >   id bigint,
         >   name string,
         >   ts bigint,
         >   dt string,
         >   hh string
         > ) using hudi
         > tblproperties (
         >   type = 'cow',
         >   primaryKey = 'id',
         >   preCombineField = 'ts'
         >  )
         > partitioned by (dt, hh);
Time taken: 0.189 seconds
spark-sql> show tables;
hudi_cow_pt_tbl
hudi_mor_tbl
hudi_mor_tbl_ro
hudi_mor_tbl_rt
Time taken: 0.029 seconds, Fetched 4 row(s)

posted on 2023-05-16 16:29  岚天逸见  阅读(302)  评论(0编辑  收藏  举报

导航