提交 7dec4501 编写于 作者: wuyunfeng's avatar wuyunfeng

修改session_path计算逻辑

上级 e17e1ffe
......@@ -71,7 +71,7 @@ object MyConfigSession {
//从dw_fact_log_session表中筛选数据
final val SOURCE_SQL_PATH: String =
s"""
|select id log_session_id, session_id,user_id_int user_id,action_type,user_token,menu_code,action_code,position,label_value,label_class,
|select id log_session_id, session_id,user_id_int user_id,device_token,action_type,user_token,menu_code,action_code,position,label_value,label_class,
|app_version,device_type,created_time,date_time,module_class1,module_class2 from ${MyConfigSession.HIVE_TABLE1}
| where app_version >= '3.1.7'
| AND ((action_type ='ACTION_CLICK' and action_code != 'null' ) OR action_type ='ACTION_VIEW' )
......
......@@ -104,7 +104,9 @@ object SessionProcessPath {
rowList.append( Row(
StringUtils.getNotNullString(row.getAs[String]("log_session_id")),
StringUtils.getNotNullString(row.getAs[String]("session_id")),
row.getAs[Integer]("user_id"),action_type,
row.getAs[Integer]("user_id"),
StringUtils.getNotNullString(row.getAs[String]("device_token")),
action_type,
StringUtils.getNotNullString(row.getAs[String]("user_token")),
StringUtils.getNotNullString(row.getAs[String]("menu_code")),
StringUtils.getNotNullString(row.getAs[String]("action_code")),
......@@ -189,7 +191,7 @@ object SessionProcessPath {
//去掉refer字段中的NULL值
val coaleseDF: DataFrame = rowNumberDF.selectExpr(
"log_session_id","session_id", "user_id", "action_type", "user_token", "menu_code", "action_code", "position", "label_value","label_class",
"log_session_id","session_id", "user_id","device_token", "action_type", "user_token", "menu_code", "action_code", "position", "label_value","label_class",
"COALESCE(refer_menu_code,'') as refer_menu_code",
"COALESCE(refer_action_code,'') as refer_action_code",
"COALESCE(refer_position,'') as refer_position",
......@@ -220,7 +222,8 @@ object SessionProcessPath {
| select log_session_id, session_id,user_id,action_type,user_token,menu_code,action_code,position,label_value,label_class,
| refer_menu_code,refer_action_code,refer_position,refer_action_type,
| cast(refer_time_diff as int) as refer_time_diff,
| step_id,app_version,device_type,created_time,date_time, module_class1, module_class2
| step_id,app_version,device_type,created_time,date_time, module_class1, module_class2,
| case when user_id=0 then device_token else user_id end user_identity_id
| from result_view distribute by rand()
""".stripMargin
sparkSession.sql(loadDataSql)
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册