drexler-sky commented on code in PR #49338: URL: https://github.com/apache/spark/pull/49338#discussion_r1900507521
########## python/pyspark/sql/functions/builtin.py: ########## @@ -15341,13 +15341,32 @@ def regexp_count(str: "ColumnOrName", regexp: "ColumnOrName") -> Column: Examples -------- + >>> from pyspark.sql import functions as sf >>> df = spark.createDataFrame([("1a 2b 14m", r"\d+")], ["str", "regexp"]) - >>> df.select(regexp_count('str', lit(r'\d+')).alias('d')).collect() - [Row(d=3)] - >>> df.select(regexp_count('str', lit(r'mmm')).alias('d')).collect() - [Row(d=0)] - >>> df.select(regexp_count("str", col("regexp")).alias('d')).collect() - [Row(d=3)] + >>> df.select('*', sf.regexp_count('str', sf.lit(r'\d+'))).show() + +---------+------+----------------------+ + | str|regexp|regexp_count(str, \d+)| + +---------+------+----------------------+ + |1a 2b 14m| \d+| 3| + +---------+------+----------------------+ Review Comment: done thanks -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org