hive面试题之 统计最近七天内连续登陆3天的用户数量

原始数据:

val df = Seq(
  ("2020-09-21",1),
  ("2020-09-20",1),
  ("2020-09-19",1),
  ("2020-09-17",1),
  ("2020-09-16",1),
  ("2020-09-15",1),
  ("2020-09-20",2),
  ("2020-09-19",2),
  ("2020-09-20",3),
  ("2020-09-19",3),
  ("2020-09-18",3)
).toDF("dt", "uid")
df.createTempView("tmp")

答案详见:https://blog.csdn.net/forrest420/article/details/108715396

原文地址:https://www.cnblogs.com/sabertobih/p/14171384.html