Skip to content

daft.functions.extract_day_uuid7#

extract_day_uuid7 #

extract_day_uuid7(expr: Expression) -> Expression

Partitioning Transform that extracts the number of days since epoch (1970-01-01) from a UUIDv7.

A UUIDv7 embeds a 48-bit Unix-millisecond timestamp in its first 6 bytes. The input must be a Uuid or a FixedSizeBinary of 16 bytes (128 bits).

Parameters:

Name Type Description Default
expr Expression

a Uuid or FixedSizeBinary(16) expression of UUIDv7 values

required

Returns:

Name Type Description
Expression Expression

Int64 Expression with the number of days since epoch

Source code in daft/functions/partition.py
106
107
108
109
110
111
112
113
114
115
116
117
118
def extract_day_uuid7(expr: Expression) -> Expression:
    """Partitioning Transform that extracts the number of days since epoch (1970-01-01) from a UUIDv7.

    A UUIDv7 embeds a 48-bit Unix-millisecond timestamp in its first 6 bytes. The input must be a
    Uuid or a FixedSizeBinary of 16 bytes (128 bits).

    Args:
        expr: a Uuid or FixedSizeBinary(16) expression of UUIDv7 values

    Returns:
        Expression: Int64 Expression with the number of days since epoch
    """
    return Expression._call_builtin_scalar_fn("extract_day_uuid7", expr)