wugx commented on pull request #35476:
URL: https://github.com/apache/spark/pull/35476#issuecomment-1039256874
```scala
private def canApplyRegex(ctx: ParserRuleContext): Boolean =
withOrigin(ctx) {
var parent = ctx.getParent
if(!isRegex(ctx.getText)) return false
while (parent != null) {
if (parent.isInstanceOf[NamedExpressionContext]) return true
parent = parent.getParent
}
return false
}
```
The isRegex function only needs to be called once, If it is not regular, it
can return false directly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]