I have a dataframe that has columns: [A, B, ... M] and a schema that only requires few of the columns from the dataframe:
StructType([StructField(A, StringType(), False),
StructField(C, StringType(), True),
StructField(K, StringType(), True)])
Since I do not own the schema, I do not have a list of all columns already available. Is there a way to safely and efficiently select columns as per the schema?