pentaho/pentaho-kettle · error · KettleValueException
Function ASIN only works with numeric data
Error message
Function ASIN only works with numeric data
What it means
The asin() method of Kettle's legacy Value class computes the arc sine of the value. It checks isNumeric() first and throws this KettleValueException when the Value holds a non-numeric type, since Math.asin requires a double argument. This is a runtime type contract enforced by the legacy compatibility Value class.
Solutions
- Convert the Value to a numeric type (setType(VALUE_TYPE_NUMBER) or the step's field-conversion mechanism) before calling asin()
- Correct the upstream input step so the field is declared/read as Number
- Wrap the call in an isNumeric() check and convert or skip non-numeric rows
Example fix
// before
Value result = value.asin();
// after
if (!value.isNumeric()) {
value.setType(Value.VALUE_TYPE_NUMBER);
}
Value result = value.asin(); Defensive patterns
Strategy: type-guard
Validate before calling
if (value == null || !value.isNumeric()) {
throw new IllegalArgumentException("ASIN requires a numeric value, got type " + (value == null ? "null" : value.getType()));
} Type guard
boolean isNumericValue(Value v) { return v != null && v.isNumeric(); } Try / catch
try {
result = value.asin();
} catch (KettleValueException e) {
value.setType(Value.VALUE_TYPE_NUMBER);
result = value.asin();
} Prevention
- Ensure source steps produce Number-typed fields for trigonometric input
- Convert field types explicitly in the stream rather than relying on defaults
- Check isNumeric() before calling any legacy Value math method
- Review transformation metadata after copying between environments
When it happens
Trigger: Calling Value.asin() when the Value type is String, Date, Boolean, etc. - typically a field that was never converted to Number after being read as text.
Common situations: Text-file or spreadsheet inputs producing String-typed columns; formula calculations chained on untyped fields; old transformations copied between environments where the input metadata differs.
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
- Function ACOS only works with numeric data
- Function ATAN only works with numeric data
- Function ATAN2 only works with numbers
- Function CEIL only works with a number
- Function COS only works with a number
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/cf6427397e5eec9b.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/compatibility/Value.java:2396
if ( isNumeric() ) {
setValue( Math.acos( getNumber() ) );
} else {
throw new KettleValueException( "Function ACOS only works with numeric data" );
}
return this;
}
// implement the ASIN function, arguments in args[]
public Value asin() throws KettleValueException {
if ( isNull() ) {
return this;
}
if ( isNumeric() ) {
setValue( Math.asin( getNumber() ) );
} else {
throw new KettleValueException( "Function ASIN only works with numeric data" );
}
return this;
}
// implement the ATAN function, arguments in args[]
public Value atan() throws KettleValueException {
if ( isNull() ) {
return this;
}
if ( isNumeric() ) {
setValue( Math.atan( getNumber() ) );
} else {
throw new KettleValueException( "Function ATAN only works with numeric data" );
}
return this;
}
View on GitHub (pinned to f3058517a1)