Synapse Analytics Spark Example 2 – ROW_NUMBER() from Blog Posts – SQLServerCentral


The next example is how to do a ROW_NUMBER(), my favourite window function.

T-SQL SELECT *, ROW_NUMBER() OVER(ORDER BY dateTime) as RowNumber FROM chicago.safety_data Spark SQL SELECT *, ROW_NUMBER() OVER(ORDER BY dateTime) as RowNumber FROM chicago.safety_data DataFrame API (C#) var dataFrame = spark.Read().Table(“chicago.safety_data”); var window = Microsoft.Spark.Sql.Expressions.Window.OrderBy(“dateTime”); dataFrame = dataFrame.WithColumn(“RowNumber”, Functions.RowNumber().Over(window)); dataFrame.Show(); To see this in action, please feel free to deploy this repo to your Synapse Analytics repo: https://github.com/GoEddie/SynapseSparkExamples

The post Synapse Analytics Spark Example 2 – ROW_NUMBER()[1] appeared first on SQLServerCentral[2].

References

  1. ^ Synapse Analytics Spark Example 2 – ROW_NUMBER() (www.sqlservercentral.com)
  2. ^ SQLServerCentral (www.sqlservercentral.com)


Source: Programming News

January 19, 2021
Category : Marketing
Tags: Databases News | News | SQL | SQL server

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.