-
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
Refactor QueryBuilder usage and implement *char join pushdown in PostgreSQL #10059
Refactor QueryBuilder usage and implement *char join pushdown in PostgreSQL #10059
Conversation
1ddb6c5
to
f754a18
Compare
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestDefaultJdbcQueryBuilder.java
Show resolved
Hide resolved
Seems straightforward, as @hashhar said having an example implementation might help in visualizing why the change is needed. |
f754a18
to
1203bd4
Compare
Supersedes #10435 |
I've implemented *char join pushdown for PostgreSQL |
1203bd4
to
1e76b97
Compare
...in/trino-postgresql/src/main/java/io/trino/plugin/postgresql/CollationAwareQueryBuilder.java
Show resolved
Hide resolved
...in/trino-postgresql/src/main/java/io/trino/plugin/postgresql/CollationAwareQueryBuilder.java
Show resolved
Hide resolved
1d30723
to
84f31ae
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.
Nice. This would also allow us to accomodate other collation-sensitive pushdowns like predicates as well in a single place.
...in/trino-postgresql/src/main/java/io/trino/plugin/postgresql/CollationAwareQueryBuilder.java
Show resolved
Hide resolved
...in/trino-postgresql/src/main/java/io/trino/plugin/postgresql/CollationAwareQueryBuilder.java
Outdated
Show resolved
Hide resolved
...in/trino-postgresql/src/main/java/io/trino/plugin/postgresql/CollationAwareQueryBuilder.java
Show resolved
Hide resolved
d28b177
to
31562f7
Compare
Maybe squash " Pass join relation aliases as a variable " and " Extract join condition formatting to separate method " since the " Pass join relation aliases as a variable " doesn't seem to do anything by itself. |
Squash " Move public methods to the top of the class " with " Open DefaultQueryBuilder methods for overloading "? |
Why is " Pass ConnectorSession to isSupportedJoinCondition " needed? It's unclear from the commit history where/if it's being used? |
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.
The history is too fine-grained IMO. Makes following it a bit difficult.
The changes overall make sense.
I had a question - would just opening up the formatJoinCondition
be sufficient for our case? The ability to provide different QueryBuilder seems like a hammer that can be easily misused/make code difficult to follow.
|
|
||
if (isCollatable) { | ||
return format( | ||
"%s.%s COLLATE \"C\" %s %s.%s COLLATE \"C\"", |
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.
Maybe BaseJdbcClient should provide a method to fetch the collation name that matches Trino semantics?
It'll make this method more re-usable across databases since not every database has a C
collation.
Also same for the collation syntax.
Or maybe this should be left for future when we notice we are adding CollationAwareQueryBuilder2
?
Ah, so it's needed for "Move collation-aware pushdown to query builder". Maybe it should be squashed together. 🙂 |
@hashhar that's correct. That's why I've made it extensible |
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.
LGTM % some history re-ordering (or some squashes)
@ebyhr PTAL around the QueryBuilder extension.
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.
It would be nice to keep past commit history of DefaultQueryBuilder
(ex-QueryBuilder). I will defer the final merge to @hashhar.
@ebyhr Good point. @wendigo Can you add a commit before "Pass QueryBuilder instance through the JdbcClient constructor" which just creates an unused exact copy of |
31562f7
to
c5d3cf3
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.
Just some checkstyle fixes in "Pass QueryBuilder instance through the JdbcClient constructor"
It looks good to me otherwise.
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultQueryBuilder.java
Outdated
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultQueryBuilder.java
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultQueryBuilder.java
Outdated
Show resolved
Hide resolved
This is needed to be able to get WriteFunction for a column
c5d3cf3
to
8c00d95
Compare
cc: @grantatspothero Some Kudu flake? |
This is a preparatory step to be able to provide correct behavior when pushing down joins for case-(in)sensitive columns in the join condition comparisons