From dbeaefb00b4ac9160bdf2c16d86acfc3ac027887 Mon Sep 17 00:00:00 2001 From: David Huynh Date: Mon, 7 Nov 2011 19:53:26 +0000 Subject: [PATCH] Minor bug fix to previous check-in: made sure blank cells in the 2 newly generated columns don't get filled in. git-svn-id: http://google-refine.googlecode.com/svn/trunk@2368 7d457c2a-affb-35e4-300a-418c747d4874 --- .../cell/TransposeColumnsIntoRowsOperation.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/main/src/com/google/refine/operations/cell/TransposeColumnsIntoRowsOperation.java b/main/src/com/google/refine/operations/cell/TransposeColumnsIntoRowsOperation.java index e35cfc87e..c45e8782c 100644 --- a/main/src/com/google/refine/operations/cell/TransposeColumnsIntoRowsOperation.java +++ b/main/src/com/google/refine/operations/cell/TransposeColumnsIntoRowsOperation.java @@ -339,12 +339,17 @@ public class TransposeColumnsIntoRowsOperation extends AbstractOperation { for (int r2 = firstNewRowIndex + 1; r2 < newRows.size(); r2++) { Row newRow = newRows.get(r2); for (int c = 0; c < newColumns.size(); c++) { - Column column = newColumns.get(c); - int cellIndex = column.getCellIndex(); - - Cell cellToCopy = firstNewRow.getCell(cellIndex); - if (cellToCopy != null && newRow.getCell(cellIndex) == null) { - newRow.setCell(cellIndex, cellToCopy); + if (c < startColumnIndex || + (_combinedColumnName != null ? + c > startColumnIndex : + c > startColumnIndex + 1)) { + Column column = newColumns.get(c); + int cellIndex = column.getCellIndex(); + + Cell cellToCopy = firstNewRow.getCell(cellIndex); + if (cellToCopy != null && newRow.getCell(cellIndex) == null) { + newRow.setCell(cellIndex, cellToCopy); + } } } }