Skip to content

Commit

Permalink
fixed the formatting for spark jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunal Kusoorkar authored and Kunal Kusoorkar committed Apr 26, 2016
1 parent 77c9bdc commit 7aeed3c
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 60 deletions.
Binary file modified .DS_Store
Binary file not shown.
7 changes: 0 additions & 7 deletions RollUpReports/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 77 additions & 20 deletions RollUpReports/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions RollUpReports/src/main/scala/RollUpReportsByCC.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,24 @@ object RollUpReportsByCC {
)""")

//hourlyaggregates_bycc
val rollup4= sqlContext.sql("select cc_no, int(concat(year,month,day,hour)) as hour, sum(amount) as total_amount, min(amount) as min_amount, max(amount) as max_amount, count(*) as total_count from temp_transactions group by cc_no, int(concat(year,month,day,hour))")
//val rollup4= sqlContext.sql("select cc_no, int(concat(year,month,day,hour)) as hour, sum(amount) as total_amount, min(amount) as min_amount, max(amount) as max_amount, count(*) as total_count from temp_transactions group by cc_no, int(concat(year,month,day,hour))")
val rollup4= sqlContext.sql("select cc_no, int(concat(year, if(length(month)=1, concat('0',month), month),if(length(day)=1, concat('0',day), day), if(length(hour)=1, concat('0',hour), hour))) as hour, sum(amount) as total_amount, min(amount) as min_amount, max(amount) as max_amount from temp_transactions group by cc_no, concat(year, if(length(month)=1, concat('0',month), month),if(length(day)=1, concat('0',day), day), if(length(hour)=1, concat('0',hour), hour))")
rollup4.write.format("org.apache.spark.sql.cassandra")
.mode(SaveMode.Overwrite)
.options(Map("keyspace" -> "rtfap", "table" -> "hourlyaggregates_bycc"))
.save()

// dailyaggregations_bycc
val rollup3= sqlContext.sql("select cc_no, int(concat(year,month,day)) as day, sum(amount) as total_amount, min(amount) as min_amount, max(amount) as max_amount, count(*) as total_count from temp_transactions group by cc_no, int(concat(year,month,day))")
//val rollup3= sqlContext.sql("select cc_no, int(concat(year,month,day)) as day, sum(amount) as total_amount, min(amount) as min_amount, max(amount) as max_amount, count(*) as total_count from temp_transactions group by cc_no, int(concat(year,month,day))")
val rollup3= sqlContext.sql("select cc_no, int(concat(year, if(length(month)=1, concat('0',month), month),if(length(day)=1, concat('0',day), day))) as day, sum(amount) as total_amount, min(amount) as min_amount, max(amount) as max_amount from temp_transactions group by cc_no, concat(year, if(length(month)=1, concat('0',month), month),if(length(day)=1, concat('0',day), day))")
rollup3.write.format("org.apache.spark.sql.cassandra")
.mode(SaveMode.Overwrite)
.options(Map("keyspace" -> "rtfap", "table" -> "dailyaggregates_bycc"))
.save()

// monthlyaggregations_bycc
val rollup5= sqlContext.sql("select cc_no, int(concat(year,month)) as month, sum(amount) as total_amount, min(amount) as min_amount, max(amount) as max_amount, count(*) as total_count from temp_transactions group by cc_no, int(concat(year,month))")
//val rollup5= sqlContext.sql("select cc_no, int(concat(year,month)) as month, sum(amount) as total_amount, min(amount) as min_amount, max(amount) as max_amount, count(*) as total_count from temp_transactions group by cc_no, int(concat(year,month))")
val rollup5= sqlContext.sql("select cc_no, int(concat(year, if(length(month)=1, concat('0',month), month))) as month, sum(amount) as total_amount, min(amount) as min_amount, max(amount) as max_amount from temp_transactions group by cc_no, concat(year, if(length(month)=1, concat('0',month), month))")
rollup5.write.format("org.apache.spark.sql.cassandra")
.mode(SaveMode.Overwrite)
.options(Map("keyspace" -> "rtfap", "table" -> "monthlyaggregates_bycc"))
Expand Down
Binary file modified RollUpReports/target/scala-2.10/classes/RollUpReportsByCC$.class
Binary file not shown.
Binary file modified RollUpReports/target/scala-2.10/rollupreports_2.10-1.0.jar
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Loading

0 comments on commit 7aeed3c

Please sign in to comment.