Github user rdblue commented on a diff in the pull request:
https://github.com/apache/spark/pull/12239#discussion_r62400576
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
---
@@ -347,10 +347,23 @@ case class InsertIntoTable(
override def children: Seq[LogicalPlan] = child :: Nil
override def output: Seq[Attribute] = Seq.empty
+ private[spark] lazy val expectedColumns = {
+ if (table.output.isEmpty) {
+ None
+ } else {
+ val numDynamicPartitions = partition.values.count(_.isEmpty)
+ val (partitionColumns, dataColumns) = table.output
+ .partition(a => partition.keySet.contains(a.name))
+ Some(dataColumns ++ partitionColumns.takeRight(numDynamicPartitions))
+ }
--- End diff --
@liancheng, I added a note about this below. The problem is that some
relations return `Nil` as their output. I think this approach is the least
intrusive solution because changing those relations is a large change. Please
let me know what you think, and thanks for reviewing!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]