Skip to content

[FEATURE] Add mvcombine command in PPL #4766

@srikanthpadakanti

Description

@srikanthpadakanti

Proposal — Command syntax, options, and precise semantics

Command
mvcombine <field> [delim="<string>"]

Arguments

field (required)

The name of the field whose values will be combined.

  • Must be a direct field reference.
  • Must be a single-valued (scalar) field.
  • If the field does not exist in the current schema, the command fails.

delim (optional)

Defines the delimiter to be used when rendering a single-value representation of the combined field.

  • Default: a single space (" "), consistent with Splunk.
  • Ignored unless nomv is implemented and used.
  • Present for syntax compatibility with Splunk and forward extensibility.

Precise semantics

mvcombine operates on the current result set produced by the pipeline.

Grouping rules

Rows are grouped where all fields except <field> have identical values.

  • Grouping is not limited to adjacent rows.
  • All rows in the current result set are considered.

For each group

  • All non-target fields are preserved as group keys.
  • <field> becomes a multivalue field containing the combined values from the group.

Value inclusion

  • Rows where the target field is missing or null do not contribute a value to the combined output.
  • Rows that differ only by the target field are collapsed into a single output row.

Ordering

  • Value order in the multivalue field follows the input stream order at the point where mvcombine executes.
  • If deterministic ordering is required, users must apply sort before mvcombine.

Error handling

The command fails with an error if:

  • The target field does not exist in the current schema.
  • The target is not a direct field reference.
  • The target field is already a multivalue (array) type.

Examples

  1. Basic
    Input:
    | user | action | id |
    | joe | login | 1 |
    | joe | login | 2 |
    | joe | logout | 3 |

Query:
... | mvcombine id

Output:
| user | action | id |
| joe | login | [1,2] |
| joe | logout | [3] |

  1. Non-consecutive
    Input:
    | user | action | id |
    | joe | login | 1 |
    | sam | login | 5 |
    | joe | login | 2 |

Query:
... | mvcombine id

Output:
| user | action | id |
| joe | login | [1,2] |
| sam | login | [5] |

  1. Missing target field
    Input:
    | user | action | id |
    | joe | login | 1 |
    | joe | login | |
    | joe | login | 2 |

Query:
... | mvcombine id

Output:
| user | action | id |
| joe | login | [1,2] |

Rows missing the target field do not contribute values.


Metadata

Metadata

Labels

PPLPiped processing languageenhancementNew feature or request

Type

No type

Projects

Status

Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions