Type mismatch: cannot convert from int to DataRow

I am trying to create a new node with no inputs but when I execute the node i get an Error within a line where only a TODO comment is.

The execute() function:

@Override
    protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
		BufferedDataContainer container = exec.createDataContainer(null);

		boolean currentAuthState = authNeeded.getBooleanValue();
		List<DataCell> cells = new ArrayList<>();
		cells.add(new StringCell(String.valueOf(currentAuthState)));
		
		DataRow row = new DefaultRow(RowKey.createRowKey(1L), cells);
		
		container.addRowToTable(row);
		container.close();
		BufferedDataTable out = container.getTable();
		return new BufferedDataTable[] { out };
    }

But the code isn’t even reached when i (try to) execute the node.
Respectively the breakpoints I set arn’t reached.
The function with the line where I get the error:

@Override
    protected DataTableSpec[] configure(final DataTableSpec[] inSpecs) throws InvalidSettingsException {
    	
    	// TODO: generated method stub
        return new DataTableSpec[]{null};
    }

Hi again,

First: Is this really the code which was executed when you got the error?

Independently of that, I’d suggest to check this first, as a null argument doesn’t seem right here:

exec.createDataContainer(null)

Instead you should build a schema which resembles your output table. Have a look at the DataTableSpecCreator and the DataColumnSpecCreator for that (you can reuse this in the configure function and return the spec there as well).

E.g.

DataTableSpecCreator specCreator = new DataTableSpecCreator();
specCreator.addColumns(new DataColumnSpecCreator("name", StringCell.TYPE).createSpec());
DataTableSpec spec = specCreator.createSpec();

–Philipp

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.