This commit is contained in:
guange 2019-01-17 23:14:26 +08:00
parent 4a8a5288f4
commit d6afa62c5f
1 changed files with 4 additions and 4 deletions

View File

@ -41,16 +41,16 @@ if __name__ == "__main__":
.enableHiveSupport() \ .enableHiveSupport() \
.getOrCreate() .getOrCreate()
df = sqlContext.sql("select count(*) as N from jd_comment") df = spark.sql("select count(*) as N from jd_comment")
jd_comment_count = df.rdd.collect()[0]["N"] jd_comment_count = df.rdd.collect()[0]["N"]
df = sqlContext.sql("select count(*) as N from jd_comment where created_at like '"+today()+"%'") df = spark.sql("select count(*) as N from jd_comment where created_at like '"+today()+"%'")
jd_comment_today_count = df.rdd.collect()[0]["N"] jd_comment_today_count = df.rdd.collect()[0]["N"]
df = sqlContext.sql("select count(*) as N from jd") df = spark.sql("select count(*) as N from jd")
jd_count = df.rdd.collect()[0]["N"] jd_count = df.rdd.collect()[0]["N"]
df = sqlContext.sql("select count(*) as N from jd where created_at like '"+today()+"%'") df = spark.sql("select count(*) as N from jd where created_at like '"+today()+"%'")
jd_today_count = df.rdd.collect()[0]["N"] jd_today_count = df.rdd.collect()[0]["N"]
total_count = jd_comment_count + jd_count total_count = jd_comment_count + jd_count