1
0

[HUDI-2759] extract HoodieCatalogTable to coordinate spark catalog table and hoodie table (#3998)

This commit is contained in:
Yann Byron
2021-11-24 18:12:38 +08:00
committed by GitHub
parent 0bb506fa00
commit a234833f0a
18 changed files with 619 additions and 550 deletions

View File

@@ -47,7 +47,7 @@ class TestAlterTableDropPartition extends TestHoodieSqlBase {
spark.sql(s"""insert into $tableName values (1, "z3", "v1", "2021-10-01"), (2, "l4", "v1", "2021-10-02")""")
checkExceptionContain(s"alter table $tableName drop partition (dt='2021-10-01')")(
s"dt is not a valid partition column in table `default`.`$tableName`.")
s"dt is not a valid partition column in table")
}
Seq(false, true).foreach { urlencode =>

View File

@@ -138,7 +138,7 @@ class TestHoodieOptionConfig extends HoodieClientTestBase {
val e2 = intercept[IllegalArgumentException] {
HoodieOptionConfig.validateTable(spark, schema, sqlOptions2)
}
assertTrue(e2.getMessage.contains("Can't find primary key"))
assertTrue(e2.getMessage.contains("Can't find primaryKey"))
// preCombine field not found
val sqlOptions3 = baseSqlOptions ++ Map(
@@ -149,7 +149,7 @@ class TestHoodieOptionConfig extends HoodieClientTestBase {
val e3 = intercept[IllegalArgumentException] {
HoodieOptionConfig.validateTable(spark, schema, sqlOptions3)
}
assertTrue(e3.getMessage.contains("Can't find precombine key"))
assertTrue(e3.getMessage.contains("Can't find preCombineKey"))
// miss type parameter
val sqlOptions4 = baseSqlOptions ++ Map(

View File

@@ -17,7 +17,6 @@
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
@@ -265,10 +264,6 @@ 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"""
@@ -285,6 +280,11 @@ class TestInsertTable extends TestHoodieSqlBase {
checkAnswer(s"select id, name, price from $tableName")(
Seq(1, "a1", 10.0)
)
val metaClient = HoodieTableMetaClient.builder()
.setBasePath(tmp.getCanonicalPath)
.setConf(spark.sessionState.newHadoopConf())
.build()
assertResult(metaClient.getTableConfig.getTableName)(tableName)
}
}