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

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

Agile BoardAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 4.0-alpha1, 4.0
    • CQL/Interpreter
    • 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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            charsyam DaeMyung Kang Assign to me
            charsyam DaeMyung Kang
            DaeMyung Kang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment