1+ set hive .fetch .task .conversion = none;
2+ set hive .explain .user= false;
3+
4+ create external table tbl_ice_pp_key(a int , b string) stored by iceberg;
5+
6+ insert into tbl_ice_pp_key values (1 , ' one' ), (2 , ' two' );
7+ alter table tbl_ice_pp_key create tag s1;
8+
9+ insert into tbl_ice_pp_key values
10+ (3 , ' three' ), (4 , ' four' ), (5 , ' five' ),
11+ (6 , ' six' ), (7 , ' seven' ),(8 , ' eight' ),
12+ (9 , ' nine' ), (10 , ' ten' );
13+
14+ explain select count (* ) from tbl_ice_pp_key;
15+ select count (* ) from tbl_ice_pp_key;
16+
17+ explain select count (* ) from tbl_ice_pp_key for system_version as of ' s1' ;
18+ select count (* ) from tbl_ice_pp_key for system_version as of ' s1' ;
19+
20+ explain
21+ select cur .cnt as cur_cnt, snap .cnt as snap_cnt
22+ from (
23+ select count (* ) as cnt from tbl_ice_pp_key
24+ ) cur
25+ cross join (
26+ select count (* ) as cnt from tbl_ice_pp_key for system_version as of ' s1'
27+ ) snap;
28+
29+ select cur .cnt as cur_cnt, snap .cnt as snap_cnt
30+ from (
31+ select count (* ) as cnt from tbl_ice_pp_key
32+ ) cur
33+ cross join (
34+ select count (* ) as cnt from tbl_ice_pp_key for system_version as of ' s1'
35+ ) snap;
36+
37+ -- with a partition predicate
38+ explain
39+ select ' current' as ver, count (* ) as cnt from tbl_ice_pp_key where a > 0
40+ union all
41+ select ' asof_s1' as ver, count (* ) as cnt from tbl_ice_pp_key for system_version as of ' s1'
42+ where a > 0 ;
43+
44+ select ' current' as ver, count (* ) as cnt from tbl_ice_pp_key where a > 0
45+ union all
46+ select ' asof_s1' as ver, count (* ) as cnt from tbl_ice_pp_key for system_version as of ' s1'
47+ where a > 0 ;
48+
49+ drop table tbl_ice_pp_key;
0 commit comments