维度 评分
题目难度 ⭐️⭐️⭐️⭐️
题目清晰度 ⭐️⭐️⭐️⭐️⭐️
业务常见度 ⭐️⭐️⭐️⭐️
三、SQL
1.增加一列排序列
增加一列order_date的日期,如果amount有值则order_date...执行SQL
select c_date,
user_id,
amount,
if(amount is not null, c_date, '1970-01-01...()函数开窗得到填充值
max_by() 函数是spark3.0.0之后支持的函数,max_by(x,y) 根据 y 的最大值返回与之关联的 x 的值。...我在最后增加了order by user_id, c_date 排序,以方便查看排序结果
执行SQL
select c_date,
user_id,
amount,...执行SQL
select c_date,
user_id,
amount,
coalesce(amount,
max_by(amount,order_date