hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "RAUNAK JHAWAR (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-9897) Issue a warning when using an existing table/view name as an alias in a with statement.
Date Mon, 09 Mar 2015 17:04:39 GMT

    [ https://issues.apache.org/jira/browse/HIVE-9897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14353208#comment-14353208
] 

RAUNAK JHAWAR commented on HIVE-9897:
-------------------------------------

I did a quick check on Hive on HDP:

Assumption "users" is an existing table in Hive (database: default)

{code:sql}
with users as (select * from products limit 10)select * from users limit 10;
{code}

The effective output is same as that of doing a {code:sql} select * from users limit 10{code}

The products data is not shown as the output neither any warning is issued that there already
is an object by name "users"



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

> ----------------------------------------------------------------------------------------
>
>                 Key: HIVE-9897
>                 URL: https://issues.apache.org/jira/browse/HIVE-9897
>             Project: Hive
>          Issue Type: Improvement
>          Components: Hive
>    Affects Versions: 0.13.1
>         Environment: cdh5.3.0
>            Reporter: Mario Konschake
>            Priority: Minor
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message