Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access the Impala Parser

Tags:

impala

Does Impala reuse hive SQL parser?

I am trying to write a custom Java code to check for query correctness in my application. I am searching for an api which can consume the sql query and let me know if it is grammatically correct for impala.

How can I access the parser from a custom Java code to check for query compatibility?

like image 658
rshetye Avatar asked Oct 14 '25 10:10

rshetye


1 Answers

No, Impala does not reuse the Hive parser. Further, Impala does not expose a Java API for checking if a query is grammatically correct. The easiest thing to do is probably to submit an explain query via JDBC and check the result.

If you don't have a running Impala cluster, in theory you should be able to instantiate the scanner and parser as Impala does in the parser unit tests, but I can imagine it might be difficult to get that working as the Impala build/test environment is quite complicated. Note that this is not a supported API.

like image 59
Matt Avatar answered Oct 18 '25 10:10

Matt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!