pentaho/pentaho-kettle · error · KettleValueException
The 'combination2' function only works on numeric data
Error message
The 'combination2' function only works on numeric data
What it means
The 'combination2' helper computes SQRT(A*A + B*B) and handles only numeric value types (Number, Integer, BigNumber). Any other metadata type for A reaches the default branch and throws this KettleValueException. It exists because hypotenuse-style math is only defined on numeric data.
Solutions
- Ensure fields A and B are typed Number/Integer/BigNumber in the Calculator step (fix metadata in a preceding Select Values step).
- Convert string inputs to numbers before the Calculator step.
- Wrap the calculation in a UDJC/UDJE step that validates ValueMetaInterface.getType() first.
Example fix
// before: Calculator combination2 fed fieldA as String // after: Select Values step: fieldA -> Type: Number; then combination2(A=fieldA, B=fieldB)
Defensive patterns
Strategy: type-guard
Validate before calling
if (!isNumericMeta(metaA) || !isNumericMeta(metaB)) {
throw new KettleValueException("combination2 (SQRT(A*A+B*B)) requires numeric A and B");
} Type guard
public static boolean isNumericMeta(ValueMetaInterface m) {
int t = m.getType();
return t == ValueMetaInterface.TYPE_NUMBER || t == ValueMetaInterface.TYPE_INTEGER || t == ValueMetaInterface.TYPE_BIGNUMBER;
} Try / catch
try {
result = ValueDataUtil.combination2(metaA, dataA, metaB, dataB);
} catch (KettleValueException e) {
logError("combination2 requires numeric fields: " + e.getMessage());
result = null; // or send row to error stream
} Prevention
- Enforce numeric types on fields used in geometric/distance-style calculations.
- Add a 'Filter rows' or validation step that drops non-numeric rows before arithmetic.
- Keep field type definitions in one transformation location to avoid drift.
When it happens
Trigger: Calling ValueDataUtil.combination2 (Calculator type 'SQRT( A*A + B*B )') where metaA.getType() is not TYPE_NUMBER, TYPE_INTEGER, or TYPE_BIGNUMBER — e.g. String or Date input fields.
Common situations: Calculator step receiving string fields from a text file input without conversion; upstream step changed a field's type; user connected a timestamp field into the combination2 calculation.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- The 'abs' function only works on numeric data
- The 'ceil' function only works on numeric data
- The 'combination1' function only works on numeric data
- The 'floor' function only works on numeric data
- The 'remainder' function only works on numeric data
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/1a0e350d97929ce1.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/row/ValueDataUtil.java:1178
switch ( metaA.getType() ) {
case ValueMetaInterface.TYPE_NUMBER:
return new Double( Math.sqrt( metaA.getNumber( dataA ).doubleValue()
* metaA.getNumber( dataA ).doubleValue() + metaB.getNumber( dataB ).doubleValue()
* metaB.getNumber( dataB ).doubleValue() ) );
case ValueMetaInterface.TYPE_INTEGER:
return new Long( Math.round( Math.sqrt( metaA.getInteger( dataA ).longValue()
* metaA.getInteger( dataA ).longValue() + metaB.getInteger( dataB ).longValue()
* metaB.getInteger( dataB ).longValue() ) ) );
case ValueMetaInterface.TYPE_BIGNUMBER:
return BigDecimal.valueOf( Math.sqrt( metaA.getNumber( dataA ).doubleValue()
* metaA.getNumber( dataA ).doubleValue() + metaB.getNumber( dataB ).doubleValue()
* metaB.getNumber( dataB ).doubleValue() ) );
default:
throw new KettleValueException( "The 'combination2' function only works on numeric data" );
}
}
/**
* Rounding with no decimal places (using default rounding method ROUND_HALF_CEILING)
*
* @param metaA
* Metadata of value to round
* @param dataA
* Value to round
* @return The rounded value
* @throws KettleValueException
*/
public static Object round( ValueMetaInterface metaA, Object dataA ) throws KettleValueException {
if ( dataA == null ) {
return null;
}
View on GitHub (pinned to f3058517a1)