-
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
Use JDBC parameters in JDBC complex expression pushdown #16616
Conversation
6194d47
to
8d21a48
Compare
8d21a48
to
25d1dc7
Compare
ignoring |
CI #13199 and |
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 API seems good, yet to review the changes in all the rewrite rules
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/expression/ExpressionRewrite.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/expression/ExpressionRewrite.java
Outdated
Show resolved
Hide resolved
Stream.concat(constraintExpressions.stream(), splitPredicate.stream()) | ||
.collect(joining(") AND (", "(", ")"))); | ||
return Optional.of(new ParameterizedExpression( | ||
Stream.concat(constraintExpressions.stream().map(ParameterizedExpression::expression), splitPredicate.stream()) |
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.
This block is hard to read and follow. Can we make it easier to reason about?
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.
this line was as-is here before, right?
@@ -374,7 +375,7 @@ public Optional<AggregationApplicationResult<ConnectorTableHandle>> applyAggrega | |||
newColumns.add(newColumn); | |||
projections.add(new Variable(newColumn.getColumnName(), aggregate.getOutputType())); | |||
resultAssignments.add(new Assignment(newColumn.getColumnName(), newColumn, aggregate.getOutputType())); | |||
expressions.put(columnName, expression.get().getExpression()); | |||
expressions.put(columnName, new ParameterizedExpression(expression.get().getExpression(), expression.get().getParameters())); |
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.
Can we introduce a factory method that will produce ParametrizedExpression
from JdbcExpression
?
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.
is this the only place where this would be useful?
@@ -92,4 +103,14 @@ public int hashCode() | |||
{ | |||
return Objects.hash(jdbcType, type, value); | |||
} | |||
|
|||
@Override | |||
public String toString() |
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.
Separate commit?
...n/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/expression/ParameterizedExpression.java
Show resolved
Hide resolved
...in/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/expression/RewriteVarcharConstant.java
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/OracleClient.java
Show resolved
Hide resolved
I like this change very much. Thank you @findepi |
The null case is handled 3 lines below.
426182a
to
dc58b78
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.
Thanks a lot for working on this.
LGTM % comment
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.
For other reviewers: this is now un-needed since we use prepared statements and the driver will handle this part now. (It took me quite some time to understand this).
@findepi As part of this we should also add a test which verifies pushdown works for unicode literals instead of query failures.
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.
@hashhar i am not introducing new functionality. What testing was RewriteUnicodeVarcharConstant.java
covered with?
@kokosing ptal |
ACK. I skimmed the code and I trust @hashhar review here. |
No description provided.