Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,14 @@ trait ProvidesHoodieConfig extends Logging {
(enableBulkInsert, isOverwritePartition, isOverwriteTable, dropDuplicate, isNonStrictMode, isPartitionedTable) match {
case (true, _, _, _, false, _) =>
throw new IllegalArgumentException(s"Table with primaryKey can not use bulk insert in ${insertMode.value()} mode.")
case (true, true, _, _, _, true) =>
throw new IllegalArgumentException(s"Insert Overwrite Partition can not use bulk insert.")
// if enableBulkInsert is true, use bulk insert for the insert overwrite non-partitioned table.
case (true, _, true, _, _, _) =>
throw new IllegalArgumentException(s"Insert Overwrite can not use bulk insert.")
case (true, true, _, _, _, _) =>
throw new IllegalArgumentException(s"Insert Overwrite can not use bulk insert.")
case (true, _, _, true, _, _) =>
throw new IllegalArgumentException(s"Bulk insert cannot support drop duplication." +
s" Please disable $INSERT_DROP_DUPS and try again.")
// if enableBulkInsert is true, use bulk insert for the insert overwrite non-partitioned table.
case (true, false, true, _, _, false) => BULK_INSERT_OPERATION_OPT_VAL
// insert overwrite table
case (false, false, true, _, _, _) => INSERT_OVERWRITE_TABLE_OPERATION_OPT_VAL
// insert overwrite partition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.spark.sql.hudi

import org.apache.hudi.DataSourceReadOptions.SCHEMA_EVOLUTION_ENABLED
import org.apache.hudi.DataSourceWriteOptions._
import org.apache.hudi.HoodieSparkUtils
import org.apache.hudi.common.table.{HoodieTableMetaClient, TableSchemaResolver}
Expand Down Expand Up @@ -568,8 +567,11 @@ class TestInsertTable extends HoodieSparkSqlTestBase {
| tblproperties (primaryKey = 'id')
| partitioned by (dt)
""".stripMargin)
checkException(s"insert overwrite table $tableName3 partition(dt = '2021-07-18') values(1, 'a1', 10, '2021-07-18')")(
"Insert Overwrite Partition can not use bulk insert."
checkException(s"insert overwrite table $tableName3 partition(dt = '2021-07-18') values(1, 'a1', 10)")(
"Insert Overwrite can not use bulk insert."
)
checkException(s"insert overwrite table $tableName3 values(1, 'a1', 10, '2021-07-18')")(
"Insert Overwrite can not use bulk insert."
)
}
}
Expand Down Expand Up @@ -703,10 +705,6 @@ class TestInsertTable extends HoodieSparkSqlTestBase {
checkAnswer(s"select id, name, price from $nonPartitionedTable")(
Seq(1, "a1", 10.0)
)
spark.sql(s"insert overwrite table $nonPartitionedTable values(2, 'a2', 10)")
checkAnswer(s"select id, name, price from $nonPartitionedTable")(
Seq(2, "a2", 10.0)
)
spark.sql("set hoodie.sql.bulk.insert.enable = false")

// Test CTAS for bulk insert
Expand Down