Hi, guys. I write one example as @furcy said like this.
public static void main(String[] args) throws SemanticException, ParseException, IOException { String sql = "select * from table1 where a > 100"; Context context = new Context(new HiveConf()); ParseDriver pd = new ParseDriver(); ASTNode tree = pd.parse(sql, context); System.out.println(tree); } When i run it, exception thrown out, did i miss something? Exception in thread "main" java.lang.NullPointerException: Conf non-local session path expected to be non-null at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204) at org.apache.hadoop.hive.ql.session.SessionState.getHDFSSessionPath(SessionState.java:669) at org.apache.hadoop.hive.ql.Context.<init>(Context.java:133) at org.apache.hadoop.hive.ql.Context.<init>(Context.java:120) at com.fenbi.pipe.utils.LineageInfoUtils.main(LineageInfoUtils.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) 2016-05-19 10:20 GMT+08:00 Heng Chen <heng.chen.1...@gmail.com>: > Thanks guys! Let me try it firstly. > > 2016-05-19 1:44 GMT+08:00 Pengcheng Xiong <pxi...@apache.org>: > >> Hi Heng, >> >> Sure you can. Hive SQL parser is based on ANTLR and you can do that >> by taking that part out of Hive and integrate in to your application. >> Please let me know if you need any further help. Thanks. >> >> Best >> Pengcheng Xiong >> >> On Wed, May 18, 2016 at 3:43 AM, Heng Chen <heng.chen.1...@gmail.com> >> wrote: >> >>> Hi, guys. >>> >>> Recently, we need to integrate Hive SQL parser in our >>> application. Is there any way to do it? >>> >>> Thanks! >>> >> >> >