pentaho/pentaho-kettle · error · KettleDatabaseException

Unable to get value '" + val.toStringMeta() + "' from…

Error message

Unable to get value '" + val.toStringMeta() + "' from database resultset, index " + index

What it means

Vertica5DatabaseMeta.getValueFromResultSet wraps SQLExceptions raised while reading a typed column from a Vertica result set into this KettleDatabaseException, naming the value's metadata representation and the index. Types not handled by this subclass fall back to super.getValueFromResultSet; any SQL error during retrieval triggers this message.

Solutions

  1. Inspect the chained SQLException for the driver-level cause
  2. Align the ValueMeta type with the actual Vertica column type in the query
  3. Verify the index is within the result set's column count and the connection remains valid during iteration

Example fix

// before
ValueMetaInterface vm = new ValueMeta("ts", ValueMetaInterface.TYPE_TIMESTAMP); // mismatched against Vertica column
// after
ValueMetaInterface vm = new ValueMeta("ts", ValueMetaInterface.TYPE_DATE); // type matching the actual Vertica column type
Defensive patterns

Strategy: try-catch

Validate before calling

if (index < 0 || index >= rowMeta.size()) throw new IllegalArgumentException("Value index " + index + " outside row layout of size " + rowMeta.size());

Type guard

function canReadValue(ResultSet rs, int index) { try { return rs != null && index >= 1 && index <= rs.getMetaData().getColumnCount(); } catch (SQLException e) { return false; } }

Try / catch

try {
  Object data = vertica5Meta.getValueFromResultSet(rs, val, index);
} catch (KettleDatabaseException e) {
  SQLException sql = (SQLException) e.getCause(); // driver error: index vs type mismatch
  log.error("Could not read Vertica value " + val.toStringMeta() + " at index " + index + ": " + (sql != null ? sql.getMessage() : e.getMessage()), e);
}

Prevention

When it happens

Trigger: Reading row values from a Vertica result set where rs.getXXX for the declared value type throws SQLException — invalid index, type mismatch (e.g. Vertica-specific types like TIMESTAMP/TIME with scale handled incorrectly), or connection loss.

Common situations: Table input steps over Vertica with unusual column types; schema drift between the ValueMeta and the actual query output; large batches interrupted by network problems.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/6605232ba949f45e. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/Vertica5DatabaseMeta.java:90

        case ValueMetaInterface.TYPE_DATE:
          if ( val.getOriginalColumnType() == java.sql.Types.TIMESTAMP ) {
            data = rs.getTimestamp( index + 1 );
            break; // Timestamp extends java.util.Date
          } else if ( val.getOriginalColumnType() == java.sql.Types.TIME ) {
            data = rs.getTime( index + 1 );
            break;
          } else {
            data = rs.getDate( index + 1 );
            break;
          }
        default:
          return super.getValueFromResultSet( rs, val, index );
      }
      if ( rs.wasNull() ) {
        data = null;
      }
    } catch ( SQLException e ) {
      throw new KettleDatabaseException( "Unable to get value '"
        + val.toStringMeta() + "' from database resultset, index " + index, e );
    }

    return data;
  }
}

View on GitHub (pinned to f3058517a1)