Given links to production-level PySpark code (150+ lines, pre-processing and processing), write the schema of the output file from each code and give an example of the schema and data after the code runs.
Asked in the Round 3 stage. For this coding version, represent the pipeline as ordered transformation objects and process rows in memory. Return the final schema and resulting rows.
Function: derive_output(source_schema, rows, operations)
source_schema is a list of {name, type} objects. Supported operations are select, withColumn using multiply, filter using eq or gt, and groupBy using sum or count. Preserve column order.
def derive_output(source_schema, rows, operations):