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

Throw SemanticException when CTE alias is conflicted with table name

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Parser

      Description

      If the alias of CTE is conflicted with the table name, we use the alias fetching the table other than replacing it with the ASTNode tree, this may cause some confusing problems. For example:

      create table game_info (game_name string);
      
      with game_info as (
      select distinct ext_id, dev_app_id, game_name
      from game_info_extend )
      select count(game_name) from game_info;

      The query will return the number of rows of the table game_info, instead of the game_info_extend. Maybe we should better throw an exception to avoid such cases.
       

        Attachments

          Activity

            People

            • Assignee:
              dengzh Zhihua Deng
              Reporter:
              dengzh Zhihua Deng
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h