code: def size(col):
      
      sc = SparkContext._active_spark_context
      return Column(sc._jvm.functions.size(_to_java_column(col)))
docs: Collection function: returns the length of the array or map stored in the column.
  
      :param col: name of column or expression
  
      >>> df = spark.createDataFrame([([1, 2, 3],),([1],),([],)], ['data'])
      >>> df.select(size(df.data)).collect()
      [Row(size(data)=3), Row(size(data)=1), Row(size(data)=0)]