I'm developing an API, and one of the functions should receive a spark data frame, and use the schema in the spark data frame to perform actions.
As there is no guarantee that the user will create the data frame and set the infer Schema to True, my function will receive a data frame that has no inferred schema, so I would like to throw an error if that occurs.
Can I check whether the data frame has been created with inferSchema=True? Or Is there a pyspark function that infer the schema after the data frame has been created?
Since inferSchema=False all the columns are StringType, I can't reject the data frame based on this, since this is a possible schema for some data frame.