Diff for dates fails with "unknown error" always #99
Labels
imported from old code repo
Issue imported from Google Code in 2010
Priority: Medium
Represents important issues that need to be addressed but are not urgent
Type: Bug
Issues related to software defects or unexpected behavior, which require resolution.
Milestone
Original author: knut.for...@gmail.com (June 23, 2010 19:16:40)
What steps will reproduce the problem?
string values with something like: toDate(value, "EEE MMM d HH:mm:ss Z yyyy")
assume the columns are called date1 and date2
diff(cells["date1"]value, cells["date2"].value, "hours")
What is the expected output? What do you see instead?
I expect to see a numeric value indicating the difference between the two dates.
Instead I see emptiness.
What version of the product are you using? On what operating system?
Freebase on Mac OSX 10.6
SVN revision 1024.
Please provide any additional information below.
I believe the issue is that the diff function does not at all expect dates.
For some reason it expects java.util.Calendar objects. I don't know how
to create such objects in any column. The "toDate" function produces
java.util.Date objects.
I suspect this has never worked, because there is a genuine bug in there
as well. The third parameter is picked up using array index 3 which is
out of bounds. Array index 2 is the third parameter.
If I change the "Diff" function according to the diff output below everything
works much better for my use case. Maybe I shouldn't eliminate the mention
of java.util.Calendar altogether, but I don't see how it would ever come into
play.
Index: main/src/com/metaweb/gridworks/expr/functions/strings/Diff.java
--- main/src/com/metaweb/gridworks/expr/functions/strings/Diff.java (revision 1024)
+++ main/src/com/metaweb/gridworks/expr/functions/strings/Diff.java (working copy)
@@ -1,6 +1,6 @@
package com.metaweb.gridworks.expr.functions.strings;
-import java.util.Calendar;
+import java.util.Date;
import java.util.Properties;
import org.apache.commons.lang.StringUtils;
@@ -20,14 +20,14 @@
if (o1 != null && o2 != null) {
if (o1 instanceof String && o2 instanceof String) {
return StringUtils.difference((String) o1,(String) o2);
Original issue: http://code.google.com/p/google-refine/issues/detail?id=99
The text was updated successfully, but these errors were encountered: