pentaho/pentaho-kettle · error · KettleStepException

Sorry, the partitioning field needs to contain a data value…

Error message

Sorry, the partitioning field needs to contain a data value and can't be empty!

What it means

The configured partitioning field was found in the row but its value is not a Date, or is null. Partitioned table naming depends on formatting a date value (daily/monthly), so the step requires a non-null java.util.Date in the partitioning column and rejects anything else.

Solutions

  1. Ensure the partitioning field has a Date data type (add a 'Select values' / type conversion step upstream).
  2. Replace null date values upstream (e.g. 'If field value is null' step or COALESCE logic) before TableOutput.
  3. If the field is a string like '20240101', convert it to a Date with a 'String to date' transformation before this step.

Example fix

// before: partitioning field is String "20240101"
// after: add a 'Select values' step converting the field to java.util.Date before TableOutput
Defensive patterns

Strategy: validation

Validate before calling

ValueMetaInterface vm = rowMeta.getValueMeta( partitionFieldIndex );
Object v = r[partitionFieldIndex];
if ( !vm.isDate() || v == null ) {
  throw new IllegalArgumentException(
    "Partitioning field must be a non-null Date, got " + vm.getTypeDesc() );
}

Type guard

boolean isUsablePartitionValue =
  rowMeta.getValueMeta( idx ).isDate() && r[idx] != null;

Try / catch

try { writeToTable( row ); } catch ( KettleStepException e ) {
  if ( e.getMessage().contains( "partitioning field" ) ) {
    // route row to error stream or convert field to Date upstream
  }
}

Prevention

When it happens

Trigger: partitioningValue.isDate() is false (field is String/Integer/Timestamp-not-date) or r[data.indexOfPartitioningField] == null when writeToTable processes a row.

Common situations: Partitioning field configured as a String date instead of a Date type; upstream step emits null dates (failed parse, missing source value); using a numeric yyyymmdd column as the partitioning field.

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


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutput.java:212

      // Initialize some stuff!
      if ( data.indexOfPartitioningField < 0 ) {
        data.indexOfPartitioningField =
          rowMeta.indexOfValue( environmentSubstitute( meta.getPartitioningField() ) );
        if ( data.indexOfPartitioningField < 0 ) {
          throw new KettleStepException( "Unable to find field ["
            + meta.getPartitioningField() + "] in the input row!" );
        }

        if ( meta.isPartitioningDaily() ) {
          data.dateFormater = new SimpleDateFormat( "yyyyMMdd" );
        } else {
          data.dateFormater = new SimpleDateFormat( "yyyyMM" );
        }
      }

      ValueMetaInterface partitioningValue = rowMeta.getValueMeta( data.indexOfPartitioningField );
      if ( !partitioningValue.isDate() || r[data.indexOfPartitioningField] == null ) {
        throw new KettleStepException(
          "Sorry, the partitioning field needs to contain a data value and can't be empty!" );
      }

      Object partitioningValueData = rowMeta.getDate( r, data.indexOfPartitioningField );
      tableName =
        environmentSubstitute( meta.getTableName() )
          + "_" + data.dateFormater.format( (Date) partitioningValueData );
      insertRowData = r;
    } else {
      tableName = data.tableName;
      insertRowData = r;
    }

    if ( meta.specifyFields() ) {
      //
      // The values to insert are those in the fields sections
      //
      insertRowData = new Object[data.valuenrs.length];

View on GitHub (pinned to f3058517a1)