public class SubstringFunction extends Object implements ScalarFunction
Constructor and Description |
---|
SubstringFunction(boolean oneBased,
boolean secondParamIsCharCount)
Creates a
SubstringFunction |
Modifier and Type | Method and Description |
---|---|
static SubstringFunction |
createJavaStyle() |
static SubstringFunction |
createSqlStyle() |
Object |
evaluate(Row row,
Object[] parameters,
SelectItem operandItem)
Applies and evaluates the function on a particular row of data.
|
ColumnType |
getExpectedColumnType(ColumnType type) |
String |
getFunctionName() |
public SubstringFunction(boolean oneBased, boolean secondParamIsCharCount)
SubstringFunction
oneBased
- true if the character index parameters are 1 based, like most SQL SUBSTRING functions (instead of
0 based, like Java).secondParamIsCharCount
- true if the (optional) second parameter is a "character count", like most SQL
SUBSTRING functions (instead of end-index, like Java)public static SubstringFunction createSqlStyle()
public static SubstringFunction createJavaStyle()
public ColumnType getExpectedColumnType(ColumnType type)
getExpectedColumnType
in interface FunctionType
public String getFunctionName()
getFunctionName
in interface FunctionType
public Object evaluate(Row row, Object[] parameters, SelectItem operandItem)
ScalarFunction
evaluate
in interface ScalarFunction
row
- the row containing dataparameters
- any parameters associated with the function calloperandItem
- the select item which is the argument to this function. If a
function takes multiple select items, this will be the primary
one.Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.