Fluent-bit: Stream processing: WHERE field IS (NOT) NULL

Created on 20 May 2019  路  8Comments  路  Source: fluent/fluent-bit

Is your feature request related to a problem? Please describe.
It does not seem possible do use a query checking for the existence of a field using sql WHERE IS NOT NULL.
This would be super useful to tag and route to a different ouput depending on the existence of a field created by a parser.

All 8 comments

cc: @koleini

hmm to validate if a key exists we would need a different syntax, for normal case:

  • IS NULL => would mean "key" have a value equal to msgpack null
  • IS NOT NULL => opposite (value != msgpack null)

should we use comething like:

  • WHERE key EXISTS
  • WHERE key NOT EXISTS

ideas ??

As @edsiper mentioned, we need a different syntax to represent the non-existence of a key, since semantically, NULL means the key exists, but doesn't have a value (however, currently, we don't support NULL checking).

I'm now working on checking the existence of the key in WHERE condition, since it is a useful feature to have.

Fixed by #1356, thanks to @koleini you now can use:

SELECT * FROM STREAM:test WHERE key IS NULL;

or

SELECT * FROM STREAM:test WHERE key IS NOT NULL;

further checks if a key exists or not, we are working in a different approach since for our binary records "NULL" is a valid value for a key.

note: code changes in git master, to be available in the next major version.

@edsiper is the EXISTS functionality implemented in master? E.g.

SELECT * FROM STREAM:test WHERE NOT EXISTS key;

@rolandjitsu This feature is in master, but with different syntax (I will update docs today). You can use @record.contains(key) to check the existence of a key. For instance, your query will be:

SELECT * FROM STREAM:test WHERE NOT @record.contains(key);

@koleini I see, thanks. I will try it out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Barbazoo picture Barbazoo  路  3Comments

mhf-ir picture mhf-ir  路  4Comments

tarokkk picture tarokkk  路  3Comments

c0ze picture c0ze  路  3Comments

JavaCS3 picture JavaCS3  路  3Comments