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

Canceling a query hung in planning state, leaves the query in ENQUEUED state for ever.

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.12.0
    • 1.13.0
    • Execution - Flow
    • Drill 1.12.0-SNAPSHOT, commit: 4a718a0bd728ae02b502ac93620d132f0f6e1b6c

    Description

      Canceling the below query that is hung in planning state, leaves the query in ENQUEUED state for ever.

      Here is the query that is hung in planning state

      0: jdbc:drill:schema=dfs.tmp> select 1 || ',' || 2 || ',' || 3 || ',' || 4 || ',' || 5 || ',' || 6 || ',' || 7 || ',' || 8 || ',' || 9 || ',' || 0 || ',' AS CSV_DATA from (values(1));
      +--+
      |  |
      +--+
      +--+
      No rows selected (304.291 seconds)
      

      Explain plan for that query also just hangs.

      explain plan for select 1 || ',' || 2 || ',' || 3 || ',' || 4 || ',' || 5 || ',' || 6 || ',' || 7 || ',' || 8 || ',' || 9 || ',' || 0 || ',' AS CSV_DATA from (values(1));
      ...
      

      The above issues show the following problems:
      1. Simple query with reasonable number of concat functions hangs.
      In reality query does not hang it just take lots of time to execute. The root cause is that during planning time DrillFuncHolderExpr return type is extensively used to determine matching function, matching type etc. Though this type is retrieved via getter in reality complex logic is executed beaneath it. For example for concat function. Since function return type can not be changes during DrillFuncHolderExpr life time, it is safe to cache it.

      2. No mechanism to cancel query during ENQUEUED state.
      Currently Drill does not have mechanism to cancel query before STARTING / RUNNING states. Plus ENQUEUED state includes two PLANNING and ENQUEUED.
      The following changes were made to address above issues:
      a. two new states were added: PREPARING (when foreman is initialized) and PLANNING (includes logical and / or physical planning).
      b. ability to cancel query during planning and enqueued states was added.

      Attachments

        1. enqueued-2.png
          175 kB
          Khurram Faraaz

        Issue Links

        Activity

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

          People

            arina Arina Ielchiieva
            khfaraaz Khurram Faraaz
            Paul Rogers Paul Rogers
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment