Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22075#discussion_r209426465
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/higherOrderFunctions.scala
 ---
    @@ -133,51 +142,40 @@ trait HigherOrderFunction extends Expression {
       }
     }
     
    -object HigherOrderFunction {
    -
    -  def arrayArgumentType(dt: DataType): (DataType, Boolean) = {
    -    dt match {
    -      case ArrayType(elementType, containsNull) => (elementType, 
containsNull)
    -      case _ =>
    -        val ArrayType(elementType, containsNull) = 
ArrayType.defaultConcreteType
    -        (elementType, containsNull)
    -    }
    -  }
    -
    -  def mapKeyValueArgumentType(dt: DataType): (DataType, DataType, Boolean) 
= dt match {
    -    case MapType(kType, vType, vContainsNull) => (kType, vType, 
vContainsNull)
    -    case _ =>
    -      val MapType(kType, vType, vContainsNull) = 
MapType.defaultConcreteType
    -      (kType, vType, vContainsNull)
    -  }
    -}
    -
     /**
      * Trait for functions having as input one argument and one function.
      */
     trait SimpleHigherOrderFunction extends HigherOrderFunction with 
ExpectsInputTypes {
     
    -  def input: Expression
    +  def argument: Expression
    +
    +  override def arguments: Seq[Expression] = argument :: Nil
     
    -  override def inputs: Seq[Expression] = input :: Nil
    +  def argumentType: AbstractDataType
    +
    +  override def checkArgumentDataTypes(): TypeCheckResult = {
    +    ExpectsInputTypes.checkInputDataTypes(arguments, argumentType :: Nil)
    +  }
     
       def function: Expression
     
       override def functions: Seq[Expression] = function :: Nil
     
       def expectingFunctionType: AbstractDataType = AnyDataType
    --- End diff --
    
    ditto, why don't we define it in the `HigherOrderFunction`?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to