From: Nate E TeBlunthuis Date: Mon, 6 Jul 2020 06:27:18 +0000 (-0700) Subject: Secondary sort for the by_author dataset should be CreatedAt. X-Git-Url: https://code.communitydata.science/cdsc_reddit.git/commitdiff_plain/34185337c9c6f073ce8f8cb0e1b7ea605861b6e8?hp=67857a3b05b9bf7db684b5d2ab34802fa02ab08f Secondary sort for the by_author dataset should be CreatedAt. --- diff --git a/comments_2_parquet.py b/comments_2_parquet.py index cff1634..bd853f7 100755 --- a/comments_2_parquet.py +++ b/comments_2_parquet.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import pyspark -nfrom pyspark.sql import functions as f +from pyspark.sql import functions as f from pyspark.sql.types import * from pyspark import SparkConf, SparkContext from pyspark.sql import SparkSession, SQLContext diff --git a/submissions_2_parquet.py b/submissions_2_parquet.py index 6e46970..0142210 100755 --- a/submissions_2_parquet.py +++ b/submissions_2_parquet.py @@ -201,7 +201,7 @@ df2.write.parquet("/gscratch/comdata/output/reddit_submissions_by_subreddit.parq # we also want to have parquet files sorted by author then reddit. -df3 = df.sort(["author","subreddit","id","Year","Month","Day"],ascending=True) +df3 = df.sort(["author","CreatedAt","subreddit","id","Year","Month","Day"],ascending=True) df3.write.parquet("/gscratch/comdata/output/reddit_submissions_by_author.parquet", partitionBy=["Year",'Month'], mode='overwrite') os.remove("/gscratch/comdata/output/reddit_submissions.parquet_temp")