protected void produceRows(ValueNode root, LinkedList<Object[]> rowsPool,
			LinkedList<Object[]> result, Set<Integer> processedFields) {

		if (root.fieldIdx != null) { // Field value (leaf)
			int fieldIdx = root.fieldIdx.intValue();
			if (rowsPool.size() == 0) {
				// Create new row, and push it to the rows pool
				Object[] row = new Object[fields.length];
				for (int i = 0; i < row.length; ++i) {
					row[i] = EMPTY;
				}
				row[fieldIdx] = root.value;
				rowsPool.add(row);

			} else {
				List<Object[]> newRows = new LinkedList<Object[]>();
				for (Object[] row : rowsPool) {
					if (row[fieldIdx] == EMPTY) {
						row[fieldIdx] = root.value;
					} else {
						// Clone the row:
						Object[] newRow = new Object[row.length];
						System.arraycopy(row, 0, newRow, 0, row.length);
						newRow[fieldIdx] = root.value;
						newRows.add(newRow);
					}
				}
				rowsPool.addAll(newRows);
			}
			processedFields.add(root.fieldIdx);
		} else {
			for (ValueNode child : root.children) {
				produceRows(child, rowsPool, result, processedFields);
			}
			if (processedFields.size() == fields.length) {
				// Move all created rows from the pool to the result
				result.addAll(rowsPool);
				rowsPool.clear();
				processedFields.clear();
			}
		}
	}