Skip to content

Conversation

codluca
Copy link
Member

@codluca codluca commented Sep 22, 2025

Add support for TopN pushdown for Oracle

Description

Older versions of Oracle (i.e. v11) support only WHERE ROWNUM <= number syntax, not FETCH FIRST number ROWS ONLY. So we wrapped the statement similar to the approach already used for LIMIT support: "SELECT * FROM (%s ORDER BY %s) WHERE ROWNUM <= %s".

Oracle sets NULL values last by default. Sometimes, however, the default does not work, so we used explicit flag for nulls.

Modified the topn related table names in BaseJdbcConnectorTest to shorter names, as Oracle's older version (i.e. v11) has a limit of 30 characters.

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
(X) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

## Section
* Fix some things. ({issue}`26566`)

Older versions of Oracle (i.e. v11) support only WHERE ROWNUM <= number syntax, not FETCH FIRST number ROWS ONLY. So we wrapped the statement similar to the approach already used for LIMIT support:
"SELECT * FROM (%s  ORDER BY %s) WHERE ROWNUM <= %s".

Oracle sets NULL values last by default. Sometimes, however, the default does not work, so we used explicit flag for nulls.

Modified the topn related table names in BaseJdbcConnectorTest to shorter names, as Oracle's older version (i.e. v11) has a limit of 30 characters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed oracle Oracle connector
Development

Successfully merging this pull request may close these issues.

1 participant