Q1. Considering I have a dataframe df
and a schema myschema
, how do I proceed to write the dataframe into kafka topic in an avro format ?
Q2. Is there any optimized way if we do not consider udf
?
Most of the available solutions are for spark > 2.4 where they have inbuilt avro functions to use.
eventDF.select( encodeUDF(struct(eventDF.columns.map(column):_*)).alias("value") )
struct
andcolumn
was showing red in color, could you please help me in defining these select query – supernatural