gravitino.api.expressions.sorts.sort_direction.SortDirection

class gravitino.api.expressions.sorts.sort_direction.SortDirection(value)

Bases: Enum

A sort direction used in sorting expressions. Each direction has a default null ordering that is implied if no null ordering is specified explicitly.

__init__(direction: str, default_null_ordering: NullOrdering)

Methods

__init__(direction, default_null_ordering)

direction()

default_null_ordering()

Returns the default null ordering to use if no null ordering is specified explicitly.

from_string(direction)

Returns the SortDirection from the string representation.

Attributes

ASCENDING

Ascending sort direction.

DESCENDING

Descending sort direction.

ASCENDING = ('asc', <NullOrdering.NULLS_FIRST: 'nulls_first'>)

Ascending sort direction. Nulls appear first. For ascending order, this means nulls appear at the beginning.

DESCENDING = ('desc', <NullOrdering.NULLS_LAST: 'nulls_last'>)

Descending sort direction. Nulls appear last. For ascending order, this means nulls appear at the end.

default_null_ordering() NullOrdering

Returns the default null ordering to use if no null ordering is specified explicitly.

Returns:

NullOrdering: The default null ordering.

static from_string(direction: str)

Returns the SortDirection from the string representation.

Args:

direction: The string representation of the sort direction.

Returns:

SortDirection: The corresponding SortDirection.