Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ASKRAJPUT5 authored Sep 25, 2019
0 parents commit 3d56c4e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name := "avro5"

version := "0.1"

scalaVersion := "2.11.8"

libraryDependencies += "com.databricks" %% "spark-avro" % "4.0.0"

libraryDependencies += "org.scala-lang" % "scala-library" % "2.11.8"

libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.4.4"

libraryDependencies += "org.apache.spark" %% "spark-avro" % "2.4.4"
10 changes: 10 additions & 0 deletions src/avro/ask.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": 1,
"name": "ASK",

"id": 5,
"name": "Amulya Singh Rajput",

"id":6,
"name":"ASK ROX"
}
23 changes: 23 additions & 0 deletions src/main/scala/avro5.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import org.apache.spark.sql.SparkSession

object avro5 {
def main(args: Array[String]) = {
val spark = SparkSession.builder()
.master("local")
.appName("Making Avro File")
.getOrCreate()


val df = spark.createDataFrame(Seq(
(2012, 8, "Batman", 9.8),
(2012, 8, "Hero", 8.7),
(2012, 7, "Robot", 5.5),
(2011, 7, "Git", 2.0))
).toDF("year", "month", "title", "rating")


import com.databricks.spark.avro._
df.write.format("avro").save("/home/amulya/Desktop/ask5.avro")
}
}
// org.apache.spark.sql.AnalysisException: Failed to find data source: avro. Avro is built-in but external data source module since Spark 2.4. Please deploy the application as per the deployment section of "Apache Avro Data Source Guide".;

0 comments on commit 3d56c4e

Please sign in to comment.