Github user yongtang commented on a diff in the pull request:
https://github.com/apache/spark/pull/17328#discussion_r122748372
--- Diff: python/pyspark/sql/functions.py ---
@@ -1854,6 +1854,46 @@ def sort_array(col, asc=True):
return Column(sc._jvm.functions.sort_array(_to_java_column(col), asc))
+@since(2.2)
+def map_keys(col):
+ """
+ Collection function: Returns an unordered array containing the keys of
the map.
+
+ :param col: name of column or expression
+
+ >>> from pyspark.sql.functions import map_keys
+ >>> df = spark.sql("SELECT map(1, 'a', 2, 'b') as data")
+ >>> df.select(map_keys("data").alias("keys")).show()
+ +------+
+ | keys|
+ +------+
+ |[1, 2]|
+ +------+
+ """
+ sc = SparkContext._active_spark_context
+ return Column(sc._jvm.functions.map_keys(_to_java_column(col)))
+
+
+@since(2.2)
--- End diff --
Done.
---
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]