This plugin provides 4 transformations and 1 action that use the power of an expression language.
An expression is a combination of one or more literal values, resolvable identifiers, operators and functions that evaluate to a value.
/** * Multi line comment */ case when REGION_ID<0 then Upper(Left(LABEL,5)) when REGION_ID between 0 and 100 then InitCap(Substr("LABEL FR",8,50)) else To_Char([YEAR]+1,'FM9999') || ' XXX ' end
-
Supports 7 data types:
Boolean
Integer
Number
String
Date
Binary
Json
-
Constant value:
TRUE
,FALSE
,NULL
, 'String', 1234, -45e-2, 0xF0A1, 0b10110111,Date
'2022-04-25',Timestamp
'2022-04-25 05:28:59',Binary
'FA6CB',Json
'{"name":"John"}' -
Logical operators
NOT
AND
OR
-
Arithmetic operators
+
-
*
/
%
-
Bitwise operators
&
|
~
^
-
Comparison operators
>
>=
<
⇐
=
!=
<>
IN
IS TRUE
IS FALSE
IS NULL
IS DISTINCT FROM
BETWEEN
LIKE
ILIKE
SIMILAR TO
-
Concatenate operator
||
-
Conditional operator
CASE WHEN
IF
IFNULL
NULLIF
-
Cast operator
::
orCAST
(<value>AS
<type>FORMAT
<format>) -
Over 200 scalar and aggregate functions (conditional, mathematical, trigonometry, conversion, bitwise…).
-
User Defined Function (UDF) support has metadata
-
Use of comments to facilitate reading
-
Are not case-sensitive, excepted for identifier
-
Can be parenthesized to control the precedence order
-
Optimized immediately after parsing, so the
5+XYZ+4*2+5
is optimized toXYZ+18
and has no impact on performance
Documentation are work in progress.
Use @FunctionPlugin annotation to create custom function in your plugin.
/** * The function compute Levenshtein distance. */ @FunctionPlugin public class Levenshtein extends Function { public Levenshtein() { super("LEVENSHTEIN", true, ReturnTypes.INTEGER, OperandTypes.STRING_STRING, OperatorCategory.STRING, "/docs/levenshtein.html"); } @Override public Object eval(final IExpression[] operands) throws Exception { String str1 = operands[0].getValue(String.class); if (str1 == null) return null; String str2 = operands[1].getValue(String.class); if (str2 == null) return null; return Long.valueOf(StringUtils.getLevenshteinDistance(str1, str2)); } }
Apache Hop 2.2 or above. Web Hop is not supported because expression editor use JFace.
This plugin is provided as is, without any warranties, expressed or implied. This software is not covered by any Support Agreement.
Licensed under the Apache License, Version 2.0.