Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6723#discussion_r32077990
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullFunctions.scala
 ---
    @@ -19,29 +19,29 @@ package org.apache.spark.sql.catalyst.expressions
     
     import 
org.apache.spark.sql.catalyst.expressions.codegen.{GeneratedExpressionCode, 
CodeGenContext}
     import org.apache.spark.sql.catalyst.trees
    -import org.apache.spark.sql.catalyst.analysis.UnresolvedException
    +import org.apache.spark.sql.catalyst.analysis.{TypeCheckResult, 
UnresolvedException}
     import org.apache.spark.sql.types.DataType
     
     case class Coalesce(children: Seq[Expression]) extends Expression {
     
       /** Coalesce is nullable if all of its children are nullable, or if it 
has no children. */
    -  override def nullable: Boolean = !children.exists(!_.nullable)
    +  override def nullable: Boolean = children.forall(_.nullable)
     
       // Coalesce is foldable if all children are foldable.
    -  override def foldable: Boolean = !children.exists(!_.foldable)
    -
    -  // Only resolved if all the children are of the same type.
    -  override lazy val resolved = childrenResolved && 
(children.map(_.dataType).distinct.size == 1)
    +  override def foldable: Boolean = children.forall(_.foldable)
    +
    +  override def checkInputDataTypes(): TypeCheckResult = {
    +    if (children.map(_.dataType).distinct.size > 1) {
    --- End diff --
    
    let's add this pattern to your util class, and then call this in coalesce 
and array.


---
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]

Reply via email to