Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val df = Seq(("1","One"),("2","two")).toDF("key","value")
- df.printSchema()
- df.show(false)
- df.selectExpr("CAST(key AS STRING)", "CAST(value AS STRING)")
- .write
- .format("kafka")
- .option("kafka.bootstrap.servers", "127.0.0.1:9092")
- .option("topic", "testtopic")
- .save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement