[ https://issues.apache.org/jira/browse/SPARK-28385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17004676#comment-17004676 ]
Takeshi Yamamuro commented on SPARK-28385: ------------------------------------------ Based on the document, this is an extension for PostgreSQL. So, I'll close for now. If necessary, please reopen this. > 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 > Priority: Major > > {{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 (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org