Skip to content

Pentaho crashes with heap dump when converting PostgreSQL TEXT to Integer and field length is set to -2 #250

@fcwojtul

Description

@fcwojtul

Environment:

Pentaho CE 10.2

PostgreSQL 16

Spoon transformation using Select Values step

Java version: 23.0.1 2024-10-25

OS: Windows 11

Description:

When performing a transformation in Pentaho that involves converting a field from TEXT (PostgreSQL) to Integer using the Select Values step, if the field's length is left empty in the Meta-data tab, Pentaho internally assigns it a value of -2. This value is visible in the .ktr XML file as:

Integer
-2
-2
This causes a crash and heap dump during transformation preview or execution. In Spoon, this often leads to the Preview window hanging or closing unexpectedly, and in some cases, an OutOfMemoryError is thrown with a heap dump generated by the JVM.

Workaround:

Manually changing the length value in the XML from -2 to either -1 or 0 resolves the issue. The transformation then runs and previews correctly.

Expected Behavior:

Pentaho should either:

Default to length = -1 or 0 when converting to numeric types if the field length is not explicitly provided,

Or validate that values like -2 are not used internally unless they are explicitly handled.

Suggested Fix:

Implement a validation or fallback in the Select Values step (and possibly others) that ensures invalid length values (such as < -1) are caught and corrected before runtime.

Notes:

This appears to be a bug related to how the Kettle engine interprets negative length values, possibly leading to unstable behavior in metadata handling or GUI rendering (SWT). While the issue may originate in the transformation metadata, the runtime behavior leads to instability and memory crashes, which can be difficult to diagnose for end users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions