第3条语句执行查询,在Hive版本3.1.0中执行报错:Error: Error while processing statement: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask (state=08S01,code=2)
,在Hive版本3.1.2中执行成功。
- 新建表
CREATE TABLE user_test(
create_time timestamp,
user_id string,
weight int
) STORED AS PARQUET;
- 插入语句
insert into user_test values("2023-10-31 22:59:55.0", "john", 80);
- 查询(select部分有percentile_approx,同时where部分有unix_timestamp)
select percentile_approx(weight, array(0.01, 0.25, 0.5, 0.75, 0.99), 100)
from user_test
where unix_timestamp(create_time) > 0;