You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by chen yong <cy...@hotmail.com> on 2016/10/01 13:11:34 UTC

答复: get different results when debugging and running scala program

Dear Jakob,


Thanks for your reply.


The output text in console is as follows


runing output:

1
2
3
4
5
6
7

in
3
in
2
in
1
in



debugging output:
01
02
03
04
05
06
07
08
09
10
11

in
3
in
2
in
2
in
1
in
1
in



________________________________
发件人: Jakob Odersky <ja...@odersky.com>
发送时间: 2016年10月1日 8:44
收件人: chen yong
抄送: user@spark.apache.org
主题: Re: get different results when debugging and running scala program

There is no image attached, I'm not sure how the apache mailing lists
handle them. Can you provide the output as text?

best,
--Jakob

On Fri, Sep 30, 2016 at 8:25 AM, chen yong <cy...@hotmail.com> wrote:
> Hello All,
>
>
>
> I am using IDEA 15.0.4 to debug a scala program. It is strange to me that
> the results were different when I debug or run the program. The differences
> can be seen in the attached filed run.jpg and debug.jpg. The code lines of
> the scala program are shown below.
>
>
> Thank you all
>
>
> -------
>
> import scala.collection.mutable.ArrayBuffer
>
> object TestCase1{
> def func(testtttt:Iterator[(Int,Long)]): Iterator[(Int,Long)]={
> println("in")
> val testtttt1=testtttt.flatmap{
> case(item,count)=>
> val newPrefix=item
> println(count)
> val a=Iterator.single((newPrefix,count))
> func(a)
> val c = a
> c
> }
> testtttt1
> }
> def main(args: Array[String]){
> val freqItems = ArrayBuffer((2,3L),(3,2L),(4,1L))
> val testtttt = freqItems.toIterator
> val result = func(testtttt)
> val reer = result.toArray
> }
> }
>
>
>