xuzifu666 commented on code in PR #10536:
URL: https://github.com/apache/hudi/pull/10536#discussion_r1458533141
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/TestInsertTable.scala:
##########
@@ -2173,6 +2173,61 @@ class TestInsertTable extends HoodieSparkSqlTestBase {
})
}
+ test("Test inaccurate index type") {
+ withRecordType()(withTempDir { tmp =>
+ val targetTable = generateTableName
+
+ assertThrows[IllegalArgumentException] {
+ try {
+ spark.sql(
+ s"""
+ |create table ${targetTable} (
+ | `id` string,
+ | `name` string,
+ | `dt` bigint,
+ | `day` STRING,
+ | `hour` INT
+ |) using hudi
+ |OPTIONS ('hoodie.datasource.write.hive_style_partitioning'
'false', 'hoodie.datasource.meta.sync.enable' 'false',
'hoodie.datasource.hive_sync.enable' 'false')
+ |tblproperties (
+ | 'primaryKey' = 'id',
+ | 'type' = 'mor',
+ | 'preCombineField'='dt',
+ | 'hoodie.index.type' = 'BUCKET_aa',
+ | 'hoodie.bucket.index.hash.field' = 'id',
+ | 'hoodie.bucket.index.num.buckets'=512
+ | )
+ |partitioned by (`day`,`hour`)
+ |location '${tmp.getCanonicalPath}'
+ |""".stripMargin)
+ }
+ }
+
+ val targetTable1 = generateTableName
+ spark.sql(
+ s"""
+ |create table ${targetTable1} (
+ | `id` string,
+ | `name` string,
+ | `dt` bigint,
+ | `day` STRING,
+ | `hour` INT
+ |) using hudi
+ |OPTIONS ('hoodie.datasource.write.hive_style_partitioning'
'false', 'hoodie.datasource.meta.sync.enable' 'false',
'hoodie.datasource.hive_sync.enable' 'false')
+ |tblproperties (
+ | 'primaryKey' = 'id',
+ | 'type' = 'mor',
+ | 'preCombineField'='dt',
+ | 'hoodie.index.type' = 'BUCKET',
+ | 'hoodie.bucket.index.hash.field' = 'id',
+ | 'hoodie.bucket.index.num.buckets'=512
+ | )
+ |partitioned by (`day`,`hour`)
+ |location '${tmp.getCanonicalPath}'
+ |""".stripMargin)
Review Comment:
Yeah,not nesscery,I remove it @xiarixiaoyao
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]