Reading Avro into spark using spark-avro -
i'm not being able read spark files using spark-avro library. here steps took:
- got jar from: http://mvnrepository.com/artifact/com.databricks/spark-avro_2.10/0.1
- invoked spark-shell using
spark-shell --jars avro/spark-avro_2.10-0.1.jar
executed commands given in git readme:
import com.databricks.spark.avro._ import org.apache.spark.sql.sqlcontext val sqlcontext = new sqlcontext(sc) val episodes = sqlcontext.avrofile("episodes.avro")
the action sqlcontext.avrofile("episodes.avro") fails following error:
scala> val episodes = sqlcontext.avrofile("episodes.avro") java.lang.incompatibleclasschangeerror: class com.databricks.spark.avro.avrorelation has interface org.apache.spark.sql.sources.tablescan super class @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:760) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclassloader.java:467) @ java.net.urlclassloader.access$100(urlclassloader.java:73) @ java.net.urlclassloader$1.run(urlclassloader.java:368)
my bad. readme says:
versions spark changed how reads / writes data in 1.4, please use correct version of dedicated spark version 1.3 -> 1.0.0 1.4+ -> 1.1.0-snapshot
i used spark:1.3.1
, spark-avro: 1.1.0
. when used spark-avro: 1.0.0
, worked.
Comments
Post a Comment