Reputation: 91
Im trying to stream Avro data from Kafka and trying to use from_Avro by following https://docs.databricks.com/spark/latest/structured-streaming/avro-dataframe.html#avro-dataframe
Getting error : not found: value from_avro
val df = spark
.readStream
.format("kafka")
.option("kafka.bootstrap.servers", servers)
.option("subscribe", "t")
.load()
.select(
from_avro($"key", SchemaBuilder.builder().stringType()).as("key"),
from_avro($"value", SchemaBuilder.builder().intType()).as("value"))
using dependencies : bijection-avro_2.12-0.9.6.jar,spark-avro_2.11-4.0.0.jar
Upvotes: 4
Views: 1031
Reputation: 660
add this import statement import org.apache.spark.sql.avro.functions._
Upvotes: 0