You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Earl Cahill (JIRA)" <ji...@apache.org> on 2008/10/18 06:36:44 UTC
[jira] Created: (PIG-503) change default outgoing date format for
DateExtractor
change default outgoing date format for DateExtractor
-----------------------------------------------------
Key: PIG-503
URL: https://issues.apache.org/jira/browse/PIG-503
Project: Pig
Issue Type: Improvement
Reporter: Earl Cahill
the format
yyyy-MM-dd
is much more friendly for mysql (and likely other databases) then the current default
MM-dd-yyyy
With the proposed format, one could insert into a DATE field without alteration
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (PIG-503) change default outgoing date format for
DateExtractor
Posted by "Alan Gates (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alan Gates resolved PIG-503.
----------------------------
Resolution: Fixed
Patch checked in. Thanks Earl for your continuing contributions.
> change default outgoing date format for DateExtractor
> -----------------------------------------------------
>
> Key: PIG-503
> URL: https://issues.apache.org/jira/browse/PIG-503
> Project: Pig
> Issue Type: Improvement
> Reporter: Earl Cahill
> Attachments: DateExtractor-PIG-503
>
>
> the format
> yyyy-MM-dd
> is much more friendly for mysql (and likely other databases) then the current default
> MM-dd-yyyy
> With the proposed format, one could insert into a DATE field without alteration
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (PIG-503) change default outgoing date format for
DateExtractor
Posted by "Alan Gates (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alan Gates updated PIG-503:
---------------------------
Status: Open (was: Patch Available)
Earl, please attach this patch as a separate file rather than putting it in the comment box. It's much easier that way to download it and test it. Thanks.
> change default outgoing date format for DateExtractor
> -----------------------------------------------------
>
> Key: PIG-503
> URL: https://issues.apache.org/jira/browse/PIG-503
> Project: Pig
> Issue Type: Improvement
> Reporter: Earl Cahill
>
> the format
> yyyy-MM-dd
> is much more friendly for mysql (and likely other databases) then the current default
> MM-dd-yyyy
> With the proposed format, one could insert into a DATE field without alteration
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (PIG-503) change default outgoing date format for
DateExtractor
Posted by "Earl Cahill (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Earl Cahill updated PIG-503:
----------------------------
Status: Patch Available (was: Open)
### Eclipse Workspace Patch 1.0
#P pig
Index: contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/evaluation/util/apachelogparser/TestDateExtractor.java
===================================================================
--- contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/evaluation/util/apachelogparser/TestDateExtractor.java (revision 705841)
+++ contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/evaluation/util/apachelogparser/TestDateExtractor.java (working copy)
@@ -36,7 +36,7 @@
Tuple input = new Tuple(new DataAtom("20/Sep/2008:23:53:04 -0600"));
DataAtom output = new DataAtom();
dayExtractor.exec(input, output);
- assertEquals("09-20-2008", output.toString());
+ assertEquals("2008-09-20", output.toString());
}
@Test
@@ -51,7 +51,7 @@
input = new Tuple(new DataAtom("20/Sep/2008:23:53:04 -0600"));
output = new DataAtom();
dayExtractor.exec(input, output);
- assertEquals("09-20-2008", output.toString());
+ assertEquals("2008-09-20", output.toString());
}
@Test
Index: contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/util/apachelogparser/DateExtractor.java
===================================================================
--- contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/util/apachelogparser/DateExtractor.java (revision 705841)
+++ contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/util/apachelogparser/DateExtractor.java (working copy)
@@ -23,7 +23,7 @@
/**
* DateExtractor has three different constructors which each allow for different functionality. The
- * incomingDateFormat (MM-dd-yyyy by default) is used to match the date string that gets passed in from the
+ * incomingDateFormat (yyyy-MM-dd by default) is used to match the date string that gets passed in from the
* log. The outgoingDateFormat (dd/MMM/yyyy:HH:mm:ss Z by default) is used to format the returned string.
*
* Different constructors exist for each combination; please use the appropriate respective constructor.
@@ -34,13 +34,13 @@
*
* From pig latin you will need to use aliases to use a non-default format, like
*
- * define MyDateExtractor org.apache.pig.piggybank.evaluation.util.apachelogparser.DateExtractor("MM-yyyy");
+ * define MyDateExtractor org.apache.pig.piggybank.evaluation.util.apachelogparser.DateExtractor("yyyy-MM");
*
* A = FOREACH row GENERATE DateExtractor(dayTime);
*/
public class DateExtractor extends EvalFunc<DataAtom> {
private static SimpleDateFormat DEFAULT_INCOMING_DATE_FORMAT = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss Z");
- private static SimpleDateFormat DEFAULT_OUTGOING_DATE_FORMAT = new SimpleDateFormat("MM-dd-yyyy");
+ private static SimpleDateFormat DEFAULT_OUTGOING_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
private SimpleDateFormat incomingDateFormat;
private SimpleDateFormat outgoingDateFormat;
@@ -85,8 +85,7 @@
try {
date = incomingDateFormat.parse(incomingDateString);
} catch (ParseException e) {
- System.err.println("Unable to parse incoming date string " +
- incomingDateString + ", " + e.getMessage());
+ System.err.println("Unable to parse incoming date string " + incomingDateString + ", " + e.getMessage());
return;
}
> change default outgoing date format for DateExtractor
> -----------------------------------------------------
>
> Key: PIG-503
> URL: https://issues.apache.org/jira/browse/PIG-503
> Project: Pig
> Issue Type: Improvement
> Reporter: Earl Cahill
>
> the format
> yyyy-MM-dd
> is much more friendly for mysql (and likely other databases) then the current default
> MM-dd-yyyy
> With the proposed format, one could insert into a DATE field without alteration
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (PIG-503) change default outgoing date format for
DateExtractor
Posted by "Earl Cahill (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Earl Cahill updated PIG-503:
----------------------------
Attachment: DateExtractor-PIG-503
The funny thing is I thought pasting in the patch would be better :)
enjoy!
Earl
> change default outgoing date format for DateExtractor
> -----------------------------------------------------
>
> Key: PIG-503
> URL: https://issues.apache.org/jira/browse/PIG-503
> Project: Pig
> Issue Type: Improvement
> Reporter: Earl Cahill
> Attachments: DateExtractor-PIG-503
>
>
> the format
> yyyy-MM-dd
> is much more friendly for mysql (and likely other databases) then the current default
> MM-dd-yyyy
> With the proposed format, one could insert into a DATE field without alteration
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.