hadoop - Is there a way to sum two columns into another column in Hive HQL? -



hadoop - Is there a way to sum two columns into another column in Hive HQL? -

i'm looking running daily, weekly, , monthly sum of number of messages sent out. there 500 different message types.

i have next tables:

table name: messages int message_type bigint num_sent string date table name: stats int message_type bigint num_sent_today bigint num_sent_week bigint num_sent_month

table messages updated daily new rows today's date. there single hive query can run daily update stats table? note can't running counts querying messages table straight using where date >= 30 days ago because table big. have add/subtract daily values table stats instead. this:

// pseudocode // table (call table b) table messages int message_type bigint num_sent_today bigint num_sent_seven_days_ago bigint num_sent_thirty_days_ago // bring together b table stats can // set stats.num_sent_today = b.num_sent_today // set stats.num_sent_week = stats.num_sent_week + b.num_sent_today - b.num_sent_seven_days_ago // set stats.num_sent_month = stats.num_sent_month + b.num_sent_today - b.num_sent_thirty_days_ago

try using : concat(column1, column2) newcolumn

hadoop mapreduce hive hiveql

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -