gengliangwang commented on a change in pull request #33846: URL: https://github.com/apache/spark/pull/33846#discussion_r696482603
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/SessionWindow.scala ########## @@ -35,6 +35,34 @@ import org.apache.spark.unsafe.types.UTF8String * duration during the query execution. Note that the rows with negative or * zero gap duration will be filtered out from the aggregation. */ +// scalastyle:off line.size.limit +@ExpressionDescription( + usage = """ + _FUNC_(time_column, gap_duration) - Generates session window given a timestamp specifying column and gap duration. + See <a href="https://spark.apache.org/docs/latest/structured-streaming-programming-guide.html#types-of-time-windows">'Types of time windows'</a> in Structured Streaming guide doc for detailed explanation and examples. + """, + arguments = """ + Arguments: + * time_column - The column or the expression to use as the timestamp for windowing by time. The time column must be of TimestampType. + * gap_duration - A string specifying the timeout of the session represented as "interval value" + (See <a href="https://spark.apache.org/docs/latest/sql-ref-literals.html#interval-literal">Interval Literal</a> for more details.) for the fixed gap duration, or + an expression which is applied for each input and evaluated to the "interval value" for the dynamic gap duration. + """, + examples = """ + Examples: + > SELECT a, session_window.start, session_window.end, count(*) as cnt FROM VALUES ('A1', '2021-01-01 00:00:00'), ('A1', '2021-01-01 00:04:30'), ('A1', '2021-01-01 00:10:00'), ('A2', '2021-01-01 00:01:00') AS tab(a, b) GROUP by a, session_window(b, '5 minutes') ORDER BY a, start; Review comment: Nit: this is quite long. We can consider creating a temp view for the values.  -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
