spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "M. Dale" <>
Subject Re: spark sql writing in avro
Date Fri, 13 Mar 2015 01:44:28 GMT
Short answer: if you downloaded spark-avro from the
repo you might be using an old version (pre-November 14, 2014) -
see timestamps at
Lots of changes at since then.

Databricks, thank you for sharing the Avro code!!!

Could you please push out the latest version or update the version
number and republish to (I have no idea how jars get
there). Or is there a different repository that users should point to for
this artifact?

Workaround: Download from and build
with latest functionality (still version 0.1) and add to your local Maven
or Ivy repo.

Long version:
I used a default Maven build and declared my dependency on:


Maven downloaded the 0.1 version from 
and included it in my app code jar.

 From spark-shell:

import com.databricks.spark.avro._
import org.apache.spark.sql.SQLContext
val sqlContext = new SQLContext(sc)

# This schema includes LONG for time in millis 
val recordsSchema = sqlContext.avroFile("/opt/rpm1/enron/enron-tiny.avro")
java.lang.RuntimeException: Unsupported type LONG

However, checking out the spark-avro code from its GitHub repo and adding
a test case against the MailRecord avro everything ran fine.

So I built the databricks spark-avro locally on my box and then put it in my
local Maven repo - everything worked from spark-shell when adding that jar
as dependency.

Hope this helps for the "save" case as well. On the pre-14NOV version, 
  // TODO: Implement me.
   implicit class AvroSchemaRDD(schemaRDD: SchemaRDD) {
     def saveAsAvroFile(path: String): Unit = ???


On 03/12/2015 07:05 PM, kpeng1 wrote:
> Hi All,
> I am current trying to write out a scheme RDD to avro.  I noticed that there
> is a databricks spark-avro library and I have included that in my
> dependencies, but it looks like I am not able to access the AvroSaver
> object.  On compilation of the job I get this:
> error: not found: value AvroSaver
> [ERROR], args(4))
> I also tried calling saveAsAvro on the resultRDD(the actual rdd with the
> results) and that passes compilation, but when I run the code I get an error
> that says the saveAsAvro is not implemented.  I am using version 0.1 of
> spark-avro_2.10
> --
> View this message in context:
> Sent from the Apache Spark User List mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message