stupidb.functions.navigation

Navigation and simple window function interface and implementation.

Classes

First(inputs1)

FirstLast(inputs1)

Base class for first and last navigation functions.

Lag(inputs, offsets, defaults)

Last(inputs1)

Lead(inputs, offsets, defaults)

LeadLag(inputs, offsets, defaults)

Base class for shifting operations.

Nth(inputs1, inputs2)

Compute the nth row in a window frame.

class stupidb.functions.navigation.First(inputs1)[source]
class stupidb.functions.navigation.FirstLast(inputs1)[source]

Base class for first and last navigation functions.

The difference between first and last is where the search for non NULL values starts.

This aggregation keeps a cache of computed aggregations keyed by the begin and end of the range it’s been queried over.

execute(begin, end)[source]

Execute the aggregation over the range from begin to end.

class stupidb.functions.navigation.Lag(inputs, offsets, defaults)[source]
offset_operation(b, /)

Same as a - b.

class stupidb.functions.navigation.Last(inputs1)[source]
class stupidb.functions.navigation.Lead(inputs, offsets, defaults)[source]
offset_operation(b, /)

Same as a + b.

class stupidb.functions.navigation.LeadLag(inputs, offsets, defaults)[source]

Base class for shifting operations.

This class tracks the index of the current row that is being computed.

execute(begin, end)[source]

Compute the value of the navigation function lead or lag.

Notes

begin and end are ignored in lead/lag, by definition.

class stupidb.functions.navigation.Nth(inputs1, inputs2)[source]

Compute the nth row in a window frame.

execute(begin, end)[source]

Execute the aggregation over the range from begin to end.

Modules

stupidb.functions.navigation.core