How to add package com.databricks.spark.avro in spark?

0 votes

Hi, I am trying to read avro file stored on hdfs, but getting error. I tried to add package. How to read avro file in webconsole spark2-shell
code:

val df = sqlContext.read.format("com.databricks.spark.avro").load("hdfs://ip-20-0-21-161.ec2.internal:8020/user/edureka_315701/blogspot/category/part-m-00000.avro")
Jul 10 in Apache Spark by Karuna
19 views

1 answer to this question.

0 votes

Start spark shell using below line of command 

$ spark2-shell --packages com.databricks:spark-avro_2.11:4.0.0 

Now try using below line of code, change the path to exact path.

import com.databricks.spark.avro._

val df= spark.read.format("com.databricks.spark.avro").option("header","true").load("hdfs://nameservice1/user/edureka_315701/blogspot/category/part-m-00000.avro")  // Loading avro
answered Jul 10 by Jishnu

Related Questions In Apache Spark

0 votes
4 answers

How to change the spark Session configuration in Pyspark?

You can dynamically load properties. First create ...READ MORE

answered Dec 10, 2018 in Apache Spark by Vini
10,502 views
0 votes
1 answer

How to convert rdd object to dataframe in spark

SqlContext has a number of createDataFrame methods ...READ MORE

answered May 30, 2018 in Apache Spark by nitinrawat895
• 10,110 points
1,028 views
0 votes
6 answers
0 votes
1 answer
0 votes
0 answers
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,110 points
2,052 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,110 points
196 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
10,495 views
0 votes
1 answer

How to create RDD from parallelized collection in scala?

Hi, You can check this example in your ...READ MORE

answered Jul 3 in Apache Spark by Gitika
• 19,720 points
21 views
0 votes
1 answer

How to create RDD from an external file source in scala?

Hi, To create an RDD from external file ...READ MORE

answered Jul 3 in Apache Spark by Gitika
• 19,720 points
20 views