Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Fix expression predicate pushdown not firing before AddExchanges #11083
Fix expression predicate pushdown not firing before AddExchanges #11083
Changes from all commits
1b87d5f
a304e54
09c1db6
2ae5ab3
4600f05
37ffe62
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
IMO this is clearer:
Optional.of(TRUE).equals(connectorExpression)
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.
connectorExpression.orElse(TRUE)
is already used in oither places in this method.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.
nit:
string
is a strange name for a variable, could this be changed? (I see it elsewhere in the Cassandra Plugin code, but only 2 places).Most code uses
toStringHelper(this)
or else:?
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.
HiveTableHandle
handles it like this: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.
@leveyja if i were using
StringBuilder
i would indeed usebuilder
and i had this this way originally.However, there is no benefit of using
StringBuilder
in this code (no performance gain), andappend
vs+=
is just more verbose, so i switch 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.
@findepi
String string
is just something I've never seen before.StringBuilder builder
- it is a builder, it's common.If you want to stick with
String
+ concatenation, I'd useString toString
to give it more meaning.Object object
,List list
, all of these are redundant / unseen in my experience.Re: performance gain - it's not in an inner loop, but there are intermediate strings generated by all the concatenations (I count at least 10), so while I wouldn't classify it as "performance gain", I'd see it as much better to use a builder for arbitrary String concatenation, unless it is absolutely trivial (e.g.,
throw new IllegalStateException("blah " + input)
^ This removes the
String.format("%s:%s")
- so I'd say we go with it.String string
honestly made me comment - it's very weird.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.
String toString
would be fine, i don't see much difference. Perhaps it could also beresult
StringBuilder builder
would be OK too. I just find it hard to read and will prefer ordinary string concatenation -- as implemented in this PR, or heretrino/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultQueryBuilder.java
Lines 79 to 93 in bf79840
anyway, i am open for this to be changed
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.
nit: use
StringBuilder
to remove theString string
variable and intermediate string creation.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.
there is no performance benefit to doing so, as java internally replaces this with StringBuilder, and it doesn't improve readability IMO.
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.
My original comment is on the
String string
naming -String toStirng
is better.If we're arguing about performance benefit, why use String.format here instead of concatenation?
Ultimately, my comment is: this
toString()
method differs from all others in style + variable naming - arguing about the performance isn't really my point - it's consistency. Thanks for pointing out Java (sometimes) optimizes"a" + "b" + "c"
to use StringBuilder - I suggested StringBuilder to match the existing style, and as a (possible) workaround for theString string
naming.I'd still suggest you rename that
String toString
, whatever else about String.format + builder, etc 👍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.
Annnnd now I see it's merged :-)
Ignore me! ;-)