pattersonkl / google-refine

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

Exporting date type column to TSV/CSV shows java debugging information instead of value #294

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Transform a column containing date data represented as strings (in this 
case, it was different formats including ones like "10/30/2010" as well as ones 
like "07 January 2003") into a date type column using Edit cells -> Common 
transforms -> To date
2. Export the data as Tab-separated value or Comma-separated value

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

I expect to see a similar date representation as what I see in Refine, for 
instance, "2010-10-30T00:00:00Z"

Instead, I see 
"java.util.GregorianCalendar[time=1288414800000,areFieldsSet=true,areAllFieldsSe
t=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id=""America/
Chicago"",offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,l
astRule=java.util.SimpleTimeZone[id=America/
Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMo
de=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,
endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],fi
rstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=?,YEAR=2010,MONTH=9,WEEK_OF_YEAR=?,W
EEK_OF_MONTH=?,DAY_OF_MONTH=30,DAY_OF_YEAR=?,DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=
?,AM_PM=?,HOUR=?,HOUR_OF_DAY=?,MINUTE=?,SECOND=?,MILLISECOND=?,ZONE_OFFSET=?,DST
_OFFSET=?]" 

What version of the product are you using? On what operating system?

Google Refine 2.0 on Ubuntu Linux 10.04

Original issue reported on code.google.com by geoffh...@gmail.com on 22 Dec 2010 at 11:50

GoogleCodeExporter commented 8 years ago
I tried the export again and got a string representation of the date values.  I 
don't know whether this was a result of just restarting refine or when I tried 
to work around the issue by using Edit column -> Add a column based on this 
column and using value.toString() as my expression for the new column.

Original comment by geoffh...@gmail.com on 23 Dec 2010 at 12:00

GoogleCodeExporter commented 8 years ago
Here's a number of files related to this bug.

First, there's patch that will fix the issue.  This change formats 
GregorianCalendar objects using the default date format provided by 
SimpleDateFormat.  I'm not sure if this is the correct format, but I had to 
choose something.

dates.txt is a test file that can be used to recreate the problem (with the 
steps above).

dates.csv is a sample of the bad behavior.

dates_fixed.csv is the exported file after applying the patch.

Original comment by GabrielS...@gmail.com on 27 Dec 2010 at 6:11

Attachments:

GoogleCodeExporter commented 8 years ago
I just noticed that I posted a bad patch file earlier, so here's an updated 
patch and a unit test.

Original comment by GabrielS...@gmail.com on 27 Dec 2010 at 8:41

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed by r1967.

Gabriel, I've changed your patch to output dates in ISO8601 format instead.

Original comment by dfhu...@gmail.com on 28 Dec 2010 at 3:55

GoogleCodeExporter commented 8 years ago
ISO 8601 is a much better choice than using the default format.

Just a quick nit: the updated unit test fails because the test grid isn't large 
enough.  I've attached another patch to fix this.

Original comment by GabrielS...@gmail.com on 28 Dec 2010 at 4:55

Attachments:

GoogleCodeExporter commented 8 years ago
Issue 353 has been merged into this issue.

Original comment by tfmorris on 21 Mar 2011 at 3:12

GoogleCodeExporter commented 8 years ago

Original comment by tfmorris on 9 Jun 2011 at 7:58