LENGTH function supported data types
The data types supported by the LENGTH function in CDP differ from CDH. The behavioral difference presents a problem when using the absolute value function ABS.
Before Upgrade to CDP
In CDH, the LENGTH function supports double in addition to string, char, varchar or binary. For example, the following query is valid:
After Upgrade to CDP
select length(abs('123.000')); Error: Error while compiling statement: FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments ''123.000'': LENGTH() only takes STRING/CHAR/VARCHAR/BINARY types as first argument ...42000
For more information, see the Generic UDF Length definition.
In CDP, use the workaround shown in the following example:
select length(cast(abs('123.000') as char(10)));