我有一些event
数据被分组为sessions
。在某些情况下,我想删除这些会话中的连续重复事件。 bigquery
中有没有办法做到这一点?
例如
初始表格:
session eventType eventOrder
1 a 1
1 a 2
1 b 3
2 b 1
2 a 2
2 b 3
所需结果:
session eventType eventOrder
1 a 1
1 b 3
2 b 1
2 a 2
2 b 3
答案 0 :(得分:3)
您可以使用use Illuminate\Http\Request;
/**
* The user has been authenticated.
*
* @param \Illuminate\Http\Request $request
* @param mixed $user
* @return mixed
*/
protected function authenticated(Request $request, $user)
{
if ($user->isBasic()) {
$previous_session = $user->session_id;
if ($previous_session) {
$request->session()->getHandler()->destroy($previous_session);
}
$user->session_id = $requset->session()->getId();
$user->save();
// do these specific users need to be redirected to somewhere special?
return redirect()->route('home');
}
}
。想法是将当前事件类型与同一会话的上一个值进行比较,并消除匹配的记录:
lag()