'How can I resolve : org.apache.spark.sql.AnalysisException: Multiple streaming aggregations are not supported with streaming DataFrames/Datasets

py4j.protocol.Py4JJavaError: An error occurred while calling o170.start. : org.apache.spark.sql.AnalysisException: Multiple streaming aggregations are not supported with streaming DataFrames/Datasets;;

I am getting the above error for the following code

timebasedkpi=df \
    .withWatermark("timestamp","10 minutes") \
    .groupBy(window("timestamp","1 minute","1 minute"),"country").agg(sum("total_cost").alias("volume_of_sales"),count("invoice_no").alias("OPM"))

dataQuery=timebasedkpi \
    .writeStream \
    .outputMode("Complete") \
    .format("console") \
    .trigger(processingTime="5 seconds") \
    .start()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source