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
Update HiveDDLSuite.scala
  • Loading branch information
AngersZhuuuu committed Jan 21, 2022
commit 3d4adf9cc585faa08e8edb221a4fff4a33d66fe7
Original file line number Diff line number Diff line change
Expand Up @@ -2933,13 +2933,33 @@ class HiveDDLSuite
val e = intercept[SparkException] {
spark.sql(s"INSERT OVERWRITE LOCAL DIRECTORY '${path.getCanonicalPath}' " +
s"STORED AS PARQUET SELECT ID, if(1=1, 1, 0), abs(id), '^-' FROM v")
}
assert(e.getCause.getCause.getMessage.contains(
}.getCause.getCause.getMessage
assert(e.contains(
"field ended by ';': expected ';' but got 'IF' at line 2: optional int32 (IF"))
}
}
}

test("SPARK-36201: Add check for inner field of parquet/orc schema") {
withView("v") {
spark.range(1).createTempView("v")
withTempPath { path =>
val e = intercept[SparkException] {
spark.sql(
s"""
|INSERT OVERWRITE LOCAL DIRECTORY '${path.getCanonicalPath}'
|STORED AS PARQUET
|SELECT
|NAMED_STRUCT('ID', ID, 'IF(ID=1,ID,0)', IF(ID=1,ID,0), 'B', ABS(ID)) AS col1
|FROM v
""".stripMargin)
}.getCause.getCause.getMessage
assert(e.contains("expected at the position 19 of " +
"'struct<ID:bigint,IF(ID=1,ID,0):bigint,B:bigint>' but '(' is found."))
}
}
}

test("SPARK-34261: Avoid side effect if create exists temporary function") {
withUserDefinedFunction("f1" -> true) {
sql("CREATE TEMPORARY FUNCTION f1 AS 'org.apache.hadoop.hive.ql.udf.UDFUUID'")
Expand Down