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

    https://github.com/apache/spark/pull/21031#discussion_r180766173
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
 ---
    @@ -59,6 +60,36 @@ case class Size(child: Expression) extends 
UnaryExpression with ExpectsInputType
       }
     }
     
    +@ExpressionDescription(
    +  usage = "_FUNC_(expr) - Returns the size of an array or a map as BigInt. 
Returns -1 if null.",
    +  examples = """
    +    Examples:
    +      > SELECT _FUNC_(array('b', 'd', 'c', 'a'));
    +       4
    +  """,
    +  since = "2.4.0")
    +case class Cardinality(child: Expression) extends UnaryExpression with 
ExpectsInputTypes {
    +  override def dataType: DataType = DecimalType.BigIntDecimal
    +  override def inputTypes: Seq[AbstractDataType] = 
Seq(TypeCollection(ArrayType, MapType))
    +  override def nullable: Boolean = false
    +
    +  val size = Size(child)
    --- End diff --
    
    oh, I see... maybe a common abstract class as you did in another case?


---

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

Reply via email to