Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for OFFSET Pushdown in Custom Trino Connector #23963

Open
lihonosov opened this issue Oct 29, 2024 · 4 comments
Open

Support for OFFSET Pushdown in Custom Trino Connector #23963

lihonosov opened this issue Oct 29, 2024 · 4 comments

Comments

@lihonosov
Copy link

I’m working on a custom Trino connector (query external data source via HTTP protocol) and would like to push down the OFFSET parameter directly to the data source. However, it seems that Trino might not support this functionality fully at the moment.

For example, when I run a query like:

SELECT * FROM custom_connector_table OFFSET 1 LIMIT 1

the ConnectorMetadata.applyLimit method only receives limit = 2, without a clear way to distinguish between the OFFSET and LIMIT values separately.

Is there a way to directly access the values of both OFFSET and LIMIT in the current Trino API, or is there another recommended approach for implementing OFFSET pushdown in a custom connector?

Any guidance on this would be greatly appreciated!

@chenjian2664
Copy link
Contributor

@hashhar @kokosing @ebyhr
Do you think it is worth to add a rule to pushdown the offset with limit, if yes I wanna take this

@kokosing
Copy link
Member

I haven't heard much about a demand for this.

@lihonosov
Copy link
Author

lihonosov commented Oct 31, 2024

It also happens with the Postgres connector:

Image

Image

Query log from Postgres:
Image

So, instead of returning 1 row, Postgres will return up to 1,001 rows

@chenjian2664
Copy link
Contributor

It's because of the PushLimitThroughOffset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants