From d6afa62c5f002eba451cf23e422756d7f10b55df Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Thu, 17 Jan 2019 23:14:26 +0800 Subject: [PATCH] . --- chapter3/spark.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chapter3/spark.py b/chapter3/spark.py index ced82ea..31b4c0b 100644 --- a/chapter3/spark.py +++ b/chapter3/spark.py @@ -41,16 +41,16 @@ if __name__ == "__main__": .enableHiveSupport() \ .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"] - 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"] - 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"] - 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"] total_count = jd_comment_count + jd_count