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

IllegalStateException in aggregation function 'single_value' when there is a varchar datatype in the subquery results

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.14.0, 1.15.0
    • 1.17.0
    • None

    Description

      Description:
      The following issue can be reproduced on the fix for the DRILL-7050.

      For the query with > 1 row in subquery results where the data type of these results is not varchar:

      SELECT
        e.full_name,
        (
          SELECT
            ine.employee_id
          FROM
            cp.`employee.json` ine
          WHERE
            ine.position_id = e.position_id
        ) as empl_id
      FROM
        cp.`employee.json` e
      LIMIT 20
      

      We have the following correct and informative error:

      Query Failed: An Error Occurred
      org.apache.drill.common.exceptions.UserRemoteException: FUNCTION ERROR: Input for single_value function has more than one row Fragment 0:0 [Error Id: b770098f-b1c7-4647-9f41-9e986a0e47b7 on maprhost:31010]
      

      But when in the result set of the subquery we have a varchar data type:

      SELECT
        e.full_name,
        (
          SELECT
            ine.first_name
          FROM
            cp.`employee.json` ine
          WHERE
            ine.position_id = e.position_id
        ) as empl_id
      FROM
        cp.`employee.json` e
      LIMIT 20
      

      Actual result:
      Drill throws the following error:

      org.apache.drill.common.exceptions.UserRemoteException: SYSTEM ERROR: IllegalStateException: Workspace variable 'value' in aggregation function 'single_value' is not allowed to have variable length type. Fragment 0:0 Please, refer to logs for more information. [Error Id: 32325ba9-d2b3-4216-acf6-8e80dfe4a56a on maprhost:31010]
      

      Log file is in the attachment "drillbit.log"

      Expected result:
      Drill should return the same informative error to any of a data types in the subquery result set.

      Attachments

        Activity

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

          People

            volodymyr Vova Vysotskyi
            denysord88 Denys Ordynskiy
            Bohdan Kazydub Bohdan Kazydub
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment