Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
itholic committed Oct 15, 2024
1 parent 07ef019 commit 046b63a
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,17 @@ class CsvExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper with P
test("unsupported mode") {
val csvData = "---"
val schema = StructType(StructField("a", DoubleType) :: Nil)
val exception = intercept[TestFailedException] {
checkEvaluation(
CsvToStructs(schema, Map("mode" -> DropMalformedMode.name), Literal(csvData), UTC_OPT),
InternalRow(null))
}.getCause
assert(exception.getMessage.contains("from_csv() doesn't support the DROPMALFORMED mode"))

checkError(
exception = intercept[TestFailedException] {
checkEvaluation(
CsvToStructs(schema, Map("mode" -> DropMalformedMode.name), Literal(csvData), UTC_OPT),
InternalRow(null))
}.getCause.asInstanceOf[AnalysisException],
condition = "PARSE_MODE_UNSUPPORTED",
parameters = Map(
"funcName" -> "from_csv",
"mode" -> "DROPMALFORMED"))
}

test("infer schema of CSV strings") {
Expand Down

0 comments on commit 046b63a

Please sign in to comment.