We store our logs in S3, and one of our (Pig) queries would grab three different log types. Each log type is in sets of subdirectories based upon type/date. For instance:
/logs/<type>/<year>/<month>/<day>/<hour>/lots_of_logs_for_this_hour_and_type.log*
my query would want to load all three types of logs, for a give time. For instance:
type1 = load 's3:/logs/type1/2011/03/08' as ...
type2 = load 's3:/logs/type2/2011/03/08' as ...
type3 = load 's3:/logs/type3/2011/03/08' as ...
result = join type1 ..., type2, etc...
my queries would then run against all of these logs.
What is the most efficient way to handle this?
If you could leave some example code, if appropriate, as well, that would be helpful.
Thanks
Globbing is supported by default with PigStorage so you could just try:
type1 = load 's3:/logs/type{1,2,3}/2011/03/08' as ..
or even
type1 = load 's3:/logs/*/2011/03/08' as ..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With