Skip to content

Transformed Dense Rank function by Ignoring Parameters #4

@nnamdi16

Description

@nnamdi16

What motivated this issue?

Exasol doesn't support passing parameters to the DENSE_RANK function, which is supported by some dialects such as Spark and Databricks.


How is the existing logic incorrect?

When transpiling from Spark or Databricks to Exasol, SQLGlot currently preserves the parameter passed to DENSE_RANK, which results in invalid Exasol SQL.

For example, the following query is valid in Spark or Databricks:

SELECT a, b, DENSE_RANK(b) OVER (ORDER BY b)
FROM (VALUES ('A1', 2), ('A1', 1), ('A2', 3), ('A1', 1)) AS tab(a, b)

However, this would fail in Exasol because DENSE_RANK does not accept parameters. The valid Exasol syntax is:

DENSE_RANK() OVER (ORDER BY b)

How should this be addressed?

The transpiler should ignore any parameters passed to the DENSE_RANK function when generating Exasol SQL, ensuring the output conforms to Exasol’s syntax.


Documentation and semantic notes

Exasol documentation:

https://docs.exasol.com/db/latest/sql_references/functions/alphabeticallistfunctions/dense_rank.htm

According to the documentation, DENSE_RANK does not accept any parameters in Exasol.

Ignoring the parameter during transpilation preserves the intended semantics, since the ranking behaviour is defined entirely by the OVER clause, not by any function argument.

Metadata

Metadata

Assignees

Labels

bugUnwanted / harmful behavior

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions