天天看點

elasticsearch-sql 增加 jdbc支援

大家讨論的時候,提供了兩個選擇,一個是apache calcite, 另外一個是利用 alibaba 的jdbc 連接配接池 druid。最後我選擇了使用druid 來完成。為啥不用第一個的原因如下:

<b>i have tried calcite to add this feature to es-sql. it's proved to be unsuitable. calcite kind like spark datasource api which provide scantable,filtertabe,translatetable which means you cannot access original sql(raw sql) but some expressions . also, this means join ,group by action are all done in calcite which really impact performance .</b>

ps: 該功能還隻是demo階段,很多功能還不完備。等穩定後會合并到原項目中。目前經過幾輪pr,

<a href="https://github.com/nlpchina/elasticsearch-sql/pull/269">https://github.com/nlpchina/elasticsearch-sql/pull/269</a>

<a href="https://github.com/nlpchina/elasticsearch-sql/pull/273">https://github.com/nlpchina/elasticsearch-sql/pull/273</a>

<a href="https://github.com/nlpchina/elasticsearch-sql/pull/271">https://github.com/nlpchina/elasticsearch-sql/pull/271</a>

elasticsearch-sql 已經支援比較複雜的sql文法了。

build jar 包

添加jar包到你的項目即可。

代碼示例