user5463155
user5463155

Reputation: 91

error: not found: value from_avro (Databricks)

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

Answers (2)

swapnil shashank
swapnil shashank

Reputation: 997

enter image description hereimport org.apache.spark.sql.avro.functions._

Upvotes: -1

ableHercules
ableHercules

Reputation: 660

add this import statement import org.apache.spark.sql.avro.functions._

Upvotes: 0

Related Questions