Question
search nothing about '__HIVE_DEFAULT_PARTITION__'
--1. create a table with hive3
create external table aaa
( id string comment ''
) partitioned by (data_dt );
--2. insert hive with dynamic partition
insert overwrite table partition(data_dt)
select id,data_dt from
( select 1 id,'2021' data_dt union all
select 2 id,'2022' data_dt union all
select 3 id,'' data_dt union all )t;
--3.check data
select id,data_dt,length(data_dt) len from aaa;
the result:
| id | data_dt | len |
| 1 | 2021 | 4 |
| 2 | 2022 | 4 |
| 3 | __HIVE_DEFAULT_PARTITION__ | 26 |
--4.wired results with length(partition )
select * from aaa where length(data_dt)=26 ; -- return no data WHY ?????😂
select * from (select *, length(data_dt) len from aaa )t where len=26 ; -- return no data WHY ?????🙀
select * from aaa where data_dt ='__HIVE_DEFAULT_PARTITION__' ; --return 1 record

