Hi community,

Some of our users store JSON/FlatBuffer data in Impala tables. They wish to
perform flexible queries on these data. Common Expression Language (CEL) is
a simple expression language built on top of protocol buffer types. It
would be nice if there are some built-in functions to support query
JSON/FlatBuffer objects with CEL. For example:

   - bigint cel_json_eval_int(string input_json, string cel_expression):
   queries the input_json with cel_expression, returns a bigint type.
   - bigint cel_json_eval_bool(string input_json, string cel_expression):
   queries the input_json with cel_expression, returns a boolean type.
   - string cel_json_eval_string(string input_json, string cel_expression):
   queries the input_json with cel_expression, returns a string type.
   - ...


With the support of these functions and CEL evaluation, users can write the
following query to:

   - SELECT COUNT(*) FROM events WHERE cel_json_eval_bool(products_detail,
   "items.size()>=3") AND event_name = 'SubmitOrder'


The cel_expression can be any value as long as it follows the CEL language
definition (https://github.com/google/cel-spec/blob/master/doc/langdef.md).
As a reference, google has a CEL implementation here:
https://github.com/google/cel-cpp

Best regards,
Jian Zhang.

Reply via email to