Function parse_date not working for date input (not timestamp)
Reported by mfryde | March 27th, 2009 @ 10:16 AM
When i try to parse a normal date whith the line parse_date "birthDate", :pattern => "yyyy", :into => "birth_year", the output is like 410227200000 for an input like 1983-03-31 00:00:00
the Code
require 'rubygems'
require 'cascading'
require 'cascading-ext/jdbc'
require 'utils'
require 'common'
require 'date'
playersource = "/home/brm/brm-current/meo_playerProfile_small.csv"
# playersource = "/home/brm/brm-current/meo_playerProfile_20090323_OVH.csv"
horsesource = "/home/brm/brm-current/meo_horse_20090323_OVH.csv"
#cardsource = "/home/brm/brm-current/meo_card_20090323_OVH.csv"
cardsource = "/home/brm/brm-current/meo_card_small.csv"
output = "/home/brm/brm-current/brm-app-meo/player.dim"
flow = Cascading::Flow.new "olap" do
source tap(playersource)
sink tap(output , :replace => true)
assembly "main" do
split "line",
:into => ["id","name","fullname","passphrase","birthDate","email","registrationDate","gender","language","terminal","version","premium","lastConnection","totalPlayTime","banned","registrationState","avatarId","role","passwordCode","activationCode","allowFreeCamera","allowDebug","experience","pendingExperience","ranking","deltaPlops","plopsLevel","bonusCard","sourcePlayer","referer","grade","mailing","country","original_id","original_server","countryGroupName"],
:pattern=>/\t/,
:output=> ["id","birthDate","registrationDate","gender","lastConnection","totalPlayTime","registrationState","experience","country","countryGroupName"]
parse_date "birthDate", :pattern => "yyyy", :into => "birth_year"
end
end
the output
2 1983-03-31 00:00:00 2008-10-21 15:39:40 1 2009-02-16 18:47:52 325636260 4 52489 FR Euro(French) Mindscape FR 410227200000
3 2008-01-16 00:00:00 2008-09-18 10:23:39 0 2009-02-09 16:12:25 99690120 4 15512 KP defaultCountryGroup 1199145600000
5 2008-01-16 00:00:00 2007-11-30 11:05:31 1 2009-02-12 17:46:23 37490756 4 10280 FR Euro(French) Mindscape FR 1199145600000
6 2008-01-16 00:00:00 2008-09-18 11:10:32 1 2009-02-04 11:07:49 1420568 4 1695 FR Euro(French) Mindscape FR 1199145600000
7 1963-08-04 00:00:00 2007-11-30 19:16:54 0 2008-10-21 22:44:39 13070007 4 4871 AF defaultCountryGroup -220924800000
9 2008-01-16 00:00:00 2008-02-19 10:41:22 0 2008-10-09 16:04:33 32893668 4 12815 AW defaultCountryGroup 1199145600000
10 2008-01-16 15:30:03 2007-11-30 20:24:42 0 2008-05-01 15:28:44 144978923 4 28616 FR Euro(French) Mindscape FR 1199145600000
11 2008-01-16 00:00:00 2007-11-30 20:26:24 1 2009-02-16 14:07:53 328559260 4 54522 FR Euro(French) Mindscape FR 1199145600000
13 2008-01-16 15:38:47 2007-11-30 20:28:59 0 2008-11-12 09:35:17 0 0 500 FR Euro(French) Mindscape FR 1199145600000
14 1982-09-01 00:00:00 2007-11-30 20:29:24 0 2009-02-16 17:53:51 710551436 4 209580 FR Euro(French) Mindscape FR 378691200000
15 2008-01-16 00:00:00 2007-11-30 20:29:52 1 2009-02-03 14:52:29 35058543 4 8680 FR Euro(French) Mindscape FR 1199145600000
16 2008-01-16 00:00:00 2007-11-30 20:32:28 0 2009-02-04 09:48:13 10486333 4 2564 ZA Ocea(English) Mindscape AUS 1199145600000
18 2008-01-16 15:30:03 2007-11-30 21:09:34 0 2008-06-22 11:59:02 17050293 4 3868 FR Euro(French) Mindscape FR 1199145600000
19 2008-01-16 15:38:47 2007-11-30 21:14:04 0 2007-11-30 21:14:04 0 1 500 FR Euro(French) Mindscape FR 1199145600000
25 2008-01-16 15:38:47 2007-12-01 02:17:06 0 2008-05-07 22:28:11 0 1 500 FR Euro(French) Mindscape FR 1199145600000
33 2008-01-16 15:38:47 2007-12-01 09:59:34 0 2008-09-18 16:01:35 0 1 500 FR Euro(French) Mindscape FR 1199145600000
34 2008-01-16 15:38:47 2007-12-01 12:03:37 0 2007-12-01 12:03:55 0 1 500 FR Euro(French) Mindscape FR 1199145600000
35 2008-01-16 15:38:47 2007-12-01 12:06:05 0 2007-12-01 12:06:19 0 1 500 FR Euro(French) Mindscape FR 1199145600000
36 2008-01-16 15:38:47 2007-12-01 12:06:39 0 2007-12-01 12:11:10 0 1 500 FR Euro(French) Mindscape FR 1199145600000
37 2008-01-16 15:38:47 2007-12-01 15:01:56 0 2008-12-29 14:49:10 0 2 500 FR Euro(French) Mindscape FR 1199145600000
38 2008-01-16 15:38:45 2007-12-01 15:18:50 0 2007-12-05 12:31:25 2807323 4 1389 FR Euro(French) Mindscape FR 1199145600000
39 2008-01-16 15:38:47 2008-09-18 11:40:19 0 2008-09-17 17:06:25 0 1 500 FR Euro(French) Mindscape FR 1199145600000
40 2008-01-16 15:38:47 2007-12-01 15:37:40 0 2007-12-01 15:39:30 0 4 500 FR Euro(French) Mindscape FR 1199145600000
41 2008-01-16 15:38:47 2007-12-01 16:11:02 0 2007-12-01 16:30:26 903331 4 625 FR Euro(French) Mindscape FR 1199145600000
42 2008-01-16 15:38:47 2008-09-18 11:40:31 0 2007-12-01 16:36:03 137229 4 519 FR Euro(French) Mindscape FR 1199145600000
44 2008-01-16 00:00:00 2007-12-01 19:22:01 0 2008-09-18 15:55:23 11848803 4 2645 AD defaultCountryGroup 1199145600000
Comments and changes to this ticket
-

gmarabout (at gmail) March 27th, 2009 @ 10:29 AM
- Assigned user set to gmarabout (at gmail)
-

gmarabout (at gmail) March 27th, 2009 @ 02:40 PM
- State changed from new to invalid
The pattern to use is the pattern of the expected string :-)
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป