Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-36577

Applying N1QL "format" on more complex statements can indent incorrectly

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 6.5.0
    • 7.0.0
    • UI
    • Untriaged
    • Unknown

    Description

      When applying the new 6.5 "format" feature in the N1QL query editor complex queries are sometimes not indented correctly to the proper level.

      The two example N1QL files ( indents_fine.n1ql and indents_bad.n1ql ) are almost identical.

      BUT the format differently WRT indenting see attached image where the last three lines are incorrectly indented and additional level.

      Attachments

        1. indents_bad.n1ql
          1.0 kB
        2. indents_fine.n1ql
          1 kB
        3. issue_pic.JPG
          issue_pic.JPG
          131 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          eben Eben Haber added a comment -

          This query is also problematic:

          SELECT city,
                 COUNT(1) hotel_count,
                 (TOSTR(ROUND(RATIO_TO_REPORT(COUNT(1)) OVER (           ) * 100,
                 0)) || "%") AS hotels_percent
          FROM `travel-sample`WHERE type = 'hotel'GROUP BY city
          ORDER BY hotel_count DESC
          LIMIT 30;  

          eben Eben Haber added a comment - This query is also problematic: SELECT city,        COUNT(1) hotel_count,        (TOSTR(ROUND(RATIO_TO_REPORT(COUNT(1)) OVER (           ) * 100,        0)) || "%") AS hotels_percent FROM `travel-sample`WHERE type = 'hotel'GROUP BY city ORDER BY hotel_count DESC LIMIT 30;  

          Build couchbase-server-6.5.1-6168 contains ns_server commit c660ea3 with commit message:
          MB-36577 - N1QL formatter fails on certain queries

          build-team Couchbase Build Team added a comment - Build couchbase-server-6.5.1-6168 contains ns_server commit c660ea3 with commit message: MB-36577 - N1QL formatter fails on certain queries

          Build couchbase-server-7.0.0-1347 contains ns_server commit c660ea3 with commit message:
          MB-36577 - N1QL formatter fails on certain queries

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.0.0-1347 contains ns_server commit c660ea3 with commit message: MB-36577 - N1QL formatter fails on certain queries
          eben Eben Haber added a comment -

          The fix for this has been merged into 6.5.1.

          eben Eben Haber added a comment - The fix for this has been merged into 6.5.1.

          Build couchbase-server-6.6.0-7519 contains ns_server commit c660ea3 with commit message:
          MB-36577 - N1QL formatter fails on certain queries

          build-team Couchbase Build Team added a comment - Build couchbase-server-6.6.0-7519 contains ns_server commit c660ea3 with commit message: MB-36577 - N1QL formatter fails on certain queries

          People

            eben Eben Haber
            jon.strabala Jon Strabala
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty