pentaho/pentaho-kettle · error · KettleException

TableCompare.Exception.CompareSchemaNotSpecified

Error message

TableCompare.Exception.CompareSchemaNotSpecified

What it means

TableCompare.processRow requires the compare schema field to be configured. An empty meta.getCompareSchemaField() causes TableCompare.Exception.CompareSchemaNotSpecified, since the step needs an input field supplying the schema of the comparison table.

Solutions

  1. Set the 'Compare schema field' in the step dialog to an input field name
  2. Map compareSchemaField during metadata injection
  3. Save the transformation to persist the setting
  4. Validate both sides (reference and compare) are fully configured before running

Example fix

// before
meta.setCompareSchemaField( null ); // throws
// after
meta.setCompareSchemaField( "cmp_schema" );
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

boolean hasCompareSchemaField( TableCompareMeta m ) {
  return m != null && m.getCompareSchemaField() != null && !m.getCompareSchemaField().isEmpty();
}

Try / catch

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

Prevention

When it happens

Trigger: processRow runs with 'Compare schema field' blank in the step settings.

Common situations: Programmatic construction without setCompareSchemaField, partially filled dialog (reference side set, compare side forgotten), or incomplete metadata injection mapping.

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/7688b1f95cb2c391. Report an issue: GitHub.

Appendix: source

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

          .getReferenceSchemaField() ) );
      }

      // Reference table
      //
      if ( Utils.isEmpty( meta.getReferenceTableField() ) ) {
        throw new KettleException( BaseMessages.getString(
          PKG, "TableCompare.Exception.ReferenceTableNotSpecified" ) );
      }
      data.refTableIndex = getInputRowMeta().indexOfValue( meta.getReferenceTableField() );
      if ( data.refTableIndex < 0 ) {
        throw new KettleException( BaseMessages.getString( PKG, "TableCompare.Exception.CanNotFindField", meta
          .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() ) );
      }

View on GitHub (pinned to f3058517a1)