julianhyde commented on code in PR #3338:
URL: https://github.com/apache/calcite/pull/3338#discussion_r1295274217
##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -345,6 +346,17 @@ public static String sha512(ByteString string) {
return DigestUtils.sha512Hex(string.getBytes());
}
+ /** SQL {@code REGEXP_CONTAINS(value, regexp)} function.
+ * Throws a runtime exception for invalid regular expressions.*/
+ public static boolean regexpContains(String value, String regex) {
+ try {
+ Pattern regexp = Pattern.compile(regex);
Review Comment:
I wouldn't link to jira from the source code. Comments in the source code
should be self-contained.
(I know we add jira links in bugs. But that's because we *removed* a bug,
and we don't want to leave a trail of mistakes in the source code.)
This is a decision affects the specification of the function, not just its
implementation. So I think the right place for the comment is in
`big-query.iq`. You could have another comment in the body of `regexpContains`
if you think maintainers might be confused why we're using Java regex.
--
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]