This page explains how to use the extend-valid operator in APL.
extend-valid
operator in Axiom Processing Language (APL) allows you to extend a set of fields with new calculated values, where these calculations are based on conditions of validity for each row. It’s particularly useful when working with datasets that contain missing or invalid data, as it enables you to calculate and assign values only when certain conditions are met. This operator helps you keep your data clean by applying calculations to valid data points, and leaving invalid or missing values untouched.
This is a shorthand operator to create a field while also doing basic checking on the validity of the field. In many cases, additional checks are required and it is recommended in those cases a combination of an extend and a where operator are used. The basic checks that Axiom preform depend on the type of the expression:
tobool
and a check for true.extend-valid
to perform conditional transformations on large datasets, especially in scenarios where data quality varies or when dealing with complex log or telemetry data.
Splunk SPL users
eval
function, but with the if
command to handle conditional logic for valid or invalid data. In APL, extend-valid
is more specialized for handling valid data points directly, allowing you to extend fields based on conditions.ANSI SQL users
CASE WHEN
expression within a SELECT
statement to handle conditional logic for fields. In APL, extend-valid
directly extends a field conditionally, based on the validity of the data.FieldName
: The name of the existing field that you want to extend.Expression
: The expression to evaluate and apply for valid rows._time | method | upper_method |
---|---|---|
2023-10-01 12:00:00 | get | GET |
2023-10-01 12:01:00 | POST | POST |
2023-10-01 12:02:00 | NULL | NULL |
toupper
function converts the method
field to uppercase, but only for valid entries. If the method
field is null, the result remains null.