H cat berlinbuzzwords2012
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

H cat berlinbuzzwords2012

on

  • 2,244 views

Slides from Alan Gates' HCatalog talk at Berlin Buzzwords 2012

Slides from Alan Gates' HCatalog talk at Berlin Buzzwords 2012

Statistics

Views

Total Views
2,244
Views on SlideShare
2,236
Embed Views
8

Actions

Likes
8
Downloads
69
Comments
0

2 Embeds 8

https://twitter.com 5
http://blog.geekple.com 3

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

H cat berlinbuzzwords2012 Presentation Transcript

  • 1. HCatalogTable Management For HadoopAlan F. Gates@alanfgates Page 1
  • 2. Who Am I?• HCatalog committer and mentor• Co-founder of Hortonworks• Lead for Pig, Hive, and HCatalog at Hortonworks• Pig committer and PMC Member• Member of Apache Software Foundation and Incubator PMC• Author of Programming Pig from O’Reilly © Hortonworks Inc. 2012 Page 2
  • 3. Many Data Tools MapReduce • Early adopters • Non-relational algorithms • Performance sensitive applications Pig • ETL • Data modeling • Iterative algorithms Hive • Analysis • Connectors to BI tools Strength: Pick the right tool for your application Weakness: Hard for users to share their data © Hortonworks 2012 Page 3
  • 4. Tool ComparisonFeature MapReduce Pig HiveRecord format Key value pairs Tuple RecordData model User defined int, float, string, int, float, string, bytes, maps, maps, structs, lists tuples, bagsSchema Encoded in app Declared in script Read from or read by loader metadataData location Encoded in app Declared in script Read from metadataData format Encoded in app Declared in script Read from metadata• Pig and MR users need to know a lot to write their apps• When data schema, location, or format change Pig and MR apps must be rewritten, retested, and redeployed• Hive users have to load data from Pig/MR users to have access to it © Hortonworks 2012 Page 4
  • 5. Hadoop EcosystemMapReduce Hive Pig SerDeInputFormat/ InputFormat/ Load/ Metastore ClientOuputFormat OuputFormat Store HDFS Metastore © Hortonworks 2012 Page 5
  • 6. Opening up Metadata to MR & Pig MapReduce Hive Pig HCaInputFormat/ HCatLoader/ HCatOuputFormat HCatStorer SerDe InputFormat/ Metastore Client OuputFormat HDFS Metastore © Hortonworks 2012 Page 6
  • 7. Tools With HCatalogFeature MapReduce + Pig + HCatalog Hive HCatalogRecord format Record Tuple RecordData model int, float, string, int, float, string, int, float, string, maps, structs, lists bytes, maps, maps, structs, lists tuples, bagsSchema Read from Read from Read from metadata metadata metadataData location Read from Read from Read from metadata metadata metadataData format Read from Read from Read from metadata metadata metadata• Pig/MR users can read schema from metadata• Pig/MR users are insulated from schema, location, and format changes• All users have access to other users’ data as soon as it is committed © Hortonworks 2012 Page 7
  • 8. Pig ExampleAssume you want to count how many time each of your users went to each ofyour URLsraw = load /data/rawevents/20120530 as (url, user);botless = filter raw by myudfs.NotABot(user);grpd = group botless by (url, user);cntd = foreach grpd generate flatten(url, user), COUNT(botless);store cntd into /data/counted/20120530; No need to know No need toUsing HCatalog: file location declare schemaraw = load rawevents using HCatLoader();botless = filter raw by myudfs.NotABot(user) and ds == 20120530;grpd = group botless by (url, user); Partition filtercntd = foreach grpd generate flatten(url, user), COUNT(botless);store cntd into counted using HCatStorer(); © Hortonworks 2012 Page 8
  • 9. Working with HCatalog in MapReduceSetting input: table to read fromHCatInputFormat.setInput(job, InputJobInfo.create(dbname, tableName, filter)); database to read specify whichSetting output: from partitions to readHCatOutputFormat.setOutput(job, OutputJobInfo.create(dbname, tableName, partitionSpec)); specify whichObtaining schema: partition to writeschema = HCatInputFormat.getOutputSchema(); access fields byKey is unused, Value is HCatRecord: nameString url = value.get("url", schema);output.set("cnt", schema, cnt); © Hortonworks 2012 Page 9
  • 10. Managing Metadata• If you are a Hive user, you can use your Hive metastore with no modifications• If not, you can use the HCatalog command line tool to issue Hive DDL (Data Definition Language) commands:> /usr/bin/hcat -e ”create table rawevents (urlstring, user string) partitioned by (ds string);";• Starting in Pig 0.11, you will be able to issue DDL commands from Pig © Hortonworks 2012 Page 10
  • 11. Templeton - REST API• REST endpoints: databases, tables, partitions, columns, table properties• PUT to create/update, GET to list or describe, DELETE to drop Create new table “rawevents” Describe table “rawevents” Get a list of all tables in the default database: PUT {"columns": [{ "name": "url", "type": "string" }, { "name": "user", "type": "string"}], "partitionedBy": [{ "name": "ds", "type": "string" }]} GET GET http://…/v1/ddl/database/default/table/rawevents http://…/v1/ddl/database/default/table/rawevents http://…/v1/ddl/database/default/table Hadoop/ HCatalog { "columns": [{"name": "url","type": "string"}, "tables":"rawevents", "table": ["counted","processed",], {"name": "user","type": "string"}], "database": "default" "default” } "database": "default", "table": "rawevents" }• Included in HDP• Not yet checked in, but you can find the code on Apache’s JIRA HCATALOG-182 © Hortonworks 2012 Page 11
  • 12. HCatalog Project• HCatalog is an Apache Incubator project• Version 0.4.0-incubating released May 2012 –Hive/Pig/MapReduce integration –Support for any data format with a SerDe (Text, Sequence, RCFile, JSON SerDes included) –Notification via JMS –Initial HBase integration © Hortonworks Inc. 2012 Page 12
  • 13. Questions © Hortonworks 2012 Page 13