Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-15033

Refactor to singleQuote reuse java.util.regex.Pattern instead of String.replaceAll for TableCQLHelper.java

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Low
    • Resolution: Fixed
    • Fix Version/s: 4.0
    • Component/s: CQL/Interpreter
    • Labels:
      None

      Description

      singleQuote uses `String.replaceAll ()` a lot in loop.

      and 'String.replaceAll()' compiles the regular expression each time it is called.

       

      public String replaceAll(String regex, String replacement) {
          return Pattern.compile(regex).matcher(this).replaceAll(replacement);
       }

       

      It is suggested in javadoc (https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#matches(java.lang.String,%20java.lang.CharSequence)) that it is efficient to reuse the pattern.

        Attachments

          Activity

            People

            • Assignee:
              charsyam DaeMyung Kang
              Reporter:
              charsyam DaeMyung Kang
              Authors:
              DaeMyung Kang
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: