Hi,
Below is my code and result where I am trying to query IgniteRDD through SQL 
statement with scala at Zeppelin.
First I use restful API to put a pair of data(key=10, val=45) into Ignite cache.

%python
import requests
requests.put("http://127.0.0.1:8080/ignite?cmd=put&key=10&val=45&cacheName=zeppelincache";)

Result:
<Response [200]>


Then I execute the code below.

%spark
import org.apache.ignite.configuration._
import org.apache.ignite.spark._

val ic = new IgniteContext(sc,()=>new IgniteConfiguration())
val sharedRDD2 = ic.fromCache[Integer,Integer]("zeppelincache")
sharedRDD2.savePairs(sc.parallelize(1 to 3, 3).map(i => (i, i*2)))

sharedRDD2.collect
sharedRDD2.sql("select * from Integer").show()

Result:
import org.apache.ignite.configuration._
import org.apache.ignite.spark._
ic: org.apache.ignite.spark.IgniteContext = 
org.apache.ignite.spark.IgniteContext@7a017337
sharedRDD2: org.apache.ignite.spark.IgniteRDD[Int,Int] = IgniteRDD[136] at RDD 
at IgniteAbstractRDD.scala:32
res129: Array[(Int, Int)] = Array((1,2), (2,4), (3,6), (10,45))
+----+----+
|_KEY|_VAL|
+----+----+
|   1|    2|
|   2|    4|
|   3|    6|
+----+----+



1.      Why can the collect command get the pair (10,45) but SQL statement 
can’t?

2.      How to get the pair (10,45) through SQL statement?

Thanks.



--
本信件可能包含工研院機密資訊,非指定之收件者,請勿使用或揭露本信件內容,並請銷毀此信件。 This email may contain 
confidential information. Please do not use or disclose it in any way and 
delete it if you are not the intended recipient.

Reply via email to