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

io.substrait.relation.ConsistentPartitionWindow Maven / Gradle / Ivy

Go to download

Create a well-defined, cross-language specification for data compute operations

There is a newer version: 0.46.1
Show newest version
package io.substrait.relation;

import io.substrait.expression.Expression;
import io.substrait.expression.Expression.SortField;
import io.substrait.expression.FunctionArg;
import io.substrait.expression.FunctionOption;
import io.substrait.expression.WindowBound;
import io.substrait.extension.SimpleExtension;
import io.substrait.type.Type;
import io.substrait.type.TypeCreator;
import java.util.List;
import java.util.stream.Stream;
import org.immutables.value.Value;

@Value.Immutable
@Value.Enclosing
public abstract class ConsistentPartitionWindow extends SingleInputRel implements HasExtension {

  public abstract List getWindowFunctions();

  public abstract List getPartitionExpressions();

  public abstract List getSorts();

  @Override
  protected Type.Struct deriveRecordType() {
    Type.Struct initial = getInput().getRecordType();
    return TypeCreator.of(initial.nullable())
        .struct(
            Stream.concat(
                initial.fields().stream(),
                getWindowFunctions().stream().map(WindowRelFunctionInvocation::outputType)));
  }

  @Override
  public  O accept(RelVisitor visitor) throws E {
    return visitor.visit(this);
  }

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

  @Value.Immutable
  public abstract static class WindowRelFunctionInvocation {

    public abstract SimpleExtension.WindowFunctionVariant declaration();

    public abstract List arguments();

    public abstract List options();

    public abstract Type outputType();

    public abstract Expression.AggregationPhase aggregationPhase();

    public abstract Expression.AggregationInvocation invocation();

    public abstract WindowBound lowerBound();

    public abstract WindowBound upperBound();

    public abstract Expression.WindowBoundsType boundsType();

    public static ImmutableConsistentPartitionWindow.WindowRelFunctionInvocation.Builder builder() {
      return ImmutableConsistentPartitionWindow.WindowRelFunctionInvocation.builder();
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy