Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5707

Non-scalar subquery fails the whole query if it's aggregate column has an alias

    XMLWordPrintableJSON

Details

    Description

      The following query can be handled by Drill

      SELECT b.marital_status, (SELECT SUM(position_id) FROM cp.`employee.json` a WHERE a.marital_status = b.marital_status ) AS max_a FROM cp.`employee.json` b
      

      But if I add an alias to the aggregate fuction

      SELECT b.marital_status, (SELECT SUM(position_id) MY_ALIAS FROM cp.`employee.json` a WHERE a.marital_status = b.marital_status ) AS max_a FROM cp.`employee.json` b
      

      Drill starts complaining that it can't handle non-scalar subqueries

      org.apache.drill.common.exceptions.UserRemoteException: UNSUPPORTED_OPERATION ERROR: Non-scalar sub-query used in an expression See Apache Drill JIRA: DRILL-1937
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            mgelbana Mohamed Mohsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: