Giter VIP home page Giter VIP logo

Comments (9)

hafizmujadid avatar hafizmujadid commented on June 24, 2024 1

i am using spark-avro latest version but i am facing same issue. Spark-redshift is really pissing me off :(

from spark-redshift.

JoshRosen avatar JoshRosen commented on June 24, 2024

I suspect that this is caused by an older version of Avro being used. Over at the spark-avro repo, databricks/spark-avro#91 discusses how this problem can occur on EMR, where the older version of Avro that's provided by the EMR environment takes precedence. If you happen to be running on EMR, check out the bottom of that thread for a workaround / fix.

from spark-redshift.

JoshRosen avatar JoshRosen commented on June 24, 2024

If you read the spark-avro issue that I linked upthread, you'll see that the problem is due to the versions of the avro-mapred library that is provided by your runtime environment, which is independent of the spark-avro version that you're using. In order to debug this issue, you'll need to figure out where avro-mapred is coming from and see which version is being used.

If it was me, I'd use Class.forName and the steps described in https://stackoverflow.com/questions/1983839/determine-which-jar-file-a-class-is-from to figure out which JARs org.apache.avro.mapreduce.AvroKeyRecordWriter and org.apache.avro.generic.GenericData are being loaded from; once you know where the dependencies are coming from, we should be able to figure out how to ensure that a newer version of Avro gets used.

from spark-redshift.

hafizmujadid avatar hafizmujadid commented on June 24, 2024

thanks Josh :) i will try your solution

On Tue, Dec 1, 2015 at 12:54 AM, Josh Rosen [email protected]
wrote:

If you read the spark-avro issue that I linked upthread, you'll see that
the problem is due to the versions of the avro-mapred library that is
provided by your runtime environment, which is independent of the
spark-avro version that you're using. In order to debug this issue,
you'll need to figure out where avro-mapred is coming from and see which
version is being used.

If it was me, I'd use Class.forName and the steps described in
https://stackoverflow.com/questions/1983839/determine-which-jar-file-a-class-is-from
to figure out which JARs org.apache.avro.mapreduce.AvroKeyRecordWriter
and org.apache.avro.generic.GenericData are being loaded from; once you
know where the dependencies are coming from, we should be able to figure
out how to ensure that a newer version of Avro gets used.


Reply to this email directly or view it on GitHub
#129 (comment)
.

Regards: HAFIZ MUJADID

from spark-redshift.

JoshRosen avatar JoshRosen commented on June 24, 2024

I'm going to close this issue as 'not a spark-redshift issue', since I don't think that there's anything actionable here from our side. Feel free to update this thread if you'd still like some help in debugging your environment issue.

from spark-redshift.

WillSidebottom avatar WillSidebottom commented on June 24, 2024

@hafizmujadid Did you ever get this issue fixed? I'm running into the same problem, just trying to save a simple DataFrame into aws Redshift.
-Thanks!

from spark-redshift.

hafizmujadid avatar hafizmujadid commented on June 24, 2024

No, I could not get this issue fixed and left the effort to use spark_redshift

from spark-redshift.

WillSidebottom avatar WillSidebottom commented on June 24, 2024

OK, are you still writing data to Redshift from spark? If so, how are you doing it?
Thanks again!

from spark-redshift.

hafizmujadid avatar hafizmujadid commented on June 24, 2024

There are multiple options to do so.

  1. you can use same approach as Spark-RedShift and save your data from in
    S3 bucket and then run copy command using redshift jdbc driver.

  2. Use SaveAsHadoopDataSet as in following code

    val dbUrl = "jdbc:postgresql://" + endpoint + ":" + port + "/" +
    

    database + "?user=" + username + "&password=" + password
    val records = df.map(row => (TableRow(row.toString, columnTypes),
    null))
    val jobConf = new JobConf()
    DBConfiguration.configureDB(jobConf, "org.postgresql.Driver", dbUrl,
    username, password)
    DBOutputFormat.setOutput(jobConf, table, columns: _*)
    records.saveAsHadoopDataset(jobConf)

On Mon, May 23, 2016 at 12:46 AM, WillSidebottom [email protected]
wrote:

OK, are you still writing data to Redshift from spark? If so, how are you
doing it?
Thanks again!


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#129 (comment)

Regards: HAFIZ MUJADID

from spark-redshift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.