Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. val df = Seq(("1","One"),("2","two")).toDF("key","value")
  2. df.printSchema()
  3. df.show(false)
  4. df.selectExpr("CAST(key AS STRING)", "CAST(value AS STRING)")
  5. .write
  6. .format("kafka")
  7. .option("kafka.bootstrap.servers", "127.0.0.1:9092")
  8. .option("topic", "testtopic")
  9. .save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement