== Parsed Logical Plan == GlobalLimit 11 +- LocalLimit 11 +- Project [cast(userId#0L as string) AS userId#152, cast(movieId#1L as string) AS movieId#153, cast(rating#2 as string) AS rating#154, cast(timestamp_str#3L as string) AS timestamp_str#155, cast(date#39 as string) AS date#156, cast(month#120 as string) AS month#157, cast(year#127 as string) AS year#158, cast(time_of_rating#135 as string) AS time_of_rating#159] +- Project [userId#0L, movieId#1L, rating#2, timestamp_str#3L, date#39, month#120, year#127, CASE WHEN ((month#120 >= 1) AND (month#120 <= 6)) THEN Early Year ELSE Late Year END AS time_of_rating#135] +- Project [userId#0L, movieId#1L, rating#2, timestamp_str#3L, date#39, month#120, year(cast(date#39 as date)) AS year#127] +- Project [userId#0L, movieId#1L, rating#2, timestamp_str#3L, date#39, month(cast(date#39 as date)) AS month#120] +- Sort [date#39 ASC NULLS FIRST], true +- Project [userId#0L, movieId#1L, rating#2, timestamp_str#3L, from_unixtime(timestamp_str#3L, yyyy-MM-dd, Some(GMT)) AS date#39] +- LogicalRDD [userId#0L, movieId#1L, rating#2, timestamp_str#3L], false == Analyzed Logical Plan == userId: string, movieId: string, rating: string, timestamp_str: string, date: string, month: string, year: string, time_of_rating: string GlobalLimit 11 +- LocalLimit 11 +- Project [cast(userId#0L as string) AS userId#152, cast(movieId#1L as string) AS movieId#153, cast(rating#2 as string) AS rating#154, cast(timestamp_str#3L as string) AS timestamp_str#155, cast(date#39 as string) AS date#156, cast(month#120 as string) AS month#157, cast(year#127 as string) AS year#158, cast(time_of_rating#135 as string) AS time_of_rating#159] +- Project [userId#0L, movieId#1L, rating#2, timestamp_str#3L, date#39, month#120, year#127, CASE WHEN ((month#120 >= 1) AND (month#120 <= 6)) THEN Early Year ELSE Late Year END AS time_of_rating#135] +- Project [userId#0L, movieId#1L, rating#2, timestamp_str#3L, date#39, month#120, year(cast(date#39 as date)) AS year#127] +- Project [userId#0L, movieId#1L, rating#2, timestamp_str#3L, date#39, month(cast(date#39 as date)) AS month#120] +- Sort [date#39 ASC NULLS FIRST], true +- Project [userId#0L, movieId#1L, rating#2, timestamp_str#3L, from_unixtime(timestamp_str#3L, yyyy-MM-dd, Some(GMT)) AS date#39] +- LogicalRDD [userId#0L, movieId#1L, rating#2, timestamp_str#3L], false == Optimized Logical Plan == GlobalLimit 11 +- LocalLimit 11 +- Project [cast(userId#0L as string) AS userId#152, cast(movieId#1L as string) AS movieId#153, cast(rating#2 as string) AS rating#154, cast(timestamp_str#3L as string) AS timestamp_str#155, date#39, cast(month(cast(date#39 as date)) as string) AS month#157, cast(year(cast(date#39 as date)) as string) AS year#158, CASE WHEN ((month(cast(date#39 as date)) >= 1) AND (month(cast(date#39 as date)) <= 6)) THEN Early Year ELSE Late Year END AS time_of_rating#159] +- Sort [date#39 ASC NULLS FIRST], true +- Project [userId#0L, movieId#1L, rating#2, timestamp_str#3L, from_unixtime(timestamp_str#3L, yyyy-MM-dd, Some(GMT)) AS date#39] +- LogicalRDD [userId#0L, movieId#1L, rating#2, timestamp_str#3L], false == Physical Plan == TakeOrderedAndProject(limit=11, orderBy=[date#39 ASC NULLS FIRST], output=[userId#152,movieId#153,rating#154,timestamp_str#155,date#39,month#157,year#158,time_of_rating#159]) +- *(1) Project [userId#0L, movieId#1L, rating#2, timestamp_str#3L, from_unixtime(timestamp_str#3L, yyyy-MM-dd, Some(GMT)) AS date#39] +- *(1) Scan ExistingRDD[userId#0L,movieId#1L,rating#2,timestamp_str#3L]