Skip to content

TOP 100 PERCENT is issued for MSSQL in absence of ORDER BY, breaking support for Azure DW #337

@alexkyllo

Description

@alexkyllo

PR #277 causes the mssql backend to issue SELECT TOP 100 PERCENT in sub queries even if there is no ORDER BY clause. This breaks dbplyr for Azure Data Warehouse, which is a version of MSSQL that does not support SELECT [...] PERCENT syntax. I'm working on a PR to change this so that TOP 100 PERCENT at least only gets issued if there is actually an ORDER BY, so that ADW users can use dbplyr again.

mf <- lazy_frame(x = 1:3, con = simulate_mssql())
mf %>% mutate(x = -x) %>% mutate(x = -x) %>% sql_render()
#> <SQL> SELECT -`x` AS `x`
#> FROM (SELECT TOP 100 PERCENT -`x` AS `x`
#> FROM `df`) `dbplyr_001`

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviordplyr verbs 🤖Translation of dplyr verbs to SQL

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions