From 7393595ae89530e18e8b51ee9a08b3f34aa0ff22 Mon Sep 17 00:00:00 2001 From: Joanne Date: Fri, 27 May 2016 15:42:05 +0900 Subject: [PATCH] error in sql --- app/com/piki_ds/preprocess/CidValidation.scala | 2 +- app/com/piki_ds/ver1/EditorScore.scala | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/com/piki_ds/preprocess/CidValidation.scala b/app/com/piki_ds/preprocess/CidValidation.scala index d16c32c..b131b96 100644 --- a/app/com/piki_ds/preprocess/CidValidation.scala +++ b/app/com/piki_ds/preprocess/CidValidation.scala @@ -31,7 +31,7 @@ object CidValidation { def getCidByStatus(sQLContext: SQLContext, filterStatus:Array[String]) = { import org.apache.spark.sql.functions._ - val whereStr = s"udate is not null and id is not null and title is not null and" + + val whereStr = s"udate is not null and contents_id is not null and title is not null and" + s" contents_type in ('ALBUM', 'ALBUM.A', 'CHST', 'CHST.A','TOON','TOON.A') and " + s"status in (${filterStatus.map(x=>s"'$x'").mkString(",")})" val mgc = getDBDump(sQLContext,"MG_CONTENTS").where(whereStr) diff --git a/app/com/piki_ds/ver1/EditorScore.scala b/app/com/piki_ds/ver1/EditorScore.scala index 5a66c38..c4580c8 100644 --- a/app/com/piki_ds/ver1/EditorScore.scala +++ b/app/com/piki_ds/ver1/EditorScore.scala @@ -1,13 +1,12 @@ package com.piki_ds.ver1 -import org.apache.hadoop.fs.{Path, FileStatus, FileSystem} -import org.jblas.MatrixFunctions - import org.apache.spark.rdd.RDD +import org.apache.hadoop.fs.{Path, FileStatus, FileSystem} import org.apache.spark.sql.SQLContext import org.apache.spark.{SparkConf, SparkContext} +import org.jblas.MatrixFunctions -import com.piki_ds.utils.DateTimeEtc.intoYesterdayMN +import com.piki_ds.utils.DateTimeEtc.getDateKey import com.piki_ds.utils.GetTextFile.getDashTable import com.piki_ds.utils.SqlContextConf.readPartialTable import com.piki_ds.utils.TempScoreSaveLoad @@ -40,7 +39,6 @@ object EditorScore { } def followGetter(sQLContext: SQLContext, dateKey:String) = { - val fromExisting = sQLContext.read.format("json").load(recentlyUpdatedPath("/preprocess/followInfo",true,fs).getPath.toString) val fromUpdated = getDashTable(sQLContext, "EDITOR_FOLLOW", dateKey) val unionFrom = fromExisting.unionAll(fromUpdated) @@ -92,10 +90,9 @@ object EditorScore { } def main(args:Array[String]) { - //현재시점 고정해놓기 [계산시점]Long = 1435261946000 val nowTS: Long = System.currentTimeMillis - val yesterdayTuple = intoYesterdayMN(nowTS) - val dateKey = yesterdayTuple._2.replaceAll("[^0-9]", "").take(8) + val dateKey = getDateKey(nowTS) + //에디터 인기 점수 구하기 val fromDB = editorDB(sqlContext, dateKey) -- 1.8.5.2