From 34185337c9c6f073ce8f8cb0e1b7ea605861b6e8 Mon Sep 17 00:00:00 2001 From: Nate E TeBlunthuis Date: Sun, 5 Jul 2020 23:27:18 -0700 Subject: [PATCH 1/1] Secondary sort for the by_author dataset should be CreatedAt. --- comments_2_parquet.py | 2 +- submissions_2_parquet.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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") -- 2.39.5