Skip to content

lib/logstorage: add coalesce pipe, update documentation#904

Open
warkadiusz wants to merge 3 commits intoVictoriaMetrics:masterfrom
warkadiusz:add-coalesce-pipe
Open

lib/logstorage: add coalesce pipe, update documentation#904
warkadiusz wants to merge 3 commits intoVictoriaMetrics:masterfrom
warkadiusz:add-coalesce-pipe

Conversation

@warkadiusz
Copy link

Describe Your Changes

Implements the coalesce pipe for LogsQL, which returns the first non-empty value from a list of fields.

  • Added coalesce implementation and tests
  • Updated LogsQL documentation and examples

Fixes #690

Example usage:

  • Return new field
    * | coalesce (user_id, username, email) as user 
  • Return new field with default:
    * | coalesce (user_id, username, email) as user default "anonymous" 
  • Overwrite existing field with the first non-empty value:
    * | coalesce (user_id, username, email) as user_id 

Looking forward to your feedback and happy to make any changes needed.

Checklist

The following checks are mandatory:

`coalesce` pipe returns the first non-empty value from the specified list of fields in order, writing the result as `result_field`. If all source fields are empty, the optional `default` value is used. Fixes VictoriaMetrics#690
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant