#1 open
mfryde

Rename function deletes column

Reported by mfryde | March 27th, 2009 @ 09:57 AM

In the Join code, adding the line rename ["playerProfile_id"], ["id"] delete the column "last_horses_count"


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(horsesource)

  sink tap( output , :replace => true)
  
	
	
	assembly "main" do
		split "line", 
			:into => ["id","zone_id","horseTemplate_id","playerProfile_id","horseName","hunger","health","cleanliness","trust","vitality","staminaBonus","speedBonus","jumpBonus","trotBonus","gallopBonus","figuresBonus","docilityBonus","lastUpdate","healthGroomTime","cleanlinessGroomTime","hungerGroomTime","trustGroomTime","inMeadow","pregnancyStartTime","birthDate","foalState","idFather","idMother","buyable","original_id","original_server"], 
			:pattern=>/\t/, 
			:output=> ["id","playerProfile_id"]
		group_by "playerProfile_id"
		count "playerProfile_id", :into => "last_horses_count"
		rename ["playerProfile_id"], ["id"]
		#restrict_to ["id" , "last_horses_count"] 

	end		
	


	
end

Comments and changes to this ticket

  • gmarabout (at gmail)

    gmarabout (at gmail) March 27th, 2009 @ 02:42 PM

    • State changed from “new” to “open”

    For the time being, the 'rename' command expects all fields as input (1st argument), and all new fields name as output (2nd argument). For example:

    rename ["Field1", "Field2", "Field3"], ["Field1", "New_Field2", "Field3"]

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Pages