spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cui Lin <cui....@hds.com>
Subject Spark sql results can't be printed out to system console from spark streaming application
Date Tue, 03 Mar 2015 23:55:05 GMT


>Dear all,
>
>I found the below sample code can be printed out only in spark shell, but
>when I moved them into my spark streaming application, nothing can be
>printed out into system console. Can you explain why it happened? anything
>related to new spark context? Thanks a lot!
>
>
>val anotherPeopleRDD = sc_context.parallelize(
>  """{"name":"Yin","address":{"city":"Columbus","state":"Ohio"}}""" ::
>Nil)
>
>anotherPeopleRDD.toArray().foreach(line => System.out.println(line))
>
>val jsonMessage = sqlContext.jsonRDD(anotherPeopleRDD)
>
>jsonMessage.toArray().foreach(line => System.out.println(line))
>
>jsonMessage.registerTempTable("people")
>
>val test: SchemaRDD = sqlContext.sql("select count(*) from people")
>
>test.toArray().foreach(line => System.out.println(line))
>
>
>
>
>Best regards,
>
>Cui Lin
>
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Mime
View raw message