Top "Window-functions" questions

A window function is a type of SQL operation that aggregates over a partition of the result set.

Does Spark know the partitioning key of a DataFrame?

I want to know if Spark knows the partitioning key of the parquet file and uses this information to avoid …

apache-spark partitioning window-functions
Avoid performance impact of a single partition mode in Spark window functions

My question is triggered by the use case of calculating the differences between consecutive rows in a spark dataframe. For …

apache-spark pyspark apache-spark-sql partitioning window-functions
mutate by group in R

I have a data with following columns: Date CID FID rank 31/01/17 abc0001 rx180x01 0 31/01/17 abc0001 rx180x02 0 31/01/17 abc0001 rx180x03 2 28/02/17 …

r dplyr window-functions mutate
Rounding numbers to the nearest 10 in Postgres

I'm trying to solve this particular problem from PGExercises.com: https://www.pgexercises.com/questions/aggregates/rankmembers.html The gist …

sql postgresql integer window-functions integer-division
Snowflake: "SQL compilation error:... is not a valid group by expression"

Without resorting to CTEs or a sub-query is there any way to use Window functionality with a different summary level …

sql count sum snowflake-cloud-data-platform window-functions
Generate id row for a view with grouping

I'm trying to create a view with row numbers like so: create or replace view daily_transactions as select generate_…

sql postgresql view window-functions sql-view
Spark and SparkSQL: How to imitate window function?

Description Given a dataframe df id | date --------------- 1 | 2015-09-01 2 | 2015-09-01 1 | 2015-09-03 1 | 2015-09-04 2 | 2015-09-04 I want …

scala apache-spark apache-spark-sql window-functions
Using QUALIFY Row_Number in hive

I'm working with Teradata conversion to Hive (version 0.10.0). Teradata Query : QUALIFY ROW_NUMBER() OVER (PARTITION BY ADJSTMNT,SRC_CMN , TYPE_…

sql hive window-functions
Cumulative sum of values by month, filling in for missing months

I have this data table and I'm wondering if is possible create a query that get a cumulative sum by …

sql postgresql aggregate-functions window-functions generate-series
PostgreSQL equivalent for TOP n WITH TIES: LIMIT "with ties"?

I'm looking for something similar this in SQL Server: SELECT TOP n WITH TIES FROM tablename I know about LIMIT …

sql postgresql window-functions sql-limit