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

io.deephaven.engine.table.impl.by.rollup.NullColumns Maven / Gradle / Ivy

There is a newer version: 0.37.1
Show newest version
/**
 * Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
 */
package io.deephaven.engine.table.impl.by.rollup;

import io.deephaven.annotations.BuildableStyle;
import org.immutables.value.Value;

import java.util.Map;

/**
 * {@link RollupAggregation} that allows columns to be nulled-out at higher aggregation levels.
 */
@Value.Immutable
@BuildableStyle
public abstract class NullColumns extends RollupAggregationBase {

    public static NullColumns of(String name, Class type) {
        return builder().putResultColumns(name, type).build();
    }

    public static NullColumns from(Map> resultColumns) {
        return builder().putAllResultColumns(resultColumns).build();
    }

    public static Builder builder() {
        return ImmutableNullColumns.builder();
    }

    public abstract Map> resultColumns();

    @Override
    public final  V walk(V visitor) {
        visitor.visit(this);
        return visitor;
    }

    @Value.Check
    final void checkNonEmpty() {
        if (resultColumns().isEmpty()) {
            throw new IllegalArgumentException(
                    String.format("%s should have at least one result column", NullColumns.class));
        }
    }

    public interface Builder {
        Builder putResultColumns(String name, Class type);

        Builder putAllResultColumns(Map> resultColumns);

        NullColumns build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy