hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Furcy Pin <furcy....@flaminem.com>
Subject Re: Could i use Hive SQL parser in our application?
Date Wed, 18 May 2016 11:11:11 GMT
Hi,


This is feasible.

I already did it in some tool I developed.
Unfortunately I can't open-source it yet, but I can tell you how I dit it.

There is this class in Hive source code

https://github.com/apache/hive/blob/26b5c7b56a4f28ce3eabc0207566cce46b29b558/ql/src/java/org/apache/hadoop/hive/ql/tools/LineageInfo.java

which shows a simple example where the HiveParser is used.

Getting the AST from a query is as simple as.

ParseDriver pd = new ParseDriver();
ASTNode tree = pd.parse(query);

all you have to do next is deal with the AST to do what you want to do, but
that's the where things get complicated.




On Wed, May 18, 2016 at 12:43 PM, Heng Chen <heng.chen.1986@gmail.com>
wrote:

> Hi, guys.
>
>       Recently,  we need to integrate Hive SQL parser in our application.
> Is there any way to do it?
>
> Thanks!
>

Mime
View raw message