Fix unsafe cast in RowExpressionFormatter#16550
Conversation
kaikalur
left a comment
There was a problem hiding this comment.
We need a test that can reproduce the issue.
There was a problem hiding this comment.
Does this belong inside the if? Looks like it's unrelated
@kaikalur added tests that reproduce the issue |
|
Can you make sure your commit message follows the guidelines here: https://chris.beams.io/posts/git-commit/. Also, add a description to the commit message body about what was fixed (what previously failed and what error we would see). Also, this should have a release note about what was fixed. |
|
@rschlussel added more info in the commit message + added release note |
|
Thanks! can you also change the commit message title from "Fixed..." to "Fix..." as per the commit guidelines |
The pattern argument of a LIKE CallExpression is changed from a CallExpression describing the pattern into a joni.Regex object when the RowExpression is optimized by RowExpressionInterperter. When this occured on a LIKE CallExpression in a query plan before the plan was output with PlanPrinter, the following cast error occured: class com.facebook.presto.spi.relation.ConstantExpression cannot be cast to class com.facebook.presto.spi.relation.CallExpression This occurred due to an unchecked cast in RowExpressionFormatter. A type check was added before the cast, and tests were added to RowExpressionFormatter that reproduce the behaviour of printing an optimized LIKE CallExpression.
shixuan-fan
left a comment
There was a problem hiding this comment.
Can you also fix the PR title to be consistent with commit title?
|
Merged since PR title could be fixed afterwards :) |
Fixed the ClassCastException that occurs when the RowExpression containing a compiled LIKE predicate (RowExpressionInterpreter.tryHandleLike()) is printed with RowExpressionFormatter.
Test plan: unit tests