You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yuming Wang (JIRA)" <ji...@apache.org> on 2019/07/14 14:04:00 UTC
[jira] [Created] (SPARK-28385) SELECT DISTINCT ON ( expression [,
...] ) syntax
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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org