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

Analytics throws an error if LET variable is queried with any other field.

    XMLWordPrintable

Details

    • Untriaged
    • No
    • CX Sprint 143, CX Sprint 144, CX Sprint 145, CX Sprint 146, CX Sprint 147

    Description

      Query:

      select join_date date, `type` from default_ds let join_date = tostr(1233) || '-' || tostr(11);
      

      Result:

      [
        {
          "code": 1,
          "msg": "Cannot resolve ambiguous alias reference for undefined identifier type in [$join_date, $default_ds]",
          "query_from_user": "select join_date date, `type` from default_ds let join_date = tostr(1233) || '-' || tostr(11);"
        }
      ]
      

      While this query works fine:

      select join_date date from default_ds let join_date = tostr(1233) || '-' || tostr(11);
      

      Result:

      [
        {
          "date": "1233-11"
        },
        {
          "date": "1233-11"
        }
      ]
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          What does N1QL do?

          till Till Westmann added a comment - What does N1QL do?

          N1QL seems to allow it:

          SELECT age FROM tutorial LET x = 'y' LIMIT 1

          {
          "results": [

          { "age": 46 }

          ]
          }

          dmitry.lychagin Dmitry Lychagin (Inactive) added a comment - N1QL seems to allow it: SELECT age FROM tutorial LET x = 'y' LIMIT 1 { "results": [ { "age": 46 } ] }
          till Till Westmann added a comment - - edited

          Should not be an issue as it works with explicit aliases.

          till Till Westmann added a comment - - edited Should not be an issue as it works with explicit aliases.

          Open source tracking issue to ignore LET variables when resolving identifiers has been filed to track this: https://issues.apache.org/jira/browse/ASTERIXDB-2539

          dmitry.lychagin Dmitry Lychagin (Inactive) added a comment - Open source tracking issue to ignore LET variables when resolving identifiers has been filed to track this:  https://issues.apache.org/jira/browse/ASTERIXDB-2539

          Working fine on build Enterprise Edition 6.5.0 build 3515

          ritesh.agarwal Ritesh Agarwal added a comment - Working fine on build Enterprise Edition 6.5.0 build 3515

          People

            dmitry.lychagin Dmitry Lychagin (Inactive)
            ritesh.agarwal Ritesh Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty