Class StaticArgument
Static arguments are a special case of an input type strategy. While built-in functions often require advanced type inference strategies (taking data type families, common type constraints between arguments, customized validation), many functions are fine with a static signature. Static arguments power these basic use cases.
Static arguments can take tables, models, or scalar values. Each argument takes a set of
StaticArgumentTrait that enable basic validation by the framework.
-
Method Summary
Modifier and TypeMethodDescriptionbooleangetName()inthashCode()booleanis(StaticArgumentTrait trait) booleanstatic StaticArgumentDeclares a scalar argument such asf(12)orf(otherColumn).static StaticArgumenttable(String name, Class<?> conversionClass, boolean isOptional, EnumSet<StaticArgumentTrait> traits) Declares a table argument such asf(t => myTable)orf(t => TABLE myTable)).static StaticArgumenttable(String name, DataType dataType, boolean isOptional, EnumSet<StaticArgumentTrait> traits) Declares a table argument such asf(t => myTable)orf(t => TABLE myTable)).toString()
-
Method Details
-
scalar
Declares a scalar argument such asf(12)orf(otherColumn).- Parameters:
name- name for the assignment operator e.g.f(myArg => 12)dataType- explicit type to which the argument is cast if necessaryisOptional- whether the argument is optional, if optional the corresponding data type must be nullable
-
table
public static StaticArgument table(String name, Class<?> conversionClass, boolean isOptional, EnumSet<StaticArgumentTrait> traits) Declares a table argument such asf(t => myTable)orf(t => TABLE myTable)).The argument can have
StaticArgumentTrait.TABLE_AS_ROW(default) orStaticArgumentTrait.TABLE_AS_SETsemantics.By only providing a conversion class, the argument supports a "polymorphic" behavior. In other words: it accepts tables with an arbitrary number of columns with arbitrary data types. For this case, a class satisfying
RowType.supportsOutputConversion(Class)must be used.- Parameters:
name- name for the assignment operator e.g.f(myArg => 12)conversionClass- a class satisfyingRowType.supportsOutputConversion(Class)isOptional- whether the argument is optionaltraits- set ofStaticArgumentTraitrequiringStaticArgumentTrait.TABLE
-
table
public static StaticArgument table(String name, DataType dataType, boolean isOptional, EnumSet<StaticArgumentTrait> traits) Declares a table argument such asf(t => myTable)orf(t => TABLE myTable)).The argument can have
StaticArgumentTrait.TABLE_AS_ROW(default) orStaticArgumentTrait.TABLE_AS_SETsemantics.By providing a concrete data type, the argument only accepts tables with corresponding number of columns and data types. The data type must be a
RowTypeorStructuredType.- Parameters:
name- name for the assignment operator e.g.f(myArg => 12)dataType- explicit type to which the argument is cast if necessaryisOptional- whether the argument is optional, if optional the corresponding data type must be nullabletraits- set ofStaticArgumentTraitrequiringStaticArgumentTrait.TABLE
-
getName
-
getDataType
-
getConversionClass
-
isOptional
public boolean isOptional() -
getTraits
-
is
-
toString
-
equals
-
hashCode
public int hashCode()
-