Member since
07-09-2025
2
Posts
0
Kudos Received
0
Solutions
07-24-2025
05:01 AM
SELECT * FROM your_table WHERE data_dt = '__HIVE_DEFAULT_PARTITION__'; ok thank's for your reply ,i understand this example But my question is, in my Third SQL statement, using length() function in the select statement is effective and the result is 26, while in the first and second SQL , why can't this record be filtered by length in the where statement when I use the length function on the partition key? Thank You
... View more
07-09-2025
02:35 AM
--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
... View more
Labels:
- Labels:
-
Apache Hive