pentaho/pentaho-kettle · error · KettleException

TableCompare.Exception.CompareTableNotSpecified

Error message

TableCompare.Exception.CompareTableNotSpecified

What it means

TableCompare.processRow requires the compare table field to be configured. When meta.getCompareTableField() is empty it throws TableCompare.Exception.CompareTableNotSpecified, as the step needs an input field holding the name of the table to compare against.

Solutions

  1. Set the 'Compare table field' in the step dialog to an existing input field
  2. Map compareTableField during metadata injection
  3. Save the transformation so the setting persists
  4. Preview rows to confirm the field carries non-empty table names

Example fix

// before
meta.setCompareTableField( "" ); // throws
// after
meta.setCompareTableField( "cmp_table" );
Defensive patterns

Strategy: validation

Validate before calling

if ( meta.getCompareTableField() == null || meta.getCompareTableField().isEmpty() ) {
  throw new IllegalArgumentException( "Compare table field must be set on TableCompareMeta" );
}

Type guard

boolean hasCompareTableField( TableCompareMeta m ) {
  return m != null && m.getCompareTableField() != null && !m.getCompareTableField().isEmpty();
}

Try / catch

try {
  trans.execute( null );
} catch ( KettleException e ) {
  if ( e.getMessage().contains( "CompareTableNotSpecified" ) ) {
    logError( "Set the Table Compare compare table field" );
  }
}

Prevention

When it happens

Trigger: processRow executes with 'Compare table field' blank in the step metadata.

Common situations: Step configured programmatically without setCompareTableField, transformation edited in an older dialog that didn't save the value, or metadata injection leaving the key unmapped.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompare.java:114

          .getReferenceTableField() ) );
      }

      // Compare schema
      //
      if ( Utils.isEmpty( meta.getCompareSchemaField() ) ) {
        throw new KettleException( BaseMessages
          .getString( PKG, "TableCompare.Exception.CompareSchemaNotSpecified" ) );
      }
      data.cmpSchemaIndex = getInputRowMeta().indexOfValue( meta.getCompareSchemaField() );
      if ( data.cmpSchemaIndex < 0 ) {
        throw new KettleException( BaseMessages.getString( PKG, "TableCompare.Exception.CanNotFindField", meta
          .getCompareSchemaField() ) );
      }

      // Compare table
      //
      if ( Utils.isEmpty( meta.getCompareTableField() ) ) {
        throw new KettleException( BaseMessages.getString( PKG, "TableCompare.Exception.CompareTableNotSpecified" ) );
      }
      data.cmpTableIndex = getInputRowMeta().indexOfValue( meta.getCompareTableField() );
      if ( data.cmpTableIndex < 0 ) {
        throw new KettleException( BaseMessages.getString( PKG, "TableCompare.Exception.CanNotFindField", meta
          .getCompareTableField() ) );
      }

      // Key fields
      //
      if ( Utils.isEmpty( meta.getKeyFieldsField() ) ) {
        throw new KettleException( BaseMessages.getString( PKG, "TableCompare.Exception.KeyFieldsNotSpecified" ) );
      }
      data.keyFieldsIndex = getInputRowMeta().indexOfValue( meta.getKeyFieldsField() );
      if ( data.keyFieldsIndex < 0 ) {
        throw new KettleException( BaseMessages.getString( PKG, "TableCompare.Exception.CanNotFindField", meta
          .getKeyFieldsField() ) );
      }

View on GitHub (pinned to f3058517a1)