ericmckean / google-refine

Automatically exported from code.google.com/p/google-refine
Other
0 stars 0 forks source link

Transpose (and column creation) bug #406

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create project from fixed-rows.csv split columns off, 0 header lines.
2. Apply,
[
  {
    "op": "core/transpose-rows-into-columns",
    "description": "Transpose every 4 cells in column Column into separate columns",
    "columnName": "Column",
    "rowCount": 4
  },
  {
    "op": "core/column-addition",
    "description": "Create column Transaction at index 1 based on column Column 1 using expression grel:if(value.contains(\" sent \"), \"send\", \"receive\")",
    "engineConfig": {
      "facets": [],
      "mode": "row-based"
    },
    "newColumnName": "Transaction",
    "columnInsertIndex": 1,
    "baseColumnName": "Column 1",
    "expression": "grel:if(value.contains(\" sent \"), \"send\", \"receive\")",
    "onError": "set-to-blank"
  },
  {
    "op": "core/column-addition",
    "description": "Create column Sender at index 1 based on column Column 1 using expression grel:value.partition(\" sent \")[0]",
    "engineConfig": {
      "facets": [
        {
          "invert": false,
          "expression": "value",
          "selectError": false,
          "omitError": false,
          "selectBlank": false,
          "name": "Transaction",
          "omitBlank": false,
          "columnName": "Transaction",
          "type": "list",
          "selection": [
            {
              "v": {
                "v": "send",
                "l": "send"
              }
            }
          ]
        }
      ],
      "mode": "row-based"
    },
    "newColumnName": "Sender",
    "columnInsertIndex": 1,
    "baseColumnName": "Column 1",
    "expression": "grel:value.partition(\" sent \")[0]",
    "onError": "set-to-blank"
  }
]

(This is exactly out of the tutorial, except resetting the Sender text facet 
afterwards)

3. Undo by clicking on Step 1.

What is the expected output? What do you see instead?

In Column 4, data has gone missing in rows 1 & 3. Additionally, clicking back 
to Step 3, data from Column 4 has ended up in the Sender column.

Interesting clue: If I export & import the project right after the 
transposition and continue with the steps the bug doesn't manifest suggesting 
something up with the transpose itself.

Affecting trunk.

Original issue reported on code.google.com by paulm%pa...@gtempaccount.com on 13 Jun 2011 at 8:47

Attachments:

GoogleCodeExporter commented 9 years ago
Paul, does the label change from rows mode back to records mode ever ?  or does 
it stay in row based ? Does it perform differently using either mode as the 
starting point, I wonder ? 

Original comment by thadguidry on 13 Jun 2011 at 8:57

GoogleCodeExporter commented 9 years ago
Thad - am home now; maybe you could try it - it shouldn't be more than a minute 
to repro. Good so have a 2nd pair of eyes! Section 5, "Transpose Fixed Number 
of Rows into Columns" http://davidhuynh.net/spaces/nicar2011/tutorial.pdf

Original comment by paulm%pa...@gtempaccount.com on 13 Jun 2011 at 9:23

GoogleCodeExporter commented 9 years ago
I have also encountered this problem after using the "Transpose rows into 
columns" function. The "Add column" function adds a column but overwrites the 
data in a second column. If undoes the "Transform and Add column" and  tries 
Transform and Add column again the data overwritten in the column to the right 
of the one first affected. 
The problem disappears one the Undo, Redo Transform / Add Column until all of 
the original columns have been affected.
The bug is addressed better by exporting the data after the initial 
transformation and then reimporting to Google Refine. Add column then works as 
it should.
My original data was a simple text file with no field delimiters.  

Original comment by elder...@gmail.com on 29 Aug 2012 at 10:41