1
0

[HUDI-4079] Supports showing table comment for hudi with spark3 (#5546)

This commit is contained in:
Jin Xing
2022-05-11 22:28:58 +08:00
committed by GitHub
parent 4a8589f222
commit 7f0c1f3ddf
2 changed files with 38 additions and 13 deletions

View File

@@ -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.model.HoodieRecord
import org.apache.hudi.common.table.{HoodieTableConfig, HoodieTableMetaClient}
import org.apache.hudi.config.HoodieWriteConfig
@@ -641,4 +642,26 @@ class TestCreateTable extends HoodieSparkSqlTestBase {
|""".stripMargin
)
}
if (HoodieSparkUtils.gteqSpark3_2) {
test("Test create table with comment") {
val tableName = generateTableName
spark.sql(
s"""
| create table $tableName (
| id int,
| name string,
| price double,
| ts long
| ) using hudi
| comment "This is a simple hudi table"
| tblproperties (
| primaryKey = 'id',
| preCombineField = 'ts'
| )
""".stripMargin)
val shown = spark.sql(s"show create table $tableName").head.getString(0)
assertResult(true)(shown.contains("COMMENT 'This is a simple hudi table'"))
}
}
}