Using Below code I am getting tweets for a particular filter :
val topCounts60 = tweetMap.map((_, 1)).
reduceByKeyAndWindow(_+_, Seconds(60*60))
one of the sample Output of topCounts60 is in below format if i do topCounts60.println():
(Map(UserLang -> en, UserName -> Harmeet Singh, UserScreenName ->
harmeetsingh060, HashTags -> , UserVerification -> false, Spam -> true, UserFollowersCount -> 44, UserLocation -> भारत, UserStatusCount -> 50, UserCreated -> 2016-07-04T06:32:49.000+0530, UserDescription -> Punjabi Music, TextLength -> 118, Text -> RT @PMOIndia: The Prime Minister is chairing a high level meeting on the situation in Kashmir, UserFollowersRatio -> 0.32116788625717163, UserFavouritesCount -> 67, UserFriendsCount -> 137, StatusCreatedAt -> 2016-07-12T21:07:30.000+0530, UserID -> 749770405867556865),1)
Now I am trying to print each key pair values like below:
for ((k,v) <- topCounts60) printf("key: %s, value: %s\n", k, v)
I am getting below exception:
Error:(125, 10) constructor cannot be instantiated to expected type;
found : (T1, T2)
required: org.apache.spark.rdd.RDD[(scala.collection.immutable.Map[String,Any], Int)]
for ((k,v) <- topCounts60) printf("key: %s, value: %s\n", k, v)
How to get output like below :
UserLang -> en,
UserName -> Harmeet Singh
I am beginner in scala,have no clue how to print all values seperatley,please help me on this.