Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/master' into max-length
  • Loading branch information
JoshRosen committed Aug 26, 2015
commit 4c7919d61da9e5fcf624d7d58b36033cccfba306
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,27 @@ class RedshiftIntegrationSuite
}
}

test("informative error message when saving a table with string that is longer than max length") {
val tableName = s"error_message_when_string_too_long_$randomSuffix"
try {
val df = sqlContext.createDataFrame(sc.parallelize(Seq(Row("a" * 512))),
StructType(StructField("A", StringType) :: Nil))
val e = intercept[SQLException] {
df.write
.format("com.databricks.spark.redshift")
.option("url", jdbcUrl)
.option("dbtable", tableName)
.option("tempdir", tempDir)
.mode(SaveMode.ErrorIfExists)
.save()
}
assert(e.getMessage.contains("while loading data into Redshift"))
} finally {
conn.prepareStatement(s"drop table if exists $tableName").executeUpdate()
conn.commit()
}
}

test("SaveMode.Overwrite with non-existent table") {
val tableName = s"overwrite_non_existent_table$randomSuffix"
try {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.