[HUDI-4186] Support Hudi with Spark 3.3.0 (#5943)
Co-authored-by: Shawn Chang <yxchang@amazon.com>
This commit is contained in:
@@ -139,9 +139,8 @@ class HoodieSparkSqlTestBase extends FunSuite with BeforeAndAfterAll {
|
||||
try {
|
||||
spark.sql(sql)
|
||||
} catch {
|
||||
case e: Throwable =>
|
||||
assertResult(true)(e.getMessage.contains(errorMsg))
|
||||
hasException = true
|
||||
case e: Throwable if e.getMessage.contains(errorMsg) => hasException = true
|
||||
case f: Throwable => fail("Exception should contain: " + errorMsg + ", error message: " + f.getMessage, f)
|
||||
}
|
||||
assertResult(true)(hasException)
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.apache.spark.sql.hudi
|
||||
|
||||
import org.apache.hudi.DataSourceWriteOptions._
|
||||
import org.apache.hudi.HoodieSparkUtils
|
||||
import org.apache.hudi.common.util.PartitionPathEncodeUtils
|
||||
import org.apache.hudi.config.HoodieWriteConfig
|
||||
import org.apache.hudi.keygen.{ComplexKeyGenerator, SimpleKeyGenerator}
|
||||
@@ -210,8 +211,14 @@ class TestAlterTableDropPartition extends HoodieSparkSqlTestBase {
|
||||
spark.sql(s"""insert into $tableName values (1, "z3", "v1", "2021-10-01"), (2, "l4", "v1", "2021-10-02")""")
|
||||
|
||||
// specify duplicate partition columns
|
||||
checkExceptionContain(s"alter table $tableName drop partition (dt='2021-10-01', dt='2021-10-02')")(
|
||||
"Found duplicate keys 'dt'")
|
||||
if (HoodieSparkUtils.gteqSpark3_3) {
|
||||
checkExceptionContain(s"alter table $tableName drop partition (dt='2021-10-01', dt='2021-10-02')")(
|
||||
"Found duplicate keys `dt`")
|
||||
} else {
|
||||
checkExceptionContain(s"alter table $tableName drop partition (dt='2021-10-01', dt='2021-10-02')")(
|
||||
"Found duplicate keys 'dt'")
|
||||
}
|
||||
|
||||
|
||||
// drop 2021-10-01 partition
|
||||
spark.sql(s"alter table $tableName drop partition (dt='2021-10-01')")
|
||||
|
||||
@@ -31,6 +31,7 @@ class TestNestedSchemaPruningOptimization extends HoodieSparkSqlTestBase with Sp
|
||||
val explainCommand = sparkAdapter.getCatalystPlanUtils.createExplainCommand(plan, extended = true)
|
||||
executePlan(explainCommand)
|
||||
.executeCollect()
|
||||
.map(_.getString(0))
|
||||
.mkString("\n")
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,11 @@ class TestCallCommandParser extends HoodieSparkSqlTestBase {
|
||||
}
|
||||
|
||||
test("Test Call Parse Error") {
|
||||
checkParseExceptionContain("CALL cat.system radish kebab")("mismatched input 'CALL' expecting")
|
||||
if (HoodieSparkUtils.gteqSpark3_3) {
|
||||
checkParseExceptionContain("CALL cat.system radish kebab")("Syntax error at or near 'CALL'")
|
||||
} else {
|
||||
checkParseExceptionContain("CALL cat.system radish kebab")("mismatched input 'CALL' expecting")
|
||||
}
|
||||
}
|
||||
|
||||
test("Test Call Produce with semicolon") {
|
||||
@@ -110,9 +114,8 @@ class TestCallCommandParser extends HoodieSparkSqlTestBase {
|
||||
try {
|
||||
parser.parsePlan(sql)
|
||||
} catch {
|
||||
case e: Throwable =>
|
||||
assertResult(true)(e.getMessage.contains(errorMsg))
|
||||
hasException = true
|
||||
case e: Throwable if e.getMessage.contains(errorMsg) => hasException = true
|
||||
case f: Throwable => fail("Exception should contain: " + errorMsg + ", error message: " + f.getMessage, f)
|
||||
}
|
||||
assertResult(true)(hasException)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user