Yuming Wang created SPARK-28385: ----------------------------------- Summary: SELECT DISTINCT ON ( expression [, ...] ) syntax Key: SPARK-28385 URL: https://issues.apache.org/jira/browse/SPARK-28385 Project: Spark Issue Type: Sub-task Components: SQL Affects Versions: 3.0.0 Reporter: Yuming Wang
{{SELECT DISTINCT ON ( _{{expression}}_ [, ...] )}} keeps only the first row of each set of rows where the given expressions evaluate to equal. The {{DISTINCT ON}} expressions are interpreted using the same rules as for {{ORDER BY}} (see above). Note that the “first row” of each set is unpredictable unless {{ORDER BY}} is used to ensure that the desired row appears first. For example: {code:sql} SELECT DISTINCT ON (location) location, time, report FROM weather_reports ORDER BY location, time DESC; {code} https://www.postgresql.org/docs/11/sql-select.html -- This message was sent by Atlassian JIRA (v7.6.14#76016) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org