1
0

[HUDI-2251] Fix Exception Cause By Table Name Case Sensitivity For Append Mode Write (#3367)

This commit is contained in:
pengzhiwei
2021-07-30 05:36:56 +08:00
committed by GitHub
parent 44e41dc9bb
commit c2370402ea
2 changed files with 34 additions and 5 deletions

View File

@@ -17,6 +17,8 @@
package org.apache.spark.sql.hudi
import org.apache.hudi.common.model.HoodieTableType
import org.apache.hudi.common.table.HoodieTableMetaClient
import org.apache.hudi.exception.HoodieDuplicateKeyException
class TestInsertTable extends TestHoodieSqlBase {
@@ -255,6 +257,31 @@ class TestInsertTable extends TestHoodieSqlBase {
}
}
test("Test insert for uppercase table name") {
withTempDir{ tmp =>
val tableName = s"H_$generateTableName"
HoodieTableMetaClient.withPropertyBuilder()
.setTableName(tableName)
.setTableType(HoodieTableType.COPY_ON_WRITE.name())
.initTable(spark.sessionState.newHadoopConf(), tmp.getCanonicalPath)
spark.sql(
s"""
|create table $tableName (
| id int,
| name string,
| price double
|) using hudi
| location '${tmp.getCanonicalPath}'
""".stripMargin)
spark.sql(s"insert into $tableName values(1, 'a1', 10)")
checkAnswer(s"select id, name, price from $tableName")(
Seq(1, "a1", 10.0)
)
}
}
test("Test Insert Exception") {
val tableName = generateTableName
spark.sql(