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

io.substrait.expression.EnumArg 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.expression;

import io.substrait.extension.SimpleExtension;
import java.util.Optional;
import org.immutables.value.Value;

/**
 * Captures the {@link SimpleExtension.EnumArgument} option value in a {@link
 * SimpleExtension.Function} invocation.
 *
 * @see io.substrait.expression.Expression.ScalarFunctionInvocation
 * @see AggregateFunctionInvocation
 */
@Value.Immutable
public interface EnumArg extends FunctionArg {
  Optional value();

  @Override
  default  R accept(
      SimpleExtension.Function fnDef, int argIdx, FuncArgVisitor fnArgVisitor) throws E {
    return fnArgVisitor.visitEnumArg(fnDef, argIdx, this);
  }

  static EnumArg of(SimpleExtension.EnumArgument enumArg, String option) {
    assert (enumArg.options().contains(option));
    return ImmutableEnumArg.builder().value(Optional.of(option)).build();
  }

  EnumArg UNSPECIFIED_ENUM_ARG = ImmutableEnumArg.builder().value(Optional.empty()).build();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy