[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ElasticSearch. Explicit Definitions, Literals and RelBuilder

Hello Calcite Devs,

I have some questions about ES adapter and custom predicates / projections
in Calcite. Your help is much appreciated.

1) All ES examples use a view (ZIPS
which does explicit type cast, name alias and  dictionary access (via _MAP)
for each field. If such view is not defined beforehand, making ad-hoc
queries becomes tedious. Is there a way to make it more user-friendly (eg.
using existing ES mapping) ?

Example: select cast(_MAP['city'] AS varchar(20)) AS \"city\" from ...

Why some adapters require explicit definition (eg. Mongo / ES) while others
don't (eg. Geode)

2) When not using explicit casting (or field alias) query literals are
converted to lower case:

SQL: select * from "elastic" where _MAP['Foo'] = 'BAR' (note upper-case)
ES Query: { "term": { "foo" : "bar" }} (note lower-case)

This is less intuitive. Is there a way to switch it off (customize) ?

3) How to build the following query using Algebra Builder (RelBuilder)

select * from "elastic" where _MAP['Foo'] = 'Bar'

I presume one has to use SqlItemOperator but I couldn't get it to work. Is
this related to (1) and (2) ?