Row ds1row = ds1.getRow();
List<Row> ds1rows = new ArrayList<Row>();
ds1rows.add(ds1row);
DataSet carthesianProduct = getCarthesianProduct(new DataSet[] {
new InMemoryDataSet(new CachingDataSetHeader(si1), ds1rows),
new InMemoryDataSet(new CachingDataSetHeader(si2), ds2data) }, onConditions);
List<Row> carthesianRows = readDataSetFull(carthesianProduct);
if (carthesianRows.size() > 0) {
resultRows.addAll(carthesianRows);
} else {
Object[] values = ds1row.getValues();
Object[] row = new Object[selectItems.length];
System.arraycopy(values, 0, row, 0, values.length);
resultRows.add(new DefaultRow(header, row));
}
}
ds1.close();
if (resultRows.isEmpty()) {
return new EmptyDataSet(selectItems);
}
return new InMemoryDataSet(header, resultRows);
}