Marko, There is a handy PigStorageSchema storefunc (org.apache.pig.piggybank.storage.PigStorageSchema) in the piggybank that lets you do that:
/** * This Load/Store Func reads/writes metafiles that allow the schema and * aliases to be determined at load time, saving one from having to manually * enter schemas for pig-generated datasets. * * It also creates a ".pig_headers" file that simply lists the delimited aliases. * This is intended to make export to tools that can read files with header * lines easier (just cat the header to your data). * * Due to StoreFunc limitations, you can only write the metafiles in MapReduce * mode. You can read them in Local or MapReduce mode. */ On Thu, Jan 13, 2011 at 5:50 AM, Marko Musnjak <[email protected]>wrote: > Hi, > > What would be the best way to add a header line to the CSV files I save? > That would make the output much easier to read in excel... Right now I'm > thinking about loading a one-line file and doing a UNION, but if there's a > better way, your reccomendations are welcome > > Bye, > Marko >
