cxzl25 commented on a change in pull request #34493:
URL: https://github.com/apache/spark/pull/34493#discussion_r744092734
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/InsertIntoHiveTable.scala
##########
@@ -192,6 +192,17 @@ case class InsertIntoHiveTable(
if (partition.nonEmpty) {
if (numDynamicPartitions > 0) {
if (overwrite && table.tableType == CatalogTableType.EXTERNAL) {
+ val numWrittenParts = writtenParts.size
+ val maxDynamicPartitionsKey = "hive.exec.max.dynamic.partitions"
+ val maxDynamicPartitions =
hadoopConf.getInt(maxDynamicPartitionsKey, 1000)
+ if (numWrittenParts > maxDynamicPartitions) {
+ val maxDynamicPartitionsErrMsg =
+ s"Number of dynamic partitions created is $numWrittenParts" +
+ s", which is more than $maxDynamicPartitions" +
+ s". To solve this try to set $maxDynamicPartitionsKey" +
+ s" to at least $numWrittenParts."
Review comment:
It is possible to automatically adjust the number of
`hive.exec.max.dynamic.partitions`.
However, if it is automatically adjusted, many partitions may be created
accidentally, and this parameter is meaningless.
https://github.com/apache/hive/blob/135629b8d6b538fed092641537034a9fbc59c7a0/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java#L1857-L1864
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]