-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Push down NOT, IS NULL, NOT IS NULL in PostgreSQL connector #11514
Push down NOT, IS NULL, NOT IS NULL in PostgreSQL connector #11514
Conversation
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/expression/TypePattern.java
Outdated
Show resolved
Hide resolved
5c9367b
to
c0bcdf7
Compare
@findepi done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Translate NOT, IS NULL, NOT IS NULL to connector expression(s)"
core/trino-main/src/main/java/io/trino/sql/planner/ConnectorExpressionTranslator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/ConnectorExpressionTranslator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/ConnectorExpressionTranslator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/ConnectorExpressionTranslator.java
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/sql/planner/BenchmarkPlanner.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/planner/ConnectorExpressionTranslator.java
Show resolved
Hide resolved
b3eea04
to
74a07e5
Compare
core/trino-main/src/main/java/io/trino/sql/planner/ConnectorExpressionTranslator.java
Show resolved
Hide resolved
@Test | ||
public void testConvertIsNotNull() | ||
{ | ||
// c_varchar IS NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stale comment?
plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlClient.java
Outdated
Show resolved
Hide resolved
@Test | ||
public void testIsNullPredicatePushdown() | ||
{ | ||
assertThat(query("SELECT nationkey FROM nation WHERE name IS NULL")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also test with a column that actually contains NULLs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also IS NULL
is possible to represent as a TupleDomain (none
) so should we add an OR
to ensure expression pushdown path?
c03af14
to
2f7bf47
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Translate NOT, IS NULL, NOT IS NULL to connector expression(s)"
} | ||
|
||
@Test | ||
public void testTranslateNotIsNull() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NotIsNull -> IsNotNull
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Implement NOT, IS NULL, NOT IS NULL pushdown in PostgreSQL connector"
"2, 'Bb'", | ||
"1, NULL", | ||
"2, NULL"))) { | ||
assertThat(query("SELECT a_int FROM " + table.getName() + " WHERE NOT(a_varchar LIKE 'A%' OR a_int = 2)")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOT (a OR b)
can be replaced with (NOT a) AND (NOT b)
.
The test still would test what it tests, but having NOT around LIKE only would make it simpler.
Please change.
LGTM % comments. |
2f7bf47
to
3a20817
Compare
(applied myself) |
Description
Improvement.
Core query engine & PostgreSQL connector.
Enables pushdown of
NOT
expression andIS NULL
,NOT IS NULL
predicates in PostgreSQL connectorRelated issues, pull requests, and links
#9506
Documentation
(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.
Release notes
( ) No release notes entries required.
(x) Release notes entries required with the following suggested text: