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
Update HiveDDLSuite.scala
  • Loading branch information
AngersZhuuuu committed Jan 20, 2022
commit 8a1dc9148817511553185d423f944d8ce21d42d5
Original file line number Diff line number Diff line change
Expand Up @@ -2926,44 +2926,6 @@ class HiveDDLSuite
}
}

test("SPARK-36201: Add check for inner field of parquet/orc schema") {
withView("v") {
spark.range(1).createTempView("v")
withTempPath { path =>
val e = intercept[AnalysisException] {
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Hive Serde fail for this case as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Hive Serde fail for this case as well?

Yea, updated

|FROM v
""".stripMargin)
}.getMessage
assert(e.contains("Column name \"IF(ID=1,ID,0)\" contains" +
" invalid character(s). Please use alias to rename it."))
}
}
}

test("SPARK-36312: ParquetWriteSupport should check inner field") {
Copy link
Contributor Author

@AngersZhuuuu AngersZhuuuu Jan 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No exception thrown by hive serde, seems hive serder won't check inner fields. So just remove this . cc @cloud-fan

withView("v") {
spark.range(1).createTempView("v")
withTempPath { path =>
val e = intercept[AnalysisException] {
spark.sql(
"""
|SELECT
|NAMED_STRUCT('ID', ID, 'IF(ID=1,ID,0)', IF(ID=1,ID,0), 'B', ABS(ID)) AS col1
|FROM v
|""".stripMargin).write.mode(SaveMode.Overwrite).parquet(path.toString)
}.getMessage
assert(e.contains("Column name \"IF(ID=1,ID,0)\" contains" +
" invalid character(s). Please use alias to rename it."))
}
}
}

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