{"action":"created","issue":{"url":"https://api.github.com/repos/databricks/spark-redshift/issues/314","repository_url":"https://api.github.com/repos/databricks/spark-redshift","labels_url":"https://api.github.com/repos/databricks/spark-redshift/issues/314/labels{/name}","comments_url":"https://api.github.com/repos/databricks/spark-redshift/issues/314/comments","events_url":"https://api.github.com/repos/databricks/spark-redshift/issues/314/events","html_url":"https://github.com/databricks/spark-redshift/issues/314","id":197050170,"number":314,"title":"Saving to Redshift error","user":{"login":"owb964","id":24705582,"avatar_url":"https://avatars.githubusercontent.com/u/24705582?v=3","gravatar_id":"","url":"https://api.github.com/users/owb964","html_url":"https://github.com/owb964","followers_url":"https://api.github.com/users/owb964/followers","following_url":"https://api.github.com/users/owb964/following{/other_user}","gists_url":"https://api.github.com/users/owb964/gists{/gist_id}","starred_url":"https://api.github.com/users/owb964/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owb964/subscriptions","organizations_url":"https://api.github.com/users/owb964/orgs","repos_url":"https://api.github.com/users/owb964/repos","events_url":"https://api.github.com/users/owb964/events{/privacy}","received_events_url":"https://api.github.com/users/owb964/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-21T22:36:58Z","updated_at":"2016-12-21T22:53:14Z","closed_at":null,"body":"The code below is meant to 1) load an existing table from Redshift called test123 into my S3 directory, 2) register it as a temporary table, and then 3) save it back to Redshift to a new table called test456:\r\n\r\n```\r\nval salesDF = hiveContext.read\r\n    .format(\"com.databricks.spark.redshift\")\r\n    .option(\"url\", jdbcUrl)\r\n    .option(\"tempdir\", tempS3Dir)\r\n    .option(\"dbtable\", \"public.test123\")\r\n    .load()\r\n\r\nsalesDF.registerTempTable(\"myevent\")\r\n\r\nhiveContext.sql(\"SELECT * FROM myevent\")\r\n    .write.format(\"com.databricks.spark.redshift\")\r\n    .option(\"url\", jdbcUrl)\r\n    .option(\"tempdir\", tempS3Dir)\r\n    .option(\"dbtable\", \"public.test456\")\r\n    .mode(SaveMode.Overwrite)\r\n    .save()\r\n```\r\n\r\nNote that I've already defined jdbcUrl and tempS3Dir.\r\n\r\nThe first two parts (the `load` and `registerTempTable`) seem to be working fine. I've gone into the specified S3 directory to verify that the contents of the test123 table were loaded. However, there's an error with the last part, saving to Redshift. This is the error that was thrown:\r\n\r\n> java.lang.IncompatibleClassChangeError: class com.databricks.spark.avro.AvroRelation has interface org.apache.spark.sql.sources.TableScan as super class\r\n\r\nFrom previous posts, this error seems to suggests that I'm using the incorrect version of spark-avro. However, I'm using Scala 2.11, Spark 1.6.1, and the spark-avro_2.11-2.0.0.jar, which should be correct. (I've also tried spark-avro_2.11-2.0.1.jar and spark-avro_2.10-2.0.0.jar in case.) Any suggestions or ideas?"},"comment":{"url":"https://api.github.com/repos/databricks/spark-redshift/issues/comments/268665174","html_url":"https://github.com/databricks/spark-redshift/issues/314#issuecomment-268665174","issue_url":"https://api.github.com/repos/databricks/spark-redshift/issues/314","id":268665174,"user":{"login":"owb964","id":24705582,"avatar_url":"https://avatars.githubusercontent.com/u/24705582?v=3","gravatar_id":"","url":"https://api.github.com/users/owb964","html_url":"https://github.com/owb964","followers_url":"https://api.github.com/users/owb964/followers","following_url":"https://api.github.com/users/owb964/following{/other_user}","gists_url":"https://api.github.com/users/owb964/gists{/gist_id}","starred_url":"https://api.github.com/users/owb964/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owb964/subscriptions","organizations_url":"https://api.github.com/users/owb964/orgs","repos_url":"https://api.github.com/users/owb964/repos","events_url":"https://api.github.com/users/owb964/events{/privacy}","received_events_url":"https://api.github.com/users/owb964/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T22:53:14Z","updated_at":"2016-12-21T22:53:14Z","body":"I'm using the spark-redshift_2.11-1.1.0.jar"}}
{"actor":{"display_login":"owb964"}}