I'm using Spark-Sql to query Cassandra tables. In Cassandra, i've partitioned
my data with time bucket and one id, so based on queries i need to union
multiple partitions with spark-sql and do the aggregations/group-by on
union-result, something like this: for(all cassandra partitions){
DataSet<Row> currentPartition = sqlContext.sql(....);
unionResult = unionResult.union(currentPartition);
}
Increasing input (number of loaded partitions), increases response time more
than linearly because unions would be done sequentialy. Because there is no
harm in doing unions in parallel, and i dont know how to force spark to do them
in parallel, Right now i'm using a ThreadPool to Asyncronosly load all
partitions in my application (which may cause OOM), and somehow do the sort or
simple group by in java (Which make me think why even i'm using spark at all?)
The short question is: How to force spark-sql to load cassandra partitions in
parallel while doing union on them? Also I don't want too many tasks in spark,
with my Home-Made Async solution, i use coalesece(1) so one task is so fast
(only wait time on casandra). Sent using Zoho Mail