Skip to content

daft.functions.partition_iceberg_bucket#

partition_iceberg_bucket #

partition_iceberg_bucket(expr: Expression, n: int) -> Expression

Partitioning Transform that returns the Hash Bucket following the Iceberg Specification of murmur3_32_x86.

See https://iceberg.apache.org/spec/#appendix-b-32-bit-hash-requirements for more details.

Parameters:

Name Type Description Default
expr Expression

the expression to bucket

required
n int

Number of buckets

required

Returns:

Name Type Description
Expression Expression

Int32 Expression with the Hash Bucket

Source code in daft/functions/partition.py
46
47
48
49
50
51
52
53
54
55
56
57
58
def partition_iceberg_bucket(expr: Expression, n: int) -> Expression:
    """Partitioning Transform that returns the Hash Bucket following the Iceberg Specification of murmur3_32_x86.

    See <https://iceberg.apache.org/spec/#appendix-b-32-bit-hash-requirements> for more details.

    Args:
        expr: the expression to bucket
        n: Number of buckets

    Returns:
        Expression: Int32 Expression with the Hash Bucket
    """
    return Expression._from_pyexpr(expr._expr.partitioning_iceberg_bucket(n))