{"record":{"id":"1076b0d6689ebfba","repo":"pentaho/pentaho-kettle","slug":"get-zero-function-undefined-for-data-type-type-gettype","errorCode":null,"errorMessage":"get zero function undefined for data type: <type.getType()>","messagePattern":"get zero function undefined for data type: <type\\.getType\\(\\)>","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/ValueDataUtil.java","lineNumber":2276,"sourceCode":"    if ( type == null ) {\n      throw new KettleValueException( \"API error. ValueMetaInterface can't be null!\" );\n    }\n\n    switch ( type.getType() ) {\n      case ( ValueMetaInterface.TYPE_INTEGER ) : {\n        return new Long( 0 );\n      }\n      case ( ValueMetaInterface.TYPE_NUMBER ) : {\n        return new Double( 0 );\n      }\n      case ( ValueMetaInterface.TYPE_BIGNUMBER ) : {\n        return new BigDecimal( 0 );\n      }\n      case ( ValueMetaInterface.TYPE_STRING ) : {\n        return \"\";\n      }\n      default : {\n        throw new KettleValueException( \"get zero function undefined for data type: \" + type.getType() );\n      }\n    }\n  }\n}\n","sourceCodeStart":2258,"sourceCodeEnd":2281,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/ValueDataUtil.java#L2258-L2281","documentation":"getZeroForValueMetaType switches over type.getType() and only knows the standard Kettle types (Integer, Number, Date, Boolean, BigNumber, String, etc.). A ValueMetaInterface whose concrete type constant has no case in the switch falls into the default branch and throws this KettleValueException naming the numeric type code.","triggerScenarios":"Calling getZeroForValueMetaType with a ValueMetaInterface of a type the switch doesn't cover — e.g. TYPE_BINARY, TYPE_SERIALIZABLE, TYPE_INET, TYPE_TIMESTAMP on older Pentaho versions where the switch predates the type, or a custom value meta plugin.","commonSituations":"Row contains a Binary/Serializable/Internet-address column and the calling code assumed every column type has a zero; upgrading/downgrading Pentaho versions where the type set changed; custom ValueMeta plugins.","solutions":["Only call the function for supported types; pre-check with a switch/whitelist on type.getType() against ValueMetaInterface constants","Add handling for the specific type yourself (e.g. return null or an empty byte[] for TYPE_BINARY) before calling","If your Pentaho version lacks a case (e.g. TIMESTAMP), upgrade or compute the zero manually","For custom ValueMeta plugins, register/implement zero-value semantics instead of relying on this utility"],"exampleFix":"// before\nObject zero = ValueDataUtil.getZeroForValueMetaType( binaryMeta ); // TYPE_BINARY -> throws\n// after\nint t = binaryMeta.getType();\nObject zero = ( t == ValueMetaInterface.TYPE_BINARY ) ? new byte[0]\n  : ( t == ValueMetaInterface.TYPE_TIMESTAMP ) ? new java.sql.Timestamp( 0 )\n  : ValueDataUtil.getZeroForValueMetaType( binaryMeta );","handlingStrategy":"validation","validationCode":"int t = type.getType();\njava.util.Set<Integer> supported = new HashSet<>( java.util.Arrays.asList(\n  ValueMetaInterface.TYPE_INTEGER, ValueMetaInterface.TYPE_NUMBER, ValueMetaInterface.TYPE_DATE,\n  ValueMetaInterface.TYPE_BOOLEAN, ValueMetaInterface.TYPE_BIGNUMBER, ValueMetaInterface.TYPE_STRING ) );\nif ( !supported.contains( t ) ) throw new IllegalArgumentException( \"No zero defined for type \" + t );","typeGuard":"boolean hasZero( ValueMetaInterface m ) {\n  int t = m.getType();\n  return t == ValueMetaInterface.TYPE_INTEGER || t == ValueMetaInterface.TYPE_NUMBER\n    || t == ValueMetaInterface.TYPE_DATE || t == ValueMetaInterface.TYPE_BOOLEAN\n    || t == ValueMetaInterface.TYPE_BIGNUMBER || t == ValueMetaInterface.TYPE_STRING;\n}","tryCatchPattern":"try {\n  return ValueDataUtil.getZeroForValueMetaType( type );\n} catch ( KettleValueException e ) {\n  if ( e.getMessage() != null && e.getMessage().startsWith( \"get zero function undefined\" ) ) {\n    return null; // binary/serializable/inet etc. have no natural zero\n  }\n  throw e;\n}","preventionTips":["Whitelist supported types before calling; handle Binary/Timestamp/Inet yourself","Check your Pentaho version's switch coverage — newer types may be unsupported","For custom ValueMeta plugins, define zero semantics in the plugin, not via this utility"],"tags":["unsupported-type","kettle","value-meta"],"backgroundTag":"unsupported-enum-value","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"}