pentaho/pentaho-kettle · error · KettleValueException
Function NUM2DAT only works on a number
Error message
Function NUM2DAT only works on a number
What it means
Guard in the legacy Value num2dat() function: the value is non-null and not numeric (isNumeric() false), so it cannot be interpreted as an epoch millisecond value for Date construction. The input at fault is the current Value of a non-numeric type.
Solutions
- Ensure the field passed to NUM2DAT is an Integer/Number/BigNumber holding epoch milliseconds
- Convert or parse the value to a numeric type before calling NUM2DAT
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at core/src/main/java/org/pentaho/di/compatibility/Value.java:3135 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/b9759df04fb2a565.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/compatibility/Value.java:3135
}
} else {
throw new KettleValueException( "Function DAT2STR only works on a date" );
}
}
return this;
}
// implement the TO_DATE function, arguments in args[]
public Value num2dat() throws KettleValueException {
if ( isNull() ) {
setType( VALUE_TYPE_DATE );
} else {
if ( isNumeric() ) {
setValue( new Date( getInteger() ) );
setLength( -1, -1 );
} else {
throw new KettleValueException( "Function NUM2DAT only works on a number" );
}
}
return this;
}
public Value str2dat( String arg0 ) throws KettleValueException {
return str2dat( arg0, null );
}
public Value str2dat( String arg0, String arg1 ) throws KettleValueException {
if ( isNull() ) {
setType( VALUE_TYPE_DATE );
} else {
// System.out.println("Convert string ["+string+"] to date using pattern '"+arg0+"'");
SimpleDateFormat df = new SimpleDateFormat();
DateFormatSymbols dfs = new DateFormatSymbols();View on GitHub (pinned to f3058517a1)