{"record":{"id":"2c766a69bf7a3d3b","repo":"pentaho/pentaho-kettle","slug":"unable-to-compare-with-value","errorCode":null,"errorMessage":" : Unable to compare with value []","messagePattern":" : Unable to compare with value \\[\\]","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java","lineNumber":3848,"sourceCode":"                throw new KettleValueException( meta2.toStringMeta() + \" : Unknown storage type : \"\n                    + meta2.getStorageType() );\n\n            }\n          default:\n            throw new KettleValueException( toStringMeta() + \" : Unknown storage type : \" + getStorageType() );\n        }\n      } else if ( ValueMetaInterface.TYPE_INTEGER == getType() && ValueMetaInterface.TYPE_NUMBER == meta2.getType() ) {\n        // BACKLOG-18738\n        // compare Double to Integer\n        return -meta2.compare( data2, meta2.convertData( this, data1 ) );\n      }\n\n      // If the data types are not the same, the first one is the driver...\n      // The second data type is converted to the first one.\n      //\n      return compare( data1, convertData( meta2, data2 ) );\n    } catch ( Exception e ) {\n      throw new KettleValueException(\n          toStringMeta() + \" : Unable to compare with value [\" + meta2.toStringMeta() + \"]\", e );\n    }\n  }\n\n  /**\n   * Convert the specified data to the data type specified in this object.\n   *\n   * @param meta2\n   *          the metadata of the object to be converted\n   * @param data2\n   *          the data of the object to be converted\n   * @return the object in the data type of this value metadata object\n   * @throws KettleValueException\n   *           in case there is a data conversion error\n   */\n  @Override\n  public Object convertData( ValueMetaInterface meta2, Object data2 ) throws KettleValueException {\n    switch ( getType() ) {","sourceCodeStart":3830,"sourceCodeEnd":3866,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java#L3830-L3866","documentation":"ValueMetaBase.compare(data1, meta2, data2) wraps its whole body in try/catch(Exception); any failure — conversion errors, the unknown-storage-type throws above, NumberFormatException during type conversion — is rethrown as this KettleValueException with both value metas named and the original exception chained as the cause. It is a generic wrapper meaning 'comparison failed while converting/normalizing the two values'.","triggerScenarios":"Any exception inside compare(data1, meta2, data2): convertData() failing on non-numeric strings, null meta2, unknown storage types, or incompatible data objects passed for conversion between the two value metas.","commonSituations":"Sort/Merge Join steps hitting rows whose string values cannot be parsed into the driver field's type; comparing fields with mismatched formats (e.g. '1,234.56' vs '1234.56'); downstream of errors 493-495 which get wrapped by this message; locale/format differences from files loaded with wrong masks.","solutions":["Inspect the chained cause (e.getCause()) to find the real failure and fix the underlying conversion or metadata issue.","Ensure both fields' types/formats are compatible before comparison; use a Select Values step to convert types explicitly.","Correct null or invalid meta2/storage types (see errors 493-495) so the wrapper is not triggered.","Set proper conversion masks (setConversionMask) on string metadata so numeric/date parsing succeeds."],"exampleFix":"// before\nint cmp = driverMeta.compare(data1, meta2, data2); // wraps any conversion failure\n\n// after\ntry {\n  int cmp = driverMeta.compare(data1, meta2, data2);\n} catch (KettleValueException e) {\n  logger.logError(\"compare failed: \" + e.getCause()); // diagnose real cause\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (!meta1.getTypeDesc().equals(meta2.getTypeDesc())) {\n  data2 = meta1.convertData(meta2, data2); // convert explicitly, surfacing errors early\n}","typeGuard":null,"tryCatchPattern":"try {\n  cmp = meta1.compare(data1, meta2, data2);\n} catch (KettleValueException e) {\n  Throwable cause = e.getCause();\n  logger.logError(\"compare \" + meta1.toStringMeta() + \" vs \" + meta2.toStringMeta() + \" failed: \"\n      + (cause != null ? cause.toString() : e.getMessage()));\n  throw e;\n}","preventionTips":["Always inspect getCause() — this message wraps a deeper conversion failure.","Normalize field types and conversion masks upstream (Select Values).","Test comparisons against representative data with locale-specific formats.","Fix null/invalid metadata (see meta2-null and storage-type errors) before sorting."],"tags":["pdi","kettle","comparison","conversion"],"backgroundTag":"type-mismatch","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}