Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-9897

Issue a warning when using an existing table/view name as an alias in a with statement.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.13.1
    • None
    • Hive
    • None
    • cdh5.3.0

    Description

      Consider the following query:

      WITH
      table_a AS (
          SELECT
              'johndoe' AS name
          FROM
              my_table
      )
      
      SELECT
          DISTINCT name
      FROM
          table_a;
      

      Observation:

      If a table or a view with name `table_a` exists it is used instead of the one defined in the WITH statement.

      Expectation:

      As the expectation is ambiguous (using the alias in the WITH statement vs. using the existing table) issuing a warning when using a existing name in a WITH statement is recommended.

      Attachments

        Issue Links

          Activity

            People

              pxiong Pengcheng Xiong
              infinite_monkey Mario Konschake
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: