gravitino.dto.stats.statistic_dto.StatisticDTO

class gravitino.dto.stats.statistic_dto.StatisticDTO(_name: str, _reserved: bool, _modifiable: bool, _audit: AuditDTO, _value: StatisticValue[Any] | None = None)

Bases: Statistic, DataClassJsonMixin

Data transfer object representing a statistic.

__init__(_name: str, _reserved: bool, _modifiable: bool, _audit: AuditDTO, _value: StatisticValue[Any] | None = None) None

Methods

__init__(_name, _reserved, _modifiable, _audit)

audit_info()

from_dict(kvs, *[, infer_missing])

from_json(s, *[, parse_float, parse_int, ...])

modifiable()

Whether the statistic is modifiable.

name()

Get the name of the statistic.

reserved()

The statistic is predefined by Gravitino if the value is true.

schema(*[, infer_missing, only, exclude, ...])

to_dict([encode_json])

to_json(*[, skipkeys, ensure_ascii, ...])

validate()

Validates the StatisticDTO.

value()

Get the value of the statistic.

Attributes

CUSTOM_PREFIX

The prefix for custom statistics.

dataclass_json_config

CUSTOM_PREFIX: Final[str] = 'custom-'

The prefix for custom statistics. Custom statistics are user-defined statistics.

modifiable() bool

Whether the statistic is modifiable.

Returns:

bool: If the statistic is modifiable, return True, otherwise False.

name() str

Get the name of the statistic.

Returns:

str: the name of the statistic

reserved() bool

The statistic is predefined by Gravitino if the value is true.

The statistic is defined by users if the value is false. For example, the statistic “row_count” is a reserved statistic. A custom statistic name must start with “custom-” prefix to avoid name conflict with reserved statistics, because Gravitino may add more reserved statistics in the future.

Returns:

bool: The type of the statistic. True if the statistic is reserved, False otherwise

validate() None

Validates the StatisticDTO.

Raises:

IllegalArgumentException: If any of the required fields are invalid.

value() StatisticValue[Any] | None

Get the value of the statistic.

The value is optional. If the statistic is not set, this method returns None.

Returns:
StatisticValue[Any] | None:

The statistic value, or None if it is unset.