You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Elliot West (JIRA)" <ji...@apache.org> on 2018/06/14 11:56:00 UTC

[jira] [Updated] (HIVE-19896) Create view stores invalid, mutated version of original SQL text

     [ https://issues.apache.org/jira/browse/HIVE-19896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Elliot West updated HIVE-19896:
-------------------------------
    Description: 
We perform additional processing on some of our view definitions and we've found that in some cases Hive actually stores malformed representations of the original source SQL text definition of the view. We have examples where the stored original view text is in fact an unparsable statement. This prevents later processing of the view (recompiling for column adjustments for example) and is counter intuitive to the user.

Specifically the failure appears to be focused on the removal of necessary back-tick quoting from the original text on aliases (but possibly other identifiers).
h2. Steps to reproduce (formatted for clarity):
Create a view that is subject to malformation:
{code}
hive> create view v as select * from (select 1) as `a.b`;
OK
{code}

View view definition to obtain original text:
{code}
describe extended v;
...
Detailed Table Information	Table(
  tableName:v,
  dbName:default,
  viewOriginalText:select * from (select 1) as a.b,
  viewExpandedText:select `a.b`.`_c0` from (select 1) as `a.b`,
  tableType:VIRTUAL_VIEW)
{code}
Note that {{viewOriginalText}} value does not equal the text supplied on the first step.

Executing {{viewOriginalText}} value results in failure:
{code}
hive> select * from (select 1) as a.b;
NoViableAltException(17@[215:51: ( KW_AS )?])
	at org.antlr.runtime.DFA.noViableAlt(DFA.java:158)
...
FAILED: ParseException line 1:29 cannot recognize input near 'as' 'a' '.' in subquery source
{code}



  was:
We perform additional processing on some of our view definitions and we've found that in some cases Hive actually stores malformed representations of the original source SQL text definition of the view. We have examples where the stored original view text is in fact an unparsable statement. This prevents later processing of the view (recompiling for column adjustments for example) and is counter intuitive to the user.

Specifically the failure appears to be focused on the removal of necessary back-tick quoting from the original text on aliases (but possibly other identifiers).
h2. Steps to reproduce (formatted for clarity):
Create a view that is subject to malformation:
{code}
hive> create view v as select * from (select 1) as `a.b`;
OK
{code}

View view definition to obtain original text:
{code}
describe extended v;
...
Detailed Table Information	Table(
  tableName:v,
  dbName:default,
  viewOriginalText:select * from (select 1) as a.b,
  viewExpandedText:select `a.b`.`_c0` from (select 1) as `a.b`,
  tableType:VIRTUAL_VIEW)
{code}
Note that {{viewOriginalText}} value does not equal the text supplied on the first step.

Executing {{viewOriginalText}} results in failure:
{code}
hive> select * from (select 1) as a.b;
NoViableAltException(17@[215:51: ( KW_AS )?])
	at org.antlr.runtime.DFA.noViableAlt(DFA.java:158)
...
FAILED: ParseException line 1:29 cannot recognize input near 'as' 'a' '.' in subquery source
{code}




> Create view stores invalid, mutated version of original SQL text
> ----------------------------------------------------------------
>
>                 Key: HIVE-19896
>                 URL: https://issues.apache.org/jira/browse/HIVE-19896
>             Project: Hive
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 1.2.1, 2.3.0
>            Reporter: Elliot West
>            Priority: Major
>
> We perform additional processing on some of our view definitions and we've found that in some cases Hive actually stores malformed representations of the original source SQL text definition of the view. We have examples where the stored original view text is in fact an unparsable statement. This prevents later processing of the view (recompiling for column adjustments for example) and is counter intuitive to the user.
> Specifically the failure appears to be focused on the removal of necessary back-tick quoting from the original text on aliases (but possibly other identifiers).
> h2. Steps to reproduce (formatted for clarity):
> Create a view that is subject to malformation:
> {code}
> hive> create view v as select * from (select 1) as `a.b`;
> OK
> {code}
> View view definition to obtain original text:
> {code}
> describe extended v;
> ...
> Detailed Table Information	Table(
>   tableName:v,
>   dbName:default,
>   viewOriginalText:select * from (select 1) as a.b,
>   viewExpandedText:select `a.b`.`_c0` from (select 1) as `a.b`,
>   tableType:VIRTUAL_VIEW)
> {code}
> Note that {{viewOriginalText}} value does not equal the text supplied on the first step.
> Executing {{viewOriginalText}} value results in failure:
> {code}
> hive> select * from (select 1) as a.b;
> NoViableAltException(17@[215:51: ( KW_AS )?])
> 	at org.antlr.runtime.DFA.noViableAlt(DFA.java:158)
> ...
> FAILED: ParseException line 1:29 cannot recognize input near 'as' 'a' '.' in subquery source
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)