Skip to content

daft.functions.extract_hour_uuid7#

extract_hour_uuid7 #

extract_hour_uuid7(expr: Expression) -> Expression

Partitioning Transform that extracts the number of hours 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 hours since epoch

Source code in daft/functions/partition.py
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
def extract_hour_uuid7(expr: Expression) -> Expression:
    """Partitioning Transform that extracts the number of hours 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 hours since epoch
    """
    return Expression._call_builtin_scalar_fn("extract_hour_uuid7", expr)