{"record":{"id":"245db05718d7304e","repo":"pentaho/pentaho-kettle","slug":"sorry-the-partitioning-field-needs-to-contain-a-data-value","errorCode":null,"errorMessage":"Sorry, the partitioning field needs to contain a data value and can't be empty!","messagePattern":"Sorry, the partitioning field needs to contain a data value and can't be empty!","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutput.java","lineNumber":212,"sourceCode":"      // Initialize some stuff!\n      if ( data.indexOfPartitioningField < 0 ) {\n        data.indexOfPartitioningField =\n          rowMeta.indexOfValue( environmentSubstitute( meta.getPartitioningField() ) );\n        if ( data.indexOfPartitioningField < 0 ) {\n          throw new KettleStepException( \"Unable to find field [\"\n            + meta.getPartitioningField() + \"] in the input row!\" );\n        }\n\n        if ( meta.isPartitioningDaily() ) {\n          data.dateFormater = new SimpleDateFormat( \"yyyyMMdd\" );\n        } else {\n          data.dateFormater = new SimpleDateFormat( \"yyyyMM\" );\n        }\n      }\n\n      ValueMetaInterface partitioningValue = rowMeta.getValueMeta( data.indexOfPartitioningField );\n      if ( !partitioningValue.isDate() || r[data.indexOfPartitioningField] == null ) {\n        throw new KettleStepException(\n          \"Sorry, the partitioning field needs to contain a data value and can't be empty!\" );\n      }\n\n      Object partitioningValueData = rowMeta.getDate( r, data.indexOfPartitioningField );\n      tableName =\n        environmentSubstitute( meta.getTableName() )\n          + \"_\" + data.dateFormater.format( (Date) partitioningValueData );\n      insertRowData = r;\n    } else {\n      tableName = data.tableName;\n      insertRowData = r;\n    }\n\n    if ( meta.specifyFields() ) {\n      //\n      // The values to insert are those in the fields sections\n      //\n      insertRowData = new Object[data.valuenrs.length];","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutput.java#L194-L230","documentation":"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.","triggerScenarios":"partitioningValue.isDate() is false (field is String/Integer/Timestamp-not-date) or r[data.indexOfPartitioningField] == null when writeToTable processes a row.","commonSituations":"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.","solutions":["Ensure the partitioning field has a Date data type (add a 'Select values' / type conversion step upstream).","Replace null date values upstream (e.g. 'If field value is null' step or COALESCE logic) before TableOutput.","If the field is a string like '20240101', convert it to a Date with a 'String to date' transformation before this step."],"exampleFix":"// before: partitioning field is String \"20240101\"\n// after: add a 'Select values' step converting the field to java.util.Date before TableOutput","handlingStrategy":"validation","validationCode":"ValueMetaInterface vm = rowMeta.getValueMeta( partitionFieldIndex );\nObject v = r[partitionFieldIndex];\nif ( !vm.isDate() || v == null ) {\n  throw new IllegalArgumentException(\n    \"Partitioning field must be a non-null Date, got \" + vm.getTypeDesc() );\n}","typeGuard":"boolean isUsablePartitionValue =\n  rowMeta.getValueMeta( idx ).isDate() && r[idx] != null;","tryCatchPattern":"try { writeToTable( row ); } catch ( KettleStepException e ) {\n  if ( e.getMessage().contains( \"partitioning field\" ) ) {\n    // route row to error stream or convert field to Date upstream\n  }\n}","preventionTips":["Convert the partitioning field to a Date type explicitly before TableOutput","Null-check/coalesce date columns coming from unreliable sources","Never configure a String-formatted date column as the partitioning field"],"tags":["kettle","table-output","partitioning","null-value","type-mismatch"],"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"}