All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.treasuredata.client.model.TDTableDistribution Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
package com.treasuredata.client.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Objects;

import java.util.List;

/**
 * TDTableDistribution provides the information about custom partitioning of the table.
 */
public class TDTableDistribution
{
    private final long userTableId;
    private final long bucketCount;
    private final String partitionFunction;
    private final List columns;

    @JsonCreator
    public TDTableDistribution(
            @JsonProperty("user_table_id") long userTableId,
            @JsonProperty("bucket_count") long bucketCount,
            @JsonProperty("partition_function") String partitionFunction,
            @JsonProperty("columns") List columns)
    {
        this.userTableId = userTableId;
        this.bucketCount = bucketCount;
        this.partitionFunction = partitionFunction;
        this.columns = columns;
    }

    @JsonProperty
    public long getUserTableId()
    {
        return userTableId;
    }

    /**
     * The maximum number of buckets of UDP table.
     */
    @JsonProperty
    public long getBucketCount()
    {
        return bucketCount;
    }

    /**
     * Hash function to calculate the partitioning key.
     */
    @JsonProperty
    public String getPartitionFunction()
    {
        return partitionFunction;
    }

    /**
     * Columns used for partitioning key in UDP table
     */
    @JsonProperty
    public List getColumns()
    {
        return columns;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        TDTableDistribution other = (TDTableDistribution) obj;
        return Objects.equal(this.userTableId, other.userTableId) &&
                Objects.equal(this.bucketCount, other.bucketCount) &&
                Objects.equal(this.partitionFunction, other.partitionFunction) &&
                Objects.equal(this.columns, other.columns);
    }

    @Override
    public int hashCode()
    {
        return Objects.hashCode(userTableId, bucketCount, partitionFunction);
    }

    @Override
    public String toString()
    {
        return String.format("userTableId: %s, bucketCount: %s, partitionFunction: %s, columns: %s",
                userTableId, bucketCount, partitionFunction, columns);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy