initial sourceforge import
[lwes-contrib-hive-serde.git] / README
bloba9f218130208ddce13755357706bf19407fbebdf
1 LWES Journal File SerDe README
3 *** 
4 In order to read journal files from Hive, a SerDe (Serialize/Deserializer) 
5 is needed, to map Hive columns to LWES attributes.
7 ***
8 Prerequisites
9 - JDK 1.6.x (http://java.sun.com/)
10 - Maven 2.2.x (http://apache.maven.org/)
12 ***
13 How to build
14 % mvn clean package
16 *** 
17 How to install
19 Hive looks for extensions in a directory defined in the environment
20 variable HIVE_AUX_JARS_PATH. 
21 If that variable is not defined, set it to a directory of your choice
22 Copy JournalSerDe-x.x.x.jar into that directory and launch hive
24 ***
25 Creating tables
28 This is an example of table creation.  
29 Just one event type is currently allowed per table.
30 The SerDe will automatically map a lwes attribute to the correspondent
31 hive column with the same name. Unfortunately, lwes attributes are case
32 sensitive while hive columns are not; you may also want a hive column
33 with a different name from the lwes attribute. In either case, you can
34 change the attribute/column mapping with serde properties as shown below:
35 the column sender_ip is mapped to the lwes attribute 'SenderIP'.
36 Classes for input/output are 
37 INPUTFORMAT  'org.lwes.hadoop.io.JournalInputFormat'
38 OUTPUTFORMAT 'org.lwes.hadoop.io.JournalOutputFormat'
41 CREATE TABLE mrkt_auction_complete_hourly (
42         a_bid string,
43         a_price string,
44         a_act_id bigint,
45         ......
46         x_revenue string
47  )
48 PARTITIONED BY(dt STRING)
49  ROW FORMAT SERDE 'org.lwes.hadoop.hive.EventSerDe'
50 WITH SERDEPROPERTIES (
51         'lwes.event_name'='Auction::Complete',
52         'sender_ip'='SenderIP',
53         'sender_port'='SenderPort',
54         'receipt_time'='ReceiptTime',
55         'site_id'='SiteID')
56  STORED AS
57         INPUTFORMAT  'org.lwes.hadoop.io.JournalInputFormat'
58         OUTPUTFORMAT 'org.lwes.hadoop.io.JournalOutputFormat'
59  ;
62 Also, lwes does not support FLOAT nor DOUBLE but hive does.
63 You can have define those columns as float/double and the serde
64 will convert its values according to Float.parseFloat(String) and
65 Double.parseDouble(String).
67 I also built a tool to create table definitions from the ESF file
68 and will post it too to sourceforge.
70 *** 
71 Limitations
73 Since LWES is basically a key/value format, it does not support nested 
74 columns so arrays and hashes are for now not allowed in a hive table that
75 uses this SerDe