Re: HQL parser internals

2018-04-13 Thread Pengcheng Xiong
Hi Jay, Yes, Hive parser is stripping out the "as". As Gopal explained in the earlier thread, parser is used to translate a SQL string into an AST, i.e., an AST that the compiler can understand. That said, as long as the following compiler knows that "oh, this is a renaming", it is OK. In ano

Re: HQL parser internals

2018-04-13 Thread Furcy Pin
Hi Jay, I noticed the same thing when I did my tool, and it makes sense are syntactically they are both equivalent, so the Hive parser does not care. You could probably update the HiveParser so that it keeps the information in the AST, but not without breaking every part of the code that reads tha

Re: HQL parser internals

2018-04-13 Thread Jay Green-Stevens
Afternoon all, We have successfully managed to build a java tool which will translate a hive query into a syntax tree, and then turn this back into a hive query equivalent to the input. But we have found that for a query such as select a from ( select a from b ) as c the hive parser is strippi