{"record":{"id":"5f6fb5b0dc66c359","repo":"pentaho/pentaho-kettle","slug":"mondrianinputerrorunhandledtype","errorCode":"MondrianInputErrorUnhandledType","errorMessage":"MondrianInputErrorUnhandledType","messagePattern":"MondrianInputErrorUnhandledType","errorType":"exception","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"plugins/mondrianinput/impl/src/main/java/org/pentaho/di/trans/steps/mondrianinput/MondrianHelper.java","lineNumber":302,"sourceCode":"            valueMeta = new ValueMetaInteger( valueName );\n            valueData = Long.valueOf( ( (Integer) valueData ).longValue() );\n          } else if ( valueData instanceof Short ) {\n            valueMeta = new ValueMetaInteger( valueName );\n            valueData = Long.valueOf( ( (Short) valueData ).longValue() );\n          } else if ( valueData instanceof Byte ) {\n            valueMeta = new ValueMetaInteger( valueName );\n            valueData = Long.valueOf( ( (Byte) valueData ).longValue() );\n          } else if ( valueData instanceof Long ) {\n            valueMeta = new ValueMetaInteger( valueName );\n          } else if ( valueData instanceof Double ) {\n            valueMeta = new ValueMetaNumber( valueName );\n          } else if ( valueData instanceof Float ) {\n            valueMeta = new ValueMetaNumber( valueName );\n            valueData = Double.valueOf( ( (Float) valueData ).doubleValue() );\n          } else if ( valueData instanceof BigDecimal ) {\n            valueMeta = new ValueMetaBigNumber( valueName );\n          } else {\n            throw new KettleDatabaseException( BaseMessages.getString( PKG, \"MondrianInputErrorUnhandledType\", valueData.getClass().toString() ) );\n          }\n\n          valueMetaHash.put( c, valueMeta );\n        }\n\n        if ( valueMetaHash.size() == columnCount ) {\n          break; // we're done\n        }\n      }\n\n      // Build the list of valueMetas\n      List<ValueMetaInterface> valueMetaList = new ArrayList<>();\n\n      for ( int c = 0; c < columnCount; c++ ) {\n        if ( valueMetaHash.containsKey( new Integer( c ) ) ) {\n          valueMetaList.add( valueMetaHash.get( new Integer( c ) ) );\n        } else {\n          // If the entire column is null, assume the missing data as String.","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/mondrianinput/impl/src/main/java/org/pentaho/di/trans/steps/mondrianinput/MondrianHelper.java#L284-L320","documentation":"MondrianHelper.createRectangularOutput builds a row layout from an MDX result cell; when a cell value's Java type is not one of the explicitly supported types (String, Number, Date, Boolean, Float, BigDecimal), it throws this KettleDatabaseException. The message embeds valueData.getClass().toString() so the developer can see which type leaked from the Mondrian/olap4j layer. It exists because Kettle ValueMeta types must map 1:1 to concrete Java classes.","triggerScenarios":"An MDX query returns a cell whose runtime value class is unexpected (e.g. a Mondrian-specific measure wrapper or a custom calculated-member type) and createRectangularOutput's if/else chain falls through to the final else. Invoked from MondrianInputMeta.getFields during layout computation/preview.","commonSituations":"Calculated members or measures returning exotic objects; Mondrian/olap4j version changes altering returned value classes; schema changes introducing typed measures whose values box differently.","solutions":["Log valueData.getClass() to identify the unhandled type and add/verify it is one of String, Number, Date, Boolean, Float, BigDecimal in the MDX result","Cast or format the measure in the MDX query (CStr/CVal/Format) so it returns a supported type","Adjust the Mondrian schema measure type attribute (e.g. to Numeric/String) so cell values map to supported classes","Align the Mondrian/olap4j driver versions with the PDI plugin version"],"exampleFix":"// before\nWITH MEMBER [Measures].Custom AS [Measures].Sales / [Measures].Count\n// after (force a supported return type)\nWITH MEMBER [Measures].Custom AS Format( [Measures].Sales / [Measures].Count, \"#,##0.00\" )","handlingStrategy":"try-catch","validationCode":"// Before configuring the step, probe the MDX result and inspect cell value classes\nResultSet rs = /* execute MDX via olap4j */;\nfor (int c = 1; c <= rs.getMetaData().getColumnCount(); c++) {\n  Object v = rs.getObject(c);\n  if (v != null && !(v instanceof String || v instanceof Number\n      || v instanceof java.util.Date || v instanceof Boolean)) {\n    throw new IllegalStateException(\"Unhandled cell type at col \" + c + \": \" + v.getClass());\n  }\n}","typeGuard":"boolean isSupportedCellValue(Object v) {\n  return v == null || v instanceof String || v instanceof Number\n      || v instanceof java.util.Date || v instanceof Boolean;\n}","tryCatchPattern":"try {\n  meta.getFields(rowMeta, origin, null, null, transMeta, metaStore);\n} catch (KettleStepException e) {\n  // nested KettleDatabaseException message names the offending class\n  logError(\"MDX cell type unhandled: \" + e.getCause().getMessage(), e);\n}","preventionTips":["Use CStr/CVal/CDate in MDX calculated members to force primitive return types","Keep Mondrian schema measure types simple (Numeric/String)","Pin and test Mondrian/olap4j versions against the PDI plugin version","Preview the step in Spoon before scheduling transformations"],"tags":["mdx","type-mismatch","mondrian","pdi"],"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"}