[SPARK-35194][SQL][FOLLOWUP] Change Seq to collections.Seq in NestedColumnAliasing to work with Scala 2.13
### What changes were proposed in this pull request? This PR changes an occurrence of `Seq` to `collections.Seq` in `NestedColumnAliasing`. ### Why are the changes needed? In the current master, `NestedColumnAliasing` doesn't work with Scala 2.13 and the relevant tests fail. The following are examples. * `NestedColumnAliasingSuite` * Subclasses of `SchemaPruningSuite` * `ColumnPruningSuite` ``` NestedColumnAliasingSuite: [info] - Pushing a single nested field projection *** FAILED *** (14 milliseconds) [info] scala.MatchError: (none#211451,ArrayBuffer(name#211451.middle)) (of class scala.Tuple2) [info] at org.apache.spark.sql.catalyst.optimizer.NestedColumnAliasing$.$anonfun$getAttributeToExtractValues$5(NestedColumnAliasing.scala:258) [info] at scala.collection.StrictOptimizedMapOps.flatMap(StrictOptimizedMapOps.scala:31) [info] at scala.collection.StrictOptimizedMapOps.flatMap$(StrictOptimizedMapOps.scala:30) [info] at scala.collection.immutable.HashMap.flatMap(HashMap.scala:39) [info] at org.apache.spark.sql.catalyst.optimizer.NestedColumnAliasing$.getAttributeToExtractValues(NestedColumnAliasing.scala:258) ``` ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Ran tests mentioned above and all passed with Scala 2.13. Closes #32848 from sarutak/followup-SPARK-35194-2. Authored-by: Kousuke Saruta <sarutak@oss.nttdata.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
This commit is contained in:
parent
94b66f5e28
commit
7e99b65295
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.apache.spark.sql.catalyst.optimizer
|
||||
|
||||
import scala.collection
|
||||
import scala.collection.mutable
|
||||
|
||||
import org.apache.spark.sql.catalyst.expressions._
|
||||
|
@ -255,7 +256,7 @@ object NestedColumnAliasing {
|
|||
nestedFieldReferences
|
||||
.filter(!_.references.subsetOf(exclusiveAttrSet))
|
||||
.groupBy(_.references.head.canonicalized.asInstanceOf[Attribute])
|
||||
.flatMap { case (attr: Attribute, nestedFields: Seq[ExtractValue]) =>
|
||||
.flatMap { case (attr: Attribute, nestedFields: collection.Seq[ExtractValue]) =>
|
||||
// Remove redundant [[ExtractValue]]s if they share the same parent nest field.
|
||||
// For example, when `a.b` and `a.b.c` are in project list, we only need to alias `a.b`.
|
||||
// Because `a.b` requires all of the inner fields of `b`, we cannot prune `a.b.c`.
|
||||
|
|
Loading…
Reference in a new issue