Please consider following scenario
1) Table 1 contains 16 columns 2) Table 2 contains 18 columns
I need to select all the columns from these tables and since total number of columns (34) is more than 22(constraints on tuple fields), I am using projection as show below to map field to case class objects. Is there any other approach to achieve the same in context of below requirement?
I further want to apply group by on 34 selected columns by equal number of columns or one or two less based on User inputs i.e. group by 32 columns with applying sum on remaining two columns. The group by code looks like as shown below
implicit s =>
val query = for
{
(t1, t2) <- Table1 leftJoin Table2 on
(_.A1 === _.A2)
}yield(
(t1.A1~t1.A2........~t1.A16)<>(Table1Rec,Table1Rec.unapply _)
(t2.A1~t2.A2........~t2.A18)<>(Table2Rec,Table2Rec.unapply _)
)
query.groupBy(tt=>(tt._1,tt._2)).map{
case ttt => ????
}
But, I failed to get right syntax for doing group by using mapped projection. Can someone please provide insight into right way to achieve this. Earlier post on this scenario did not provide resolution, hence posting with simplified example.