Summary
Extend ex-mode (:) with expression support for complex filters and computed columns, enabling queries like latency > 500 && status != 200.
Problem
Current filtering is regex-based on a single column at a time. There's no way to express compound conditions (e.g. "show rows where latency > 500 AND status is not 200") or create computed columns (e.g. "response_time / 1000").
Features
- Expression-based filtering:
:filter latency > 500 && status != 200
- Computed columns:
:add-column duration_s = latency / 1000
- Support basic arithmetic, comparison, and logical operators
- String functions (contains, startswith, len, upper/lower)
- Access columns by name in expressions
Technical Considerations
- Keep the expression language simple — this is not SQL or Python, it's a lightweight DSL
- Could use Python's
ast.literal_eval or a simple expression parser
- Should integrate with the existing ex-mode command system
- Alternatively, consider a subset of Python expressions (like VisiData) or SQL WHERE clauses (like lnav)
Related
- Inspired by lnav's SQLite queries and VisiData's Python expressions
- Complements existing regex-based filtering (
f, F, e, E)
Summary
Extend ex-mode (
:) with expression support for complex filters and computed columns, enabling queries likelatency > 500 && status != 200.Problem
Current filtering is regex-based on a single column at a time. There's no way to express compound conditions (e.g. "show rows where latency > 500 AND status is not 200") or create computed columns (e.g. "response_time / 1000").
Features
:filter latency > 500 && status != 200:add-column duration_s = latency / 1000Technical Considerations
ast.literal_evalor a simple expression parserRelated
f,F,e,E)