trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.49k stars 3.02k forks source link

Add partial Top-N pushdown support for Vertica #24217

Open vlad-lyutenko opened 11 hours ago

vlad-lyutenko commented 11 hours ago

Description

Vertica doesn't have concept of NULLS FIRST/LAST for ORDER BY queries, according to documentation:

NULL values are either first or last in the sort order, depending on data type:
INTEGER, INT, DATE/TIME: NULL has the smallest value.

FLOAT, BOOLEAN, CHAR, VARCHAR, ARRAY, SET: NULL has the largest value

So in case if trino hints to null ordering consistent with above rule we can do push down.

But if user for example has relaxed requirements for NULL's values or even know exactly that data is NULL free, he could tweak the query to perform push down by making it consistent with Trino

for example by providing for

In this case pushdown will always happen.

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:

## Vertica connector
* Add support for partial Top-N pushdown. ({issue}`24217`)
mosabua commented 6 hours ago

Can you add a Performance section like in the PostgreSQL connector docs to the Vertica doc .. and for now just have the Top-N pushdown link.. and then over time we add more and more...