use of org.knime.core.data.container.ContainerTable in project knime-core by knime.
the class LiftChartNodeModel method loadInternals.
/**
* {@inheritDoc}
*/
@Override
protected void loadInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
File dataFile1 = new File(nodeInternDir, DATA_FILE + "1");
File dataFile2 = new File(nodeInternDir, DATA_FILE + "2");
ContainerTable dataCont1 = DataContainer.readFromZip(dataFile1);
ContainerTable dataCont2 = DataContainer.readFromZip(dataFile2);
m_dataArray = new DataArray[2];
m_dataArray[0] = new DefaultDataArray(dataCont1, 1, (int) dataCont1.size(), exec.createSubProgress(0.5));
m_dataArray[1] = new DefaultDataArray(dataCont2, 1, (int) dataCont2.size(), exec.createSubProgress(0.5));
}
use of org.knime.core.data.container.ContainerTable in project knime-core by knime.
the class LinReg2LearnerNodeModel method loadInternals.
/**
* {@inheritDoc}
*/
@Override
protected void loadInternals(final File internDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
File inFile = new File(internDir, FILE_SAVE);
ModelContentRO c = ModelContent.loadFromXML(new BufferedInputStream(new GZIPInputStream(new FileInputStream(inFile))));
try {
ModelContentRO specContent = c.getModelContent(CFG_SPEC);
DataTableSpec spec = DataTableSpec.load(specContent);
ModelContentRO parContent = c.getModelContent(CFG_LinReg2_CONTENT);
m_content = LinearRegressionContent.load(parContent, spec);
} catch (InvalidSettingsException ise) {
IOException ioe = new IOException("Unable to restore state: " + ise.getMessage());
ioe.initCause(ise);
throw ioe;
}
File dataFile = new File(internDir, FILE_DATA);
ContainerTable t = DataContainer.readFromZip(dataFile);
int rowCount = t.getRowCount();
m_rowContainer = new DefaultDataArray(t, 1, rowCount, exec);
}
use of org.knime.core.data.container.ContainerTable in project knime-core by knime.
the class HierarchicalClusterNodeModel method loadInternals.
/**
* {@inheritDoc}
*/
@Override
protected void loadInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
// distances
File distFile = new File(nodeInternDir, CFG_DIST_DATA);
ContainerTable table1 = DataContainer.readFromZip(distFile);
m_fusionTable = new DefaultDataArray(table1, 1, table1.getRowCount());
// data rows
File dataFile = new File(nodeInternDir, CFG_H_CLUST_DATA);
ContainerTable table2 = DataContainer.readFromZip(dataFile);
m_dataArray = new DefaultDataArray(table2, 1, table2.getRowCount());
File f = new File(nodeInternDir, CFG_HCLUST);
FileInputStream fis = new FileInputStream(f);
NodeSettingsRO settings = NodeSettings.loadFromXML(fis);
// if we had some data...
if (m_dataArray.size() > 0) {
// we also have some clustering nodes
try {
m_rootNode = ClusterNode.loadFromXML(settings, m_dataArray);
} catch (InvalidSettingsException e) {
throw new IOException(e.getMessage());
}
}
}
use of org.knime.core.data.container.ContainerTable in project knime-core by knime.
the class ReadTableNodeModel method createStreamableOperator.
/**
* {@inheritDoc}
*/
@Override
public StreamableOperator createStreamableOperator(final PartitionInfo partitionInfo, final PortObjectSpec[] inSpecs) throws InvalidSettingsException {
return new StreamableOperator() {
@Override
public void runFinal(final PortInput[] inputs, final PortOutput[] outputs, final ExecutionContext exec) throws Exception {
exec.setMessage("Extract temporary table");
ContainerTable table = extractTable(exec.createSubExecutionContext(0.4));
exec.setMessage("Streaming Output");
RowOutput output = (RowOutput) outputs[0];
execute(table, output, exec.createSubExecutionContext(0.6));
}
};
}
use of org.knime.core.data.container.ContainerTable in project knime-core by knime.
the class ReadTableNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
exec.setMessage("Extracting temporary table");
ContainerTable table = extractTable(exec.createSubExecutionContext(0.4));
exec.setMessage("Reading into final format");
BufferedDataTableRowOutput c = new BufferedDataTableRowOutput(exec.createDataContainer(table.getDataTableSpec(), true));
execute(table, c, exec.createSubExecutionContext(0.6));
return new BufferedDataTable[] { c.getDataTable() };
}
Aggregations