This page explains how to use the array_reverse function in APL.
Use the array_reverse
function in APL to reverse the order of elements in an array. This function is useful when you need to transform data where the sequence matters, such as reversing a list of events for chronological analysis or processing lists in descending order.
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.
array_expression
: The array you want to reverse. This array must be of a dynamic type.Returns the input array with its elements in reverse order.
Use array_reverse
to inspect the sequence of actions in log entries, reversing the order to understand the initial steps of a user’s session.
Query
Output
id | reversed_paths |
---|---|
U1234 | [‘/home’, ‘/cart’, ‘/product’, ’/‘] |
U5678 | [‘/login’, ‘/search’, ’/’] |
This example identifies a user’s navigation sequence in reverse, showing their entry point into the system.
Use array_reverse
to inspect the sequence of actions in log entries, reversing the order to understand the initial steps of a user’s session.
Query
Output
id | reversed_paths |
---|---|
U1234 | [‘/home’, ‘/cart’, ‘/product’, ’/‘] |
U5678 | [‘/login’, ‘/search’, ’/’] |
This example identifies a user’s navigation sequence in reverse, showing their entry point into the system.
Use array_reverse
to analyze trace data by reversing the sequence of span events for each trace, allowing you to trace back the sequence of service calls.
Query
Output
trace_id | reversed_spans |
---|---|
T12345 | [‘S4’, ‘S3’, ‘S2’, ‘S1’] |
T67890 | [‘S7’, ‘S6’, ‘S5’] |
This example reveals the order in which service calls were made in a trace, but in reverse, aiding in backtracking issues.
Apply array_reverse
to examine security events, like login attempts or permission checks, in reverse order to identify unusual access patterns or last actions.
Query
Output
id | reversed_blocked_uris |
---|---|
U1234 | [‘/admin’, ‘/settings’, ‘/login’] |
U5678 | [‘/account’, ‘/dashboard’, ‘/login’] |
This example helps identify the sequence of unauthorized access attempts by each user.